summaryrefslogtreecommitdiffstats
path: root/test/Sema/aarch64-neon-ranges.c
blob: 3a170b8f4cb9861e7a31833e9b497f90b8f63032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -ffreestanding -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -ffreestanding -fsyntax-only -verify %s

#include <arm_neon.h>

void test_vext_8bit(int8x8_t small, int8x16_t big) {
  vext_s8(small, small, 7);
  vext_u8(small, small, 7);
  vext_p8(small, small, 7);
  vextq_s8(big, big, 15);
  vextq_u8(big, big, 15);
  vextq_p8(big, big, 15);

  vext_s8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
  vext_u8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
  vext_p8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
  vextq_s8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
  vextq_u8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
  vextq_p8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
}

void test_mul_lane_f64(float64x1_t small, float64x2_t big, float64x2_t rhs) {
  vmul_lane_f64(small, small, 0);
  vmul_laneq_f64(small, big, 1);
  vmulq_lane_f64(big, small, 0);
  vmulq_laneq_f64(big, big, 1);
  vfma_lane_f64(small, small, small, 0);
  vfma_laneq_f64(small, small, big, 1);
  vfmaq_lane_f64(big, big, small, 0);
  vfmaq_laneq_f64(big, big, big, 1);

  vmul_lane_f64(small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
  vmul_laneq_f64(small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
  vfma_lane_f64(small, small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
  vfma_laneq_f64(small, small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
  vfmaq_laneq_f64(big, big, big, 2); // expected-error {{argument should be a value from 0 to 1}}
}

void test_ld1st1(int8x8_t small, int8x16_t big, void *addr) {
  vld1_lane_s8(addr, small, 7);
  vld1_lane_s16(addr, small, 3);
  vld1_lane_s32(addr, small, 1);
  vld1_lane_s64(addr, small, 0);

  vld1q_lane_s8(addr, big, 15);
  vld1q_lane_s16(addr, big, 7);
  vld1q_lane_s32(addr, big, 3);
  vld1q_lane_s64(addr, big, 1);

  vld1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
  vld1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}

  vld1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
  vld1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}

  vst1_lane_s8(addr, small, 7);
  vst1_lane_s16(addr, small, 3);
  vst1_lane_s32(addr, small, 1);
  vst1_lane_s64(addr, small, 0);

  vst1q_lane_s8(addr, big, 15);
  vst1q_lane_s16(addr, big, 7);
  vst1q_lane_s32(addr, big, 3);
  vst1q_lane_s64(addr, big, 1);

  vst1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
  vst1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}

  vst1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
  vst1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}
}

void test_ld2st2(int8x8x2_t small8, int8x16x2_t big8,
                 int16x4x2_t small16, int16x8x2_t big16,
                 int32x2x2_t small32, int32x4x2_t big32,
                 int64x1x2_t small64, int64x2x2_t big64,
                 void *addr) {
  vld2_lane_s8(addr, small8, 7);
  vld2_lane_s16(addr, small16, 3);
  vld2_lane_s32(addr, small32, 1);
  vld2_lane_s64(addr, small64, 0);

  vld2q_lane_s8(addr, big8, 15);
  vld2q_lane_s16(addr, big16, 7);
  vld2q_lane_s32(addr, big32, 3);
  vld2q_lane_s64(addr, big64, 1);

  vld2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vld2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vld2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vld2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}

  vst2_lane_s8(addr, small8, 7);
  vst2_lane_s16(addr, small16, 3);
  vst2_lane_s32(addr, small32, 1);
  vst2_lane_s64(addr, small64, 0);

  vst2q_lane_s8(addr, big8, 15);
  vst2q_lane_s16(addr, big16, 7);
  vst2q_lane_s32(addr, big32, 3);
  vst2q_lane_s64(addr, big64, 1);

  vst2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vst2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vst2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vst2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
}

void test_ld3st3(int8x8x3_t small8, int8x16x3_t big8,
                 int16x4x3_t small16, int16x8x3_t big16,
                 int32x2x3_t small32, int32x4x3_t big32,
                 int64x1x3_t small64, int64x2x3_t big64,
                 void *addr) {
  vld3_lane_s8(addr, small8, 7);
  vld3_lane_s16(addr, small16, 3);
  vld3_lane_s32(addr, small32, 1);
  vld3_lane_s64(addr, small64, 0);

  vld3q_lane_s8(addr, big8, 15);
  vld3q_lane_s16(addr, big16, 7);
  vld3q_lane_s32(addr, big32, 3);
  vld3q_lane_s64(addr, big64, 1);

  vld3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vld3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vld3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vld3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}

  vst3_lane_s8(addr, small8, 7);
  vst3_lane_s16(addr, small16, 3);
  vst3_lane_s32(addr, small32, 1);
  vst3_lane_s64(addr, small64, 0);

  vst3q_lane_s8(addr, big8, 15);
  vst3q_lane_s16(addr, big16, 7);
  vst3q_lane_s32(addr, big32, 3);
  vst3q_lane_s64(addr, big64, 1);

  vst3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vst3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vst3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vst3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
}

void test_ld4st4(int8x8x4_t small8, int8x16x4_t big8,
                 int16x4x4_t small16, int16x8x4_t big16,
                 int32x2x4_t small32, int32x4x4_t big32,
                 int64x1x4_t small64, int64x2x4_t big64,
                 void *addr) {
  vld4_lane_s8(addr, small8, 7);
  vld4_lane_s16(addr, small16, 3);
  vld4_lane_s32(addr, small32, 1);
  vld4_lane_s64(addr, small64, 0);

  vld4q_lane_s8(addr, big8, 15);
  vld4q_lane_s16(addr, big16, 7);
  vld4q_lane_s32(addr, big32, 3);
  vld4q_lane_s64(addr, big64, 1);

  vld4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vld4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vld4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vld4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vld4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vld4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}

  vst4_lane_s8(addr, small8, 7);
  vst4_lane_s16(addr, small16, 3);
  vst4_lane_s32(addr, small32, 1);
  vst4_lane_s64(addr, small64, 0);

  vst4q_lane_s8(addr, big8, 15);
  vst4q_lane_s16(addr, big16, 7);
  vst4q_lane_s32(addr, big32, 3);
  vst4q_lane_s64(addr, big64, 1);

  vst4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
  vst4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}

  vst4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
  vst4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
  vst4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
  vst4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
}