[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / arm-mve-intrinsics / get-set-lane.c
blob201352431f3a75aeb35ab1429b59adebf97bffc8
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes='mem2reg,sroa,early-cse<>' | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -DPOLYMORPHIC -emit-llvm -o - %s | opt -S -passes='mem2reg,sroa,early-cse<>' | FileCheck %s
5 // REQUIRES: aarch64-registered-target || arm-registered-target
7 #include <arm_mve.h>
9 // CHECK-LABEL: @test_vgetq_lane_f16(
10 // CHECK-NEXT: entry:
11 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x half> [[A:%.*]], i32 2
12 // CHECK-NEXT: ret half [[TMP0]]
14 float16_t test_vgetq_lane_f16(float16x8_t a)
16 #ifdef POLYMORPHIC
17 return vgetq_lane(a, 2);
18 #else /* POLYMORPHIC */
19 return vgetq_lane_f16(a, 2);
20 #endif /* POLYMORPHIC */
23 // CHECK-LABEL: @test_vgetq_lane_f32(
24 // CHECK-NEXT: entry:
25 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 3
26 // CHECK-NEXT: ret float [[TMP0]]
28 float32_t test_vgetq_lane_f32(float32x4_t a)
30 #ifdef POLYMORPHIC
31 return vgetq_lane(a, 3);
32 #else /* POLYMORPHIC */
33 return vgetq_lane_f32(a, 3);
34 #endif /* POLYMORPHIC */
37 // CHECK-LABEL: @test_vgetq_lane_s16(
38 // CHECK-NEXT: entry:
39 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i16> [[A:%.*]], i32 4
40 // CHECK-NEXT: ret i16 [[TMP0]]
42 int16_t test_vgetq_lane_s16(int16x8_t a)
44 #ifdef POLYMORPHIC
45 return vgetq_lane(a, 4);
46 #else /* POLYMORPHIC */
47 return vgetq_lane_s16(a, 4);
48 #endif /* POLYMORPHIC */
51 // CHECK-LABEL: @test_vgetq_lane_s32(
52 // CHECK-NEXT: entry:
53 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 0
54 // CHECK-NEXT: ret i32 [[TMP0]]
56 int32_t test_vgetq_lane_s32(int32x4_t a)
58 #ifdef POLYMORPHIC
59 return vgetq_lane(a, 0);
60 #else /* POLYMORPHIC */
61 return vgetq_lane_s32(a, 0);
62 #endif /* POLYMORPHIC */
65 // CHECK-LABEL: @test_vgetq_lane_s64(
66 // CHECK-NEXT: entry:
67 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i64> [[A:%.*]], i32 0
68 // CHECK-NEXT: ret i64 [[TMP0]]
70 int64_t test_vgetq_lane_s64(int64x2_t a)
72 #ifdef POLYMORPHIC
73 return vgetq_lane(a, 0);
74 #else /* POLYMORPHIC */
75 return vgetq_lane_s64(a, 0);
76 #endif /* POLYMORPHIC */
79 // CHECK-LABEL: @test_vgetq_lane_s8(
80 // CHECK-NEXT: entry:
81 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <16 x i8> [[A:%.*]], i32 10
82 // CHECK-NEXT: ret i8 [[TMP0]]
84 int8_t test_vgetq_lane_s8(int8x16_t a)
86 #ifdef POLYMORPHIC
87 return vgetq_lane(a, 10);
88 #else /* POLYMORPHIC */
89 return vgetq_lane_s8(a, 10);
90 #endif /* POLYMORPHIC */
93 // CHECK-LABEL: @test_vgetq_lane_u16(
94 // CHECK-NEXT: entry:
95 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i16> [[A:%.*]], i32 3
96 // CHECK-NEXT: ret i16 [[TMP0]]
98 uint16_t test_vgetq_lane_u16(uint16x8_t a)
100 #ifdef POLYMORPHIC
101 return vgetq_lane(a, 3);
102 #else /* POLYMORPHIC */
103 return vgetq_lane_u16(a, 3);
104 #endif /* POLYMORPHIC */
107 // CHECK-LABEL: @test_vgetq_lane_u32(
108 // CHECK-NEXT: entry:
109 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 3
110 // CHECK-NEXT: ret i32 [[TMP0]]
112 uint32_t test_vgetq_lane_u32(uint32x4_t a)
114 #ifdef POLYMORPHIC
115 return vgetq_lane(a, 3);
116 #else /* POLYMORPHIC */
117 return vgetq_lane_u32(a, 3);
118 #endif /* POLYMORPHIC */
121 // CHECK-LABEL: @test_vgetq_lane_u64(
122 // CHECK-NEXT: entry:
123 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i64> [[A:%.*]], i32 1
124 // CHECK-NEXT: ret i64 [[TMP0]]
126 uint64_t test_vgetq_lane_u64(uint64x2_t a)
128 #ifdef POLYMORPHIC
129 return vgetq_lane(a, 1);
130 #else /* POLYMORPHIC */
131 return vgetq_lane_u64(a, 1);
132 #endif /* POLYMORPHIC */
135 // CHECK-LABEL: @test_vgetq_lane_u8(
136 // CHECK-NEXT: entry:
137 // CHECK-NEXT: [[TMP0:%.*]] = extractelement <16 x i8> [[A:%.*]], i32 1
138 // CHECK-NEXT: ret i8 [[TMP0]]
140 uint8_t test_vgetq_lane_u8(uint8x16_t a)
142 #ifdef POLYMORPHIC
143 return vgetq_lane(a, 1);
144 #else /* POLYMORPHIC */
145 return vgetq_lane_u8(a, 1);
146 #endif /* POLYMORPHIC */
149 // CHECK-LABEL: @test_vsetq_lane_f16(
150 // CHECK-NEXT: entry:
151 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x half> [[B:%.*]], half [[A:%.*]], i32 4
152 // CHECK-NEXT: ret <8 x half> [[TMP0]]
154 float16x8_t test_vsetq_lane_f16(float16_t a, float16x8_t b)
156 #ifdef POLYMORPHIC
157 return vsetq_lane(a, b, 4);
158 #else /* POLYMORPHIC */
159 return vsetq_lane_f16(a, b, 4);
160 #endif /* POLYMORPHIC */
163 // CHECK-LABEL: @test_vsetq_lane_f32(
164 // CHECK-NEXT: entry:
165 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x float> [[B:%.*]], float [[A:%.*]], i32 2
166 // CHECK-NEXT: ret <4 x float> [[TMP0]]
168 float32x4_t test_vsetq_lane_f32(float32_t a, float32x4_t b)
170 #ifdef POLYMORPHIC
171 return vsetq_lane(a, b, 2);
172 #else /* POLYMORPHIC */
173 return vsetq_lane_f32(a, b, 2);
174 #endif /* POLYMORPHIC */
177 // CHECK-LABEL: @test_vsetq_lane_s8(
178 // CHECK-NEXT: entry:
179 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <16 x i8> [[B:%.*]], i8 [[A:%.*]], i32 12
180 // CHECK-NEXT: ret <16 x i8> [[TMP0]]
182 int8x16_t test_vsetq_lane_s8(int8_t a, int8x16_t b)
184 #ifdef POLYMORPHIC
185 return vsetq_lane(a, b, 12);
186 #else /* POLYMORPHIC */
187 return vsetq_lane_s8(a, b, 12);
188 #endif /* POLYMORPHIC */
191 // CHECK-LABEL: @test_vsetq_lane_s16(
192 // CHECK-NEXT: entry:
193 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i16> [[B:%.*]], i16 [[A:%.*]], i32 6
194 // CHECK-NEXT: ret <8 x i16> [[TMP0]]
196 int16x8_t test_vsetq_lane_s16(int16_t a, int16x8_t b)
198 #ifdef POLYMORPHIC
199 return vsetq_lane(a, b, 6);
200 #else /* POLYMORPHIC */
201 return vsetq_lane_s16(a, b, 6);
202 #endif /* POLYMORPHIC */
205 // CHECK-LABEL: @test_vsetq_lane_s32(
206 // CHECK-NEXT: entry:
207 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> [[B:%.*]], i32 [[A:%.*]], i32 2
208 // CHECK-NEXT: ret <4 x i32> [[TMP0]]
210 int32x4_t test_vsetq_lane_s32(int32_t a, int32x4_t b)
212 #ifdef POLYMORPHIC
213 return vsetq_lane(a, b, 2);
214 #else /* POLYMORPHIC */
215 return vsetq_lane_s32(a, b, 2);
216 #endif /* POLYMORPHIC */
219 // CHECK-LABEL: @test_vsetq_lane_s64(
220 // CHECK-NEXT: entry:
221 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> [[B:%.*]], i64 [[A:%.*]], i32 0
222 // CHECK-NEXT: ret <2 x i64> [[TMP0]]
224 int64x2_t test_vsetq_lane_s64(int64_t a, int64x2_t b)
226 #ifdef POLYMORPHIC
227 return vsetq_lane(a, b, 0);
228 #else /* POLYMORPHIC */
229 return vsetq_lane_s64(a, b, 0);
230 #endif /* POLYMORPHIC */
233 // CHECK-LABEL: @test_vsetq_lane_u8(
234 // CHECK-NEXT: entry:
235 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <16 x i8> [[B:%.*]], i8 [[A:%.*]], i32 2
236 // CHECK-NEXT: ret <16 x i8> [[TMP0]]
238 uint8x16_t test_vsetq_lane_u8(uint8_t a, uint8x16_t b)
240 #ifdef POLYMORPHIC
241 return vsetq_lane(a, b, 2);
242 #else /* POLYMORPHIC */
243 return vsetq_lane_u8(a, b, 2);
244 #endif /* POLYMORPHIC */
247 // CHECK-LABEL: @test_vsetq_lane_u16(
248 // CHECK-NEXT: entry:
249 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i16> [[B:%.*]], i16 [[A:%.*]], i32 7
250 // CHECK-NEXT: ret <8 x i16> [[TMP0]]
252 uint16x8_t test_vsetq_lane_u16(uint16_t a, uint16x8_t b)
254 #ifdef POLYMORPHIC
255 return vsetq_lane(a, b, 7);
256 #else /* POLYMORPHIC */
257 return vsetq_lane_u16(a, b, 7);
258 #endif /* POLYMORPHIC */
261 // CHECK-LABEL: @test_vsetq_lane_u32(
262 // CHECK-NEXT: entry:
263 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> [[B:%.*]], i32 [[A:%.*]], i32 0
264 // CHECK-NEXT: ret <4 x i32> [[TMP0]]
266 uint32x4_t test_vsetq_lane_u32(uint32_t a, uint32x4_t b)
268 #ifdef POLYMORPHIC
269 return vsetq_lane(a, b, 0);
270 #else /* POLYMORPHIC */
271 return vsetq_lane_u32(a, b, 0);
272 #endif /* POLYMORPHIC */
275 // CHECK-LABEL: @test_vsetq_lane_u64(
276 // CHECK-NEXT: entry:
277 // CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> [[B:%.*]], i64 [[A:%.*]], i32 1
278 // CHECK-NEXT: ret <2 x i64> [[TMP0]]
280 uint64x2_t test_vsetq_lane_u64(uint64_t a, uint64x2_t b)
282 #ifdef POLYMORPHIC
283 return vsetq_lane(a, b, 1);
284 #else /* POLYMORPHIC */
285 return vsetq_lane_u64(a, b, 1);
286 #endif /* POLYMORPHIC */