xref: /llvm-project/clang/test/CodeGen/AArch64/neon-range-checks.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -target-feature +sha3 -target-feature +sm4 -verify %s
2 
3 // REQUIRES: aarch64-registered-target || arm-registered-target
4 
5 #include <arm_neon.h>
6 
7 void test_range_check_vsm3tt1a(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
8   vsm3tt1aq_u32(a, b, c, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
9   vsm3tt1aq_u32(a, b, c, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
10   vsm3tt1aq_u32(a, b, c, 3);
11   vsm3tt1aq_u32(a, b, c, 0);
12 }
13 
14 void test_range_check_vsm3tt1b(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
15   vsm3tt1bq_u32(a, b, c, 4);// expected-error {{argument value 4 is outside the valid range [0, 3]}}
16   vsm3tt1bq_u32(a, b, c, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
17   vsm3tt1bq_u32(a, b, c, 3);
18   vsm3tt1bq_u32(a, b, c, 0);
19 }
20 
21 void test_range_check_vsm3tt2a(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
22   vsm3tt2aq_u32(a, b, c, 4);// expected-error {{argument value 4 is outside the valid range [0, 3]}}
23   vsm3tt2aq_u32(a, b, c, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
24   vsm3tt2aq_u32(a, b, c, 3);
25   vsm3tt2aq_u32(a, b, c, 0);
26 }
27 
28 void test_range_check_vsm3tt2b(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
29   vsm3tt2bq_u32(a, b, c, 4);// expected-error {{argument value 4 is outside the valid range [0, 3]}}
30   vsm3tt2bq_u32(a, b, c, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
31   vsm3tt2bq_u32(a, b, c, 3);
32   vsm3tt2bq_u32(a, b, c, 0);
33 }
34 
35 void test_range_check_xar(uint64x2_t a, uint64x2_t b) {
36   vxarq_u64(a, b, -1); // expected-error {{argument value -1 is outside the valid range [0, 63]}}
37   vxarq_u64(a, b, 64); // expected-error {{argument value 64 is outside the valid range [0, 63]}}
38   vxarq_u64(a, b, 0);
39   vxarq_u64(a, b, 63);
40 }
41 
42