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