1// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -ffreestanding -fsyntax-only -verify %s
2// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -ffreestanding -fsyntax-only -verify %s
3
4#include <arm_neon.h>
5
6void test_vext_8bit(int8x8_t small, int8x16_t big) {
7  vext_s8(small, small, 7);
8  vext_u8(small, small, 7);
9  vext_p8(small, small, 7);
10  vextq_s8(big, big, 15);
11  vextq_u8(big, big, 15);
12  vextq_p8(big, big, 15);
13
14  vext_s8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
15  vext_u8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
16  vext_p8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
17  vextq_s8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
18  vextq_u8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
19  vextq_p8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
20}
21
22void test_mul_lane_f64(float64x1_t small, float64x2_t big, float64x2_t rhs) {
23  vmul_lane_f64(small, small, 0);
24  vmul_laneq_f64(small, big, 1);
25  vmulq_lane_f64(big, small, 0);
26  vmulq_laneq_f64(big, big, 1);
27  vfma_lane_f64(small, small, small, 0);
28  vfma_laneq_f64(small, small, big, 1);
29  vfmaq_lane_f64(big, big, small, 0);
30  vfmaq_laneq_f64(big, big, big, 1);
31
32  vmul_lane_f64(small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
33  vmul_laneq_f64(small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
34  vfma_lane_f64(small, small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
35  vfma_laneq_f64(small, small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
36  vfmaq_laneq_f64(big, big, big, 2); // expected-error {{argument should be a value from 0 to 1}}
37}
38
39void test_ld1st1(int8x8_t small, int8x16_t big, void *addr) {
40  vld1_lane_s8(addr, small, 7);
41  vld1_lane_s16(addr, small, 3);
42  vld1_lane_s32(addr, small, 1);
43  vld1_lane_s64(addr, small, 0);
44
45  vld1q_lane_s8(addr, big, 15);
46  vld1q_lane_s16(addr, big, 7);
47  vld1q_lane_s32(addr, big, 3);
48  vld1q_lane_s64(addr, big, 1);
49
50  vld1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
51  vld1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
52  vld1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
53  vld1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}
54
55  vld1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
56  vld1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
57  vld1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
58  vld1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}
59
60  vst1_lane_s8(addr, small, 7);
61  vst1_lane_s16(addr, small, 3);
62  vst1_lane_s32(addr, small, 1);
63  vst1_lane_s64(addr, small, 0);
64
65  vst1q_lane_s8(addr, big, 15);
66  vst1q_lane_s16(addr, big, 7);
67  vst1q_lane_s32(addr, big, 3);
68  vst1q_lane_s64(addr, big, 1);
69
70  vst1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
71  vst1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
72  vst1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
73  vst1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}
74
75  vst1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
76  vst1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
77  vst1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
78  vst1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}
79}
80
81void test_ld2st2(int8x8x2_t small8, int8x16x2_t big8,
82                 int16x4x2_t small16, int16x8x2_t big16,
83                 int32x2x2_t small32, int32x4x2_t big32,
84                 int64x1x2_t small64, int64x2x2_t big64,
85                 void *addr) {
86  vld2_lane_s8(addr, small8, 7);
87  vld2_lane_s16(addr, small16, 3);
88  vld2_lane_s32(addr, small32, 1);
89  vld2_lane_s64(addr, small64, 0);
90
91  vld2q_lane_s8(addr, big8, 15);
92  vld2q_lane_s16(addr, big16, 7);
93  vld2q_lane_s32(addr, big32, 3);
94  vld2q_lane_s64(addr, big64, 1);
95
96  vld2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
97  vld2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
98  vld2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
99  vld2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
100
101  vld2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
102  vld2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
103  vld2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
104  vld2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
105
106  vst2_lane_s8(addr, small8, 7);
107  vst2_lane_s16(addr, small16, 3);
108  vst2_lane_s32(addr, small32, 1);
109  vst2_lane_s64(addr, small64, 0);
110
111  vst2q_lane_s8(addr, big8, 15);
112  vst2q_lane_s16(addr, big16, 7);
113  vst2q_lane_s32(addr, big32, 3);
114  vst2q_lane_s64(addr, big64, 1);
115
116  vst2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
117  vst2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
118  vst2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
119  vst2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
120
121  vst2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
122  vst2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
123  vst2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
124  vst2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
125}
126
127void test_ld3st3(int8x8x3_t small8, int8x16x3_t big8,
128                 int16x4x3_t small16, int16x8x3_t big16,
129                 int32x2x3_t small32, int32x4x3_t big32,
130                 int64x1x3_t small64, int64x2x3_t big64,
131                 void *addr) {
132  vld3_lane_s8(addr, small8, 7);
133  vld3_lane_s16(addr, small16, 3);
134  vld3_lane_s32(addr, small32, 1);
135  vld3_lane_s64(addr, small64, 0);
136
137  vld3q_lane_s8(addr, big8, 15);
138  vld3q_lane_s16(addr, big16, 7);
139  vld3q_lane_s32(addr, big32, 3);
140  vld3q_lane_s64(addr, big64, 1);
141
142  vld3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
143  vld3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
144  vld3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
145  vld3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
146
147  vld3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
148  vld3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
149  vld3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
150  vld3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
151
152  vst3_lane_s8(addr, small8, 7);
153  vst3_lane_s16(addr, small16, 3);
154  vst3_lane_s32(addr, small32, 1);
155  vst3_lane_s64(addr, small64, 0);
156
157  vst3q_lane_s8(addr, big8, 15);
158  vst3q_lane_s16(addr, big16, 7);
159  vst3q_lane_s32(addr, big32, 3);
160  vst3q_lane_s64(addr, big64, 1);
161
162  vst3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
163  vst3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
164  vst3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
165  vst3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
166
167  vst3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
168  vst3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
169  vst3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
170  vst3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
171}
172
173void test_ld4st4(int8x8x4_t small8, int8x16x4_t big8,
174                 int16x4x4_t small16, int16x8x4_t big16,
175                 int32x2x4_t small32, int32x4x4_t big32,
176                 int64x1x4_t small64, int64x2x4_t big64,
177                 void *addr) {
178  vld4_lane_s8(addr, small8, 7);
179  vld4_lane_s16(addr, small16, 3);
180  vld4_lane_s32(addr, small32, 1);
181  vld4_lane_s64(addr, small64, 0);
182
183  vld4q_lane_s8(addr, big8, 15);
184  vld4q_lane_s16(addr, big16, 7);
185  vld4q_lane_s32(addr, big32, 3);
186  vld4q_lane_s64(addr, big64, 1);
187
188  vld4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
189  vld4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
190  vld4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
191  vld4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
192
193  vld4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
194  vld4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
195  vld4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
196  vld4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
197
198  vst4_lane_s8(addr, small8, 7);
199  vst4_lane_s16(addr, small16, 3);
200  vst4_lane_s32(addr, small32, 1);
201  vst4_lane_s64(addr, small64, 0);
202
203  vst4q_lane_s8(addr, big8, 15);
204  vst4q_lane_s16(addr, big16, 7);
205  vst4q_lane_s32(addr, big32, 3);
206  vst4q_lane_s64(addr, big64, 1);
207
208  vst4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
209  vst4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
210  vst4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
211  vst4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
212
213  vst4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
214  vst4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
215  vst4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
216  vst4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
217}
218
219