| 1 |
// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversion -ffreestanding -verify %s |
| 2 |
// REQUIRES: aarch64-registered-target || arm-registered-target |
| 3 |
|
| 4 |
#ifndef INCLUDE |
| 5 |
|
| 6 |
#include <arm_neon.h> |
| 7 |
|
| 8 |
// Should not report incompatible vector types. |
| 9 |
int32x2_t test(int32x2_t x) { |
| 10 |
return vshr_n_s32(x, 31); |
| 11 |
} |
| 12 |
|
| 13 |
// ...but should warn when the types really do not match. |
| 14 |
float32x2_t test2(uint32x2_t x) { |
| 15 |
return vcvt_n_f32_s32(x, 9); // expected-warning {{incompatible vector types}} |
| 16 |
} |
| 17 |
|
| 18 |
// Check immediate range for vcvt_n intrinsics is 1 to 32. |
| 19 |
float32x2_t test3(uint32x2_t x) { |
| 20 |
// FIXME: The "incompatible result type" error is due to pr10112 and should be |
| 21 |
// removed when that is fixed. |
| 22 |
return vcvt_n_f32_u32(x, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}} |
| 23 |
} |
| 24 |
|
| 25 |
typedef signed int vSInt32 __attribute__((__vector_size__(16))); |
| 26 |
int32x4_t test4(int32x4_t a, vSInt32 b) { |
| 27 |
a += b; |
| 28 |
b += a; |
| 29 |
return b += a; |
| 30 |
} |
| 31 |
|
| 32 |
// Warn for incompatible pointer types used with vld/vst intrinsics. |
| 33 |
int16x8_t test5(int *p) { |
| 34 |
return vld1q_s16(p); // expected-error {{incompatible pointer types}} |
| 35 |
} |
| 36 |
void test6(float *p, int32x2_t v) { |
| 37 |
return vst1_s32(p, v); // expected-error {{incompatible pointer types}} |
| 38 |
} |
| 39 |
|
| 40 |
#define INCLUDE |
| 41 |
#include "arm-neon-types.c" |
| 42 |
#else |
| 43 |
|
| 44 |
// Make sure we don't get a warning about using a static function in an |
| 45 |
// extern inline function from a header. |
| 46 |
extern inline uint8x8_t test7(uint8x8_t a, uint8x8_t b) { |
| 47 |
return vadd_u8(a, b); |
| 48 |
} |
| 49 |
#endif |