David Blaikie | 1d23c42 | 2012-03-15 05:09:31 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversion -ffreestanding -verify %s |
Bob Wilson | 0608f53 | 2010-12-02 07:13:31 +0000 | [diff] [blame] | 2 | |
| 3 | #include <arm_neon.h> |
| 4 | |
| 5 | // Radar 8228022: Should not report incompatible vector types. |
| 6 | int32x2_t test(int32x2_t x) { |
| 7 | return vshr_n_s32(x, 31); |
| 8 | } |
| 9 | |
| 10 | // ...but should warn when the types really do not match. |
| 11 | float32x2_t test2(uint32x2_t x) { |
Bob Wilson | d7bc7a2 | 2011-06-09 17:03:27 +0000 | [diff] [blame] | 12 | return vcvt_n_f32_s32(x, 9); // expected-warning {{incompatible vector types}} |
| 13 | } |
| 14 | |
| 15 | // Check immediate range for vcvt_n intrinsics is 1 to 32. Radar 9558930. |
| 16 | float32x2_t test3(uint32x2_t x) { |
| 17 | // FIXME: The "incompatible result type" error is due to pr10112 and should be |
| 18 | // removed when that is fixed. |
| 19 | return vcvt_n_f32_u32(x, 0); // expected-error {{argument should be a value from 1 to 32}} expected-error {{incompatible result type}} |
Bob Wilson | 0608f53 | 2010-12-02 07:13:31 +0000 | [diff] [blame] | 20 | } |
Eli Friedman | b9b4b78 | 2011-06-23 18:10:35 +0000 | [diff] [blame] | 21 | |
| 22 | typedef signed int vSInt32 __attribute__((__vector_size__(16))); |
| 23 | int32x4_t test4(int32x4_t a, vSInt32 b) { |
| 24 | a += b; |
| 25 | b += a; |
| 26 | return b += a; |
| 27 | } |
Bob Wilson | 6f9f03e | 2011-11-08 05:04:11 +0000 | [diff] [blame] | 28 | |
| 29 | // Warn for incompatible pointer types used with vld/vst intrinsics. |
| 30 | int16x8_t test5(int *p) { |
| 31 | return vld1q_s16(p); // expected-warning {{incompatible pointer types}} |
| 32 | } |
| 33 | void test6(float *p, int32x2_t v) { |
| 34 | return vst1_s32(p, v); // expected-warning {{incompatible pointer types}} |
| 35 | } |