xref: /llvm-project/clang/test/Sema/aarch64-sve-intrinsics/acle_sve_imm_n.cpp (revision 123064dc397d478a636ba1c5960d41ad381036a0)
1 // REQUIRES: aarch64-registered-target
2 
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify %s
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify %s
5 
6 #ifdef SVE_OVERLOADED_FORMS
7 // A simple used,unused... macro, long enough to represent any SVE builtin.
8 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
9 #else
10 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
11 #endif
12 
13 #include <arm_sve.h>
14 
test_range_1_8(svbool_t pg)15 void test_range_1_8(svbool_t pg)
16 {
17   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 8]}}
18   SVE_ACLE_FUNC(svasrd,_n_s8,_x,)(pg, svundef_s8(), 0);
19   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 8]}}
20   SVE_ACLE_FUNC(svasrd,_n_s8,_z,)(pg, svundef_s8(), 9);
21   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 8]}}
22   SVE_ACLE_FUNC(svasrd,_n_s8,_m,)(pg, svundef_s8(), 0);
23 }
24 
test_range_1_16(svbool_t pg,int32_t i32,uint32_t u32,int64_t i64,uint64_t u64)25 void test_range_1_16(svbool_t pg, int32_t i32, uint32_t u32, int64_t i64, uint64_t u64)
26 {
27   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
28   SVE_ACLE_FUNC(svasrd,_n_s16,_x,)(pg, svundef_s16(), 0);
29   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
30   SVE_ACLE_FUNC(svasrd,_n_s16,_z,)(pg, svundef_s16(), 17);
31   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
32   SVE_ACLE_FUNC(svasrd,_n_s16,_m,)(pg, svundef_s16(), 0);
33   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
34   SVE_ACLE_FUNC(svqdecb,_n_s32,,)(i32, 17);
35   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
36   SVE_ACLE_FUNC(svqdecb_pat,_n_s32,,)(i32, SV_POW2, 0);
37   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
38   SVE_ACLE_FUNC(svqdecb,_n_u32,,)(u32, 17);
39   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
40   SVE_ACLE_FUNC(svqdecb_pat,_n_u32,,)(u32, SV_VL4, 0);
41   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
42   SVE_ACLE_FUNC(svqdecb,_n_s64,,)(i64, 17);
43   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
44   SVE_ACLE_FUNC(svqdecb_pat,_n_s64,,)(i64, SV_VL2, 0);
45   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
46   SVE_ACLE_FUNC(svqdecb,_n_u64,,)(u64, 17);
47   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
48   SVE_ACLE_FUNC(svqdecb_pat,_n_u64,,)(u64, SV_VL6, 0);
49   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
50   SVE_ACLE_FUNC(svqdecd,_n_s32,,)(i32, 17);
51   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
52   SVE_ACLE_FUNC(svqdecd_pat,_n_s32,,)(i32, SV_POW2, 0);
53   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
54   SVE_ACLE_FUNC(svqdecd,_n_u32,,)(u32, 17);
55   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
56   SVE_ACLE_FUNC(svqdecd_pat,_n_u32,,)(u32, SV_VL4, 0);
57   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
58   SVE_ACLE_FUNC(svqdecd,_n_s64,,)(i64, 17);
59   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
60   SVE_ACLE_FUNC(svqdecd_pat,_n_s64,,)(i64, SV_VL2, 0);
61   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
62   SVE_ACLE_FUNC(svqdecd,_n_u64,,)(u64, 17);
63   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
64   SVE_ACLE_FUNC(svqdecd_pat,_n_u64,,)(u64, SV_VL6, 0);
65   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
66   SVE_ACLE_FUNC(svqdech,_n_s32,,)(i32, 17);
67   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
68   SVE_ACLE_FUNC(svqdech_pat,_n_s32,,)(i32, SV_POW2, 0);
69   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
70   SVE_ACLE_FUNC(svqdech,_n_u32,,)(u32, 17);
71   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
72   SVE_ACLE_FUNC(svqdech_pat,_n_u32,,)(u32, SV_VL4, 0);
73   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
74   SVE_ACLE_FUNC(svqdech,_n_s64,,)(i64, 17);
75   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
76   SVE_ACLE_FUNC(svqdech_pat,_n_s64,,)(i64, SV_VL2, 0);
77   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
78   SVE_ACLE_FUNC(svqdech,_n_u64,,)(u64, 17);
79   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
80   SVE_ACLE_FUNC(svqdech_pat,_n_u64,,)(u64, SV_VL6, 0);
81   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
82   SVE_ACLE_FUNC(svqdecw,_n_s32,,)(i32, 17);
83   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
84   SVE_ACLE_FUNC(svqdecw_pat,_n_s32,,)(i32, SV_POW2, 0);
85   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
86   SVE_ACLE_FUNC(svqdecw,_n_u32,,)(u32, 17);
87   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
88   SVE_ACLE_FUNC(svqdecw_pat,_n_u32,,)(u32, SV_VL4, 0);
89   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
90   SVE_ACLE_FUNC(svqdecw,_n_s64,,)(i64, 17);
91   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
92   SVE_ACLE_FUNC(svqdecw_pat,_n_s64,,)(i64, SV_VL2, 0);
93   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
94   SVE_ACLE_FUNC(svqdecw,_n_u64,,)(u64, 17);
95   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
96   SVE_ACLE_FUNC(svqdecw_pat,_n_u64,,)(u64, SV_VL6, 0);
97   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
98   SVE_ACLE_FUNC(svqincb,_n_s32,,)(i32, 17);
99   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
100   SVE_ACLE_FUNC(svqincb_pat,_n_s32,,)(i32, SV_POW2, 0);
101   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
102   SVE_ACLE_FUNC(svqincb,_n_u32,,)(u32, 17);
103   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
104   SVE_ACLE_FUNC(svqincb_pat,_n_u32,,)(u32, SV_VL4, 0);
105   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
106   SVE_ACLE_FUNC(svqincb,_n_s64,,)(i64, 17);
107   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
108   SVE_ACLE_FUNC(svqincb_pat,_n_s64,,)(i64, SV_VL2, 0);
109   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
110   SVE_ACLE_FUNC(svqincb,_n_u64,,)(i64, 17);
111   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
112   SVE_ACLE_FUNC(svqincb_pat,_n_u64,,)(u64, SV_VL6, 0);
113   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
114   SVE_ACLE_FUNC(svqincd,_n_s32,,)(i32, 17);
115   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
116   SVE_ACLE_FUNC(svqincd_pat,_n_s32,,)(i32, SV_POW2, 0);
117   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
118   SVE_ACLE_FUNC(svqincd,_n_u32,,)(u32, 17);
119   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
120   SVE_ACLE_FUNC(svqincd_pat,_n_u32,,)(u32, SV_VL4, 0);
121   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
122   SVE_ACLE_FUNC(svqincd,_n_s64,,)(i64, 17);
123   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
124   SVE_ACLE_FUNC(svqincd_pat,_n_s64,,)(i64, SV_VL2, 0);
125   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
126   SVE_ACLE_FUNC(svqincd,_n_u64,,)(u64, 17);
127   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
128   SVE_ACLE_FUNC(svqincd_pat,_n_u64,,)(u64, SV_VL6, 0);
129   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
130   SVE_ACLE_FUNC(svqinch,_n_s32,,)(i32, 17);
131   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
132   SVE_ACLE_FUNC(svqinch_pat,_n_s32,,)(i32, SV_POW2, 0);
133   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
134   SVE_ACLE_FUNC(svqinch,_n_u32,,)(u32, 17);
135   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
136   SVE_ACLE_FUNC(svqinch_pat,_n_u32,,)(u32, SV_VL4, 0);
137   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
138   SVE_ACLE_FUNC(svqinch,_n_s64,,)(i64, 17);
139   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
140   SVE_ACLE_FUNC(svqinch_pat,_n_s64,,)(i64, SV_VL2, 0);
141   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
142   SVE_ACLE_FUNC(svqinch,_n_u64,,)(u64, 17);
143   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
144   SVE_ACLE_FUNC(svqinch_pat,_n_u64,,)(u64, SV_VL6, 0);
145   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
146   SVE_ACLE_FUNC(svqincw,_n_s32,,)(i32, 17);
147   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
148   SVE_ACLE_FUNC(svqincw_pat,_n_s32,,)(i32, SV_POW2, 0);
149   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
150   SVE_ACLE_FUNC(svqincw,_n_u32,,)(u32, 17);
151   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
152   SVE_ACLE_FUNC(svqincw_pat,_n_u32,,)(u32, SV_VL4, 0);
153   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
154   SVE_ACLE_FUNC(svqincw,_n_s64,,)(i64, 17);
155   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
156   SVE_ACLE_FUNC(svqincw_pat,_n_s64,,)(i64, SV_VL2, 0);
157   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
158   SVE_ACLE_FUNC(svqincw,_n_u64,,)(u64, 17);
159   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 16]}}
160   SVE_ACLE_FUNC(svqincw_pat,_n_u64,,)(u64, SV_VL6, 0);
161 }
162 
test_range_1_32(svbool_t pg)163 void test_range_1_32(svbool_t pg)
164 {
165   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 32]}}
166   SVE_ACLE_FUNC(svasrd,_n_s32,_x,)(pg, svundef_s32(), 0);
167   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 32]}}
168   SVE_ACLE_FUNC(svasrd,_n_s32,_z,)(pg, svundef_s32(), 33);
169   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 32]}}
170   SVE_ACLE_FUNC(svasrd,_n_s32,_m,)(pg, svundef_s32(), 0);
171 }
172 
test_range_1_64(svbool_t pg)173 void test_range_1_64(svbool_t pg)
174 {
175   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 64]}}
176   SVE_ACLE_FUNC(svasrd,_n_s64,_x,)(pg, svundef_s64(), 0);
177   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 64]}}
178   SVE_ACLE_FUNC(svasrd,_n_s64,_z,)(pg, svundef_s64(), 65);
179   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [1, 64]}}
180   SVE_ACLE_FUNC(svasrd,_n_s64,_m,)(pg, svundef_s64(), 0);
181 }
182