Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / PowerPC / ppc-mmintrin.c
blob1dc6292ae3244c3829755c7241bd7cee240c9661
1 // REQUIRES: powerpc-registered-target
3 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
4 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-BE
5 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
6 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-LE
7 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
8 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-BE
9 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
10 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n| FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-LE
12 // RUN: %clang -x c++ -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
13 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -fsyntax-only
14 // RUN: %clang -x c++ -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
15 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -fsyntax-only
17 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
18 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-BE
19 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
20 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-LE
21 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
22 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-BE
23 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
24 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n| FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-LE
26 // RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
27 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-BE
28 // RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
29 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-BE
31 #include <mmintrin.h>
33 unsigned long long int ull1, ull2;
34 int i1, i2;
35 short s[4];
36 signed char c[8];
37 long long int ll1;
38 __m64 m1, m2, res;
40 void __attribute__((noinline))
41 test_add() {
42 res = _mm_add_pi32(m1, m2);
43 res = _mm_add_pi16(m1, m2);
44 res = _mm_add_pi8(m1, m2);
45 res = _mm_adds_pu16(m1, m2);
46 res = _mm_adds_pu8(m1, m2);
47 res = _mm_adds_pi16(m1, m2);
48 res = _mm_adds_pi8(m1, m2);
51 // CHECK-LABEL: @test_add
53 // CHECK-LABEL: define available_externally i64 @_mm_add_pi32
54 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
55 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
56 // CHECK-P9: call <4 x i32> @vec_add(int vector[4], int vector[4])
57 // CHECK-P8: add nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
58 // CHECK-P8: add nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
60 // CHECK-LABEL: define available_externally i64 @_mm_add_pi16
61 // CHECK: call <2 x i64> @vec_splats
62 // CHECK: call <2 x i64> @vec_splats
63 // CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])
65 // CHECK-LABEL: define available_externally i64 @_mm_add_pi8
66 // CHECK: call <2 x i64> @vec_splats
67 // CHECK: call <2 x i64> @vec_splats
68 // CHECK: call <16 x i8> @vec_add(signed char vector[16], signed char vector[16])
70 // CHECK-LABEL: define available_externally i64 @_mm_adds_pu16
71 // CHECK: call <2 x i64> @vec_splats
72 // CHECK: call <2 x i64> @vec_splats
73 // CHECK: call <8 x i16> @vec_adds(unsigned short vector[8], unsigned short vector[8])
75 // CHECK-LABEL: define available_externally i64 @_mm_adds_pu8
76 // CHECK: call <2 x i64> @vec_splats
77 // CHECK: call <2 x i64> @vec_splats
78 // CHECK: call <16 x i8> @vec_adds(unsigned char vector[16], unsigned char vector[16])
80 // CHECK-LABEL: define available_externally i64 @_mm_adds_pi16
81 // CHECK: call <2 x i64> @vec_splats
82 // CHECK: call <2 x i64> @vec_splats
83 // CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])
85 // CHECK-LABEL: define available_externally i64 @_mm_adds_pi8
86 // CHECK: call <2 x i64> @vec_splats
87 // CHECK: call <2 x i64> @vec_splats
88 // CHECK: call <16 x i8> @vec_adds(signed char vector[16], signed char vector[16])
90 void __attribute__((noinline))
91 test_alt_name_add() {
92 res = _m_paddb(m1, m2);
93 res = _m_paddd(m1, m2);
94 res = _m_paddsb(m1, m2);
95 res = _m_paddsw(m1, m2);
96 res = _m_paddusb(m1, m2);
97 res = _m_paddusw(m1, m2);
98 res = _m_paddw(m1, m2);
101 // CHECK-LABEL: @test_alt_name_add
103 // CHECK-LABEL: define available_externally i64 @_m_paddb
104 // CHECK: call i64 @_mm_add_pi8
106 // CHECK-LABEL: define available_externally i64 @_m_paddd
107 // CHECK: call i64 @_mm_add_pi32
109 // CHECK-LABEL: define available_externally i64 @_m_paddsb
110 // CHECK: call i64 @_mm_adds_pi8
112 // CHECK-LABEL: define available_externally i64 @_m_paddsw
113 // CHECK: call i64 @_mm_adds_pi16
115 // CHECK-LABEL: define available_externally i64 @_m_paddusb
116 // CHECK: call i64 @_mm_adds_pu8
118 // CHECK-LABEL: define available_externally i64 @_m_paddusw
119 // CHECK: call i64 @_mm_adds_pu16
121 // CHECK-LABEL: define available_externally i64 @_m_paddw
122 // CHECK: call i64 @_mm_add_pi16
124 void __attribute__((noinline))
125 test_cmp() {
126 res = _mm_cmpeq_pi32(m1, m2);
127 res = _mm_cmpeq_pi16(m1, m2);
128 res = _mm_cmpeq_pi8(m1, m2);
129 res = _mm_cmpgt_pi32(m1, m2);
130 res = _mm_cmpgt_pi16(m1, m2);
131 res = _mm_cmpgt_pi8(m1, m2);
134 // CHECK-LABEL: @test_cmp
136 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi32
137 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
138 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
139 // CHECK-P9: call <4 x i32> @vec_cmpeq(int vector[4], int vector[4])
140 // CHECK-P8: %[[CMP1:[0-9a-zA-Z_.]+]] = icmp eq i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
141 // CHECK-P8: select i1 %[[CMP1]], i32 -1, i32 0
142 // CHECK-P8: %[[CMP2:[0-9a-zA-Z_.]+]] = icmp eq i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
143 // CHECK-P8: select i1 %[[CMP2]], i32 -1, i32 0
145 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi16
146 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
147 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
148 // CHECK: call <8 x i16> @vec_cmpeq(short vector[8], short vector[8])
150 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi8
151 // CHECK: call i64 asm "cmpb $0,$1,$2;\0A", "=r,r,r"
153 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi32
154 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
155 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
156 // CHECK-P9: call <4 x i32> @vec_cmpgt(int vector[4], int vector[4])
157 // CHECK-P8: %[[CMP1:[0-9a-zA-Z_.]+]] = icmp sgt i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
158 // CHECK-P8: select i1 %[[CMP1]], i32 -1, i32 0
159 // CHECK-P8: [[CMP2:[0-9a-zA-Z_.]+]] = icmp sgt i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
160 // CHECK-P8: select i1 %[[CMP2]], i32 -1, i32 0
162 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi16
163 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
164 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
165 // CHECK: call <8 x i16> @vec_cmpgt(short vector[8], short vector[8])
167 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi8
168 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
169 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
170 // CHECK: call <16 x i8> @vec_cmpgt(signed char vector[16], signed char vector[16])
172 void __attribute__((noinline))
173 test_alt_name_cmp() {
174 res = _m_pcmpeqb(m1, m2);
175 res = _m_pcmpeqd(m1, m2);
176 res = _m_pcmpeqw(m1, m2);
177 res = _m_pcmpgtb(m1, m2);
178 res = _m_pcmpgtd(m1, m2);
179 res = _m_pcmpgtw(m1, m2);
182 // CHECK-LABEL: @test_alt_name_cmp
184 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqb
185 // CHECK: call i64 @_mm_cmpeq_pi8
187 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqd
188 // CHECK: call i64 @_mm_cmpeq_pi32
190 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqw
191 // CHECK: call i64 @_mm_cmpeq_pi16
193 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtb
194 // CHECK: call i64 @_mm_cmpgt_pi8
196 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtd
197 // CHECK: call i64 @_mm_cmpgt_pi32
199 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtw
200 // CHECK: call i64 @_mm_cmpgt_pi16
202 void __attribute__((noinline))
203 test_convert() {
204 ll1 = _mm_cvtm64_si64(m1);
205 m1 = _mm_cvtsi32_si64(i1);
206 m1 = _mm_cvtsi64_m64(ll1);
207 i1 = _mm_cvtsi64_si32(m1);
210 // CHECK-LABEL: @test_convert
212 // CHECK-LABEL: define available_externally i64 @_mm_cvtm64_si64
213 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
214 // CHECK-NEXT: ret i64 %[[RESULT]]
216 // CHECK-LABEL: define available_externally i64 @_mm_cvtsi32_si64
217 // CHECK: %[[LOAD:[0-9a-zA-Z_.]+]] = load i32, ptr %{{[0-9a-zA-Z_.]+}}
218 // CHECK-NEXT: %[[RESULT:[0-9a-zA-Z_.]+]] = zext i32 %[[LOAD]] to i64
219 // CHECK-NEXT: ret i64 %[[RESULT]]
221 // CHECK-LABEL: define available_externally i64 @_mm_cvtsi64_m64
222 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
223 // CHECK-NEXT: ret i64 %[[RESULT]]
225 // CHECK-LABEL: define available_externally signext i32 @_mm_cvtsi64_si32
226 // CHECK: %[[LOAD:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
227 // CHECK-NEXT: %[[RESULT:[0-9a-zA-Z_.]+]] = trunc i64 %[[LOAD]] to i32
228 // CHECK-NEXT: ret i32 %[[RESULT]]
230 void __attribute__((noinline))
231 test_alt_name_convert() {
232 m1 = _m_from_int(i1);
233 m1 = _m_from_int64(ll1);
234 i1 = _m_to_int(m1);
235 ll1 = _m_to_int64(m1);
238 // CHECK-LABEL: @test_alt_name_convert
240 // CHECK-LABEL: define available_externally i64 @_m_from_int
241 // CHECK: call i64 @_mm_cvtsi32_si64
243 // CHECK-LABEL: define available_externally i64 @_m_from_int64
244 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}
245 // CHECK-NEXT: ret i64 %[[RESULT]]
247 // CHECK-LABEL: define available_externally signext i32 @_m_to_int
248 // CHECK: call signext i32 @_mm_cvtsi64_si32
250 // CHECK-LABEL: define available_externally i64 @_m_to_int64
251 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}
252 // CHECK-NEXT: ret i64 %[[RESULT]]
254 void __attribute__((noinline))
255 test_empty() {
256 _mm_empty();
257 _m_empty();
260 // CHECK-LABEL: @test_empty
262 // CHECK-LABEL: define available_externally void @_mm_empty
263 // CHECK-NEXT: entry
264 // CHECK-NEXT: ret void
266 // CHECK-LABEL: define available_externally void @_m_empty
267 // CHECK-NEXT: entry
268 // CHECK-NEXT: ret void
270 void __attribute__((noinline))
271 test_logic() {
272 res = _mm_and_si64(m1, m2);
273 res = _mm_andnot_si64(m1, m2);
274 res = _mm_or_si64(m1, m2);
275 res = _mm_xor_si64(m1, m2);
278 // CHECK-LABEL: @test_logic
280 // CHECK-LABEL: define available_externally i64 @_mm_and_si64
281 // CHECK: and i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
283 // CHECK-LABEL: define available_externally i64 @_mm_andnot_si64
284 // CHECK: %[[XOR:[0-9a-zA-Z_.]+]] = xor i64 %{{[0-9a-zA-Z_.]+}}, -1
285 // CHECK: and i64 %[[XOR]], %{{[0-9a-zA-Z_.]+}}
287 // CHECK-LABEL: define available_externally i64 @_mm_or_si64
288 // CHECK: or i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
290 // CHECK-LABEL: define available_externally i64 @_mm_xor_si64
291 // CHECK: xor i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
293 void __attribute__((noinline))
294 test_alt_name_logic() {
295 res = _m_pand(m1, m2);
296 res = _m_pandn(m1, m2);
297 res = _m_por(m1, m2);
298 res = _m_pxor(m1, m2);
301 // CHECK-LABEL: @test_alt_name_logic
303 // CHECK-LABEL: define available_externally i64 @_m_pand
304 // CHECK: call i64 @_mm_and_si64
306 // CHECK-LABEL: define available_externally i64 @_m_pandn
307 // CHECK: call i64 @_mm_andnot_si64
309 // CHECK-LABEL: define available_externally i64 @_m_por
310 // CHECK: call i64 @_mm_or_si64
312 // CHECK-LABEL: define available_externally i64 @_m_pxor
313 // CHECK: call i64 @_mm_xor_si64
315 void __attribute__((noinline))
316 test_madd() {
317 res = _mm_madd_pi16(m1, m2);
318 res = _m_pmaddwd(m1, m2);
321 // CHECK-LABEL: @test_madd
323 // CHECK-LABEL: define available_externally i64 @_mm_madd_pi16
324 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
325 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
326 // CHECK: call <4 x i32> @vec_vmsumshm
328 // CHECK-LABEL: define available_externally i64 @_m_pmaddwd
329 // CHECK: call i64 @_mm_madd_pi16
331 void __attribute__((noinline))
332 test_mul() {
333 res = _mm_mulhi_pi16(m1, m2);
334 res = _mm_mullo_pi16(m1, m2);
337 // CHECK-LABEL: @test_mul
339 // CHECK-LABEL: define available_externally i64 @_mm_mulhi_pi16
340 // CHECK-BE: store <16 x i8> <i8 0, i8 1, i8 16, i8 17, i8 4, i8 5, i8 20, i8 21, i8 0, i8 1, i8 16, i8 17, i8 4, i8 5, i8 20, i8 21>
341 // CHECK-LE: store <16 x i8> <i8 2, i8 3, i8 18, i8 19, i8 6, i8 7, i8 22, i8 23, i8 10, i8 11, i8 26, i8 27, i8 14, i8 15, i8 30, i8 31>
342 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
343 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
344 // CHECK: call <4 x i32> @vec_vmulesh
345 // CHECK: call <4 x i32> @vec_vmulosh
346 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])
348 // CHECK-LABEL: define available_externally i64 @_mm_mullo_pi16
349 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
350 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
351 // CHECK: mul <8 x i16> %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
353 void __attribute__((noinline))
354 test_alt_name_mul() {
355 res = _m_pmulhw(m1, m2);
356 res = _m_pmullw(m1, m2);
359 // CHECK-LABEL: @test_alt_name_mul
361 // CHECK-LABEL: define available_externally i64 @_m_pmulhw
362 // CHECK: call i64 @_mm_mulhi_pi16
364 // CHECK-LABEL: define available_externally i64 @_m_pmullw
365 // CHECK: call i64 @_mm_mullo_pi16
367 void __attribute__((noinline))
368 test_packs() {
369 res = _mm_packs_pu16((__m64)ull1, (__m64)ull2);
370 res = _mm_packs_pi16((__m64)ull1, (__m64)ull2);
371 res = _mm_packs_pi32((__m64)ull1, (__m64)ull2);
374 // CHECK-LABEL: @test_packs
376 // CHECK-LABEL: define available_externally i64 @_mm_packs_pu16
377 // CHECK: call <8 x i16> @vec_cmplt
378 // CHECK: call <16 x i8> @vec_packs(unsigned short vector[8], unsigned short vector[8])
379 // CHECK: call <16 x i8> @vec_pack(bool vector[8], bool vector[8])
380 // CHECK: call <16 x i8> @vec_sel(unsigned char vector[16], unsigned char vector[16], bool vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer, <16 x i8> noundef %{{[0-9a-zA-Z_.]+}})
382 // CHECK-LABEL: define available_externally i64 @_mm_packs_pi16
383 // CHECK: call <16 x i8> @vec_packs(short vector[8], short vector[8])
385 // CHECK-LABEL: define available_externally i64 @_mm_packs_pi32
386 // CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])
388 void __attribute__((noinline))
389 test_alt_name_packs() {
390 res = _m_packssdw(m1, m2);
391 res = _m_packsswb(m1, m2);
392 res = _m_packuswb(m1, m2);
395 // CHECK-LABEL: @test_alt_name_packs
397 // CHECK-LABEL: define available_externally i64 @_m_packssdw
398 // CHECK: call i64 @_mm_packs_pi32
400 // CHECK-LABEL: define available_externally i64 @_m_packsswb
401 // CHECK: call i64 @_mm_packs_pi16
403 // CHECK-LABEL: define available_externally i64 @_m_packuswb
404 // CHECK: call i64 @_mm_packs_pu16
406 void __attribute__((noinline))
407 test_set() {
408 m1 = _mm_set_pi32(2134, -128);
409 m1 = _mm_set_pi16(2134, -128, 1234, 6354);
410 m1 = _mm_set_pi8(-128, 10, 0, 123, -1, -5, 127, 5);
413 // CHECK-LABEL: @test_set
415 // CHECK-LABEL: define available_externally i64 @_mm_set_pi32
416 // CHECK-COUNT-2: store i32 %{{[0-9a-zA-Z_.]+}}, ptr
418 // CHECK-LABEL: define available_externally i64 @_mm_set_pi16
419 // CHECK-COUNT-4: store i16 %{{[0-9a-zA-Z_.]+}}, ptr
421 // CHECK-LABEL: define available_externally i64 @_mm_set_pi8
422 // CHECK-COUNT-8: store i8 %{{[0-9a-zA-Z_.]+}}, ptr
424 void __attribute__((noinline))
425 test_set1() {
426 res = _mm_set1_pi32(i1);
427 res = _mm_set1_pi16(s[0]);
428 res = _mm_set1_pi8(c[0]);
431 // CHECK-LABEL: @test_set1
433 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi32
434 // CHECK-COUNT-2: store i32 %{{[0-9a-zA-Z_.]+}}, ptr
436 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi16
437 // CHECK-P9: call <8 x i16> @vec_splats(short)
438 // CHECK-P9: extractelement <2 x i64> %{{[0-9a-zA-Z_.]+}}, i32 0
439 // CHECK-P8: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
440 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
441 // CHECK-P8: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
442 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
443 // CHECK-P8: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
444 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
445 // CHECK-P8: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
446 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
449 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi8
450 // CHECK: call <16 x i8> @vec_splats(signed char)
451 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
452 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
454 void __attribute__((noinline))
455 test_setr() {
456 res = _mm_setr_pi32(i1, i2);
457 res = _mm_setr_pi16(s[0], s[1], s[2], s[3]);
458 res = _mm_setr_pi8(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
461 // CHECK-LABEL: @test_setr
463 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi32
464 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
465 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
466 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
467 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
469 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi16
470 // CHECK: call i64 @_mm_set_pi16
472 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi8
473 // CHECK: call i64 @_mm_set_pi8
475 void __attribute__((noinline))
476 test_setzero() {
477 res = _mm_setzero_si64();
480 // CHECK-LABEL: @test_setzero
482 // CHECK-LABEL: define available_externally i64 @_mm_setzero_si64
483 // CHECK: entry
484 // CHECK-NEXT: ret i64 0
486 void __attribute__((noinline))
487 test_sll() {
488 res = _mm_sll_pi16(m1, m2);
489 res = _mm_sll_pi32(m1, m2);
490 res = _mm_sll_si64(m1, m2);
491 res = _mm_slli_pi16(m1, i1);
492 res = _mm_slli_pi32(m1, i1);
493 res = _mm_slli_si64(m1, i1);
496 // CHECK-LABEL: @test_sll
498 // CHECK-LABEL: define available_externally i64 @_mm_sll_pi16
499 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
500 // CHECK-NEXT: br i1 %[[CMP]]
501 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
502 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
503 // CHECK: call <8 x i16> @vec_splats(unsigned short)
504 // CHECK: call <8 x i16> @vec_sl(short vector[8], unsigned short vector[8])
505 // CHECK: store i64 0, ptr
507 // CHECK-LABEL: define available_externally i64 @_mm_sll_pi32
508 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
509 // CHECK: shl i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC]]
510 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
511 // CHECK: shl i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
513 // CHECK-LABEL: define available_externally i64 @_mm_sll_si64
514 // CHECK: shl i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
516 // CHECK-LABEL: define available_externally i64 @_mm_slli_pi16
517 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
518 // CHECK: call i64 @_mm_sll_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
520 // CHECK-LABEL: define available_externally i64 @_mm_slli_pi32
521 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
522 // CHECK: call i64 @_mm_sll_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
524 // CHECK-LABEL: define available_externally i64 @_mm_slli_si64
525 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = zext i32 %{{[0-9a-zA-Z_.]+}} to i64
526 // CHECK: shl i64 %{{[0-9a-zA-Z_.]+}}, %[[EXT]]
528 void __attribute__((noinline))
529 test_alt_name_sll() {
530 res = _m_pslld(m1, m2);
531 res = _m_pslldi(m1, i1);
532 res = _m_psllq(m1, m2);
533 res = _m_psllqi(m1, i1);
534 res = _m_psllw(m1, m2);
535 res = _m_psllwi(m1, i1);
538 // CHECK-LABEL: @test_alt_name_sll
540 // CHECK-LABEL: define available_externally i64 @_m_pslld
541 // CHECK: call i64 @_mm_sll_pi32
543 // CHECK-LABEL: define available_externally i64 @_m_pslldi
544 // CHECK: call i64 @_mm_slli_pi32
546 // CHECK-LABEL: define available_externally i64 @_m_psllq
547 // CHECK: call i64 @_mm_sll_si64
549 // CHECK-LABEL: define available_externally i64 @_m_psllqi
550 // CHECK: call i64 @_mm_slli_si64
552 // CHECK-LABEL: define available_externally i64 @_m_psllw
553 // CHECK: call i64 @_mm_sll_pi16
555 // CHECK-LABEL: define available_externally i64 @_m_psllwi
556 // CHECK: call i64 @_mm_slli_pi16
558 void __attribute__((noinline))
559 test_sra() {
560 res = _mm_sra_pi32(m1, m2);
561 res = _mm_sra_pi16(m1, m2);
562 res = _mm_srai_pi32(m1, i1);
563 res = _mm_srai_pi16(m1, i1);
566 // CHECK-LABEL: @test_sra
568 // CHECK-LABEL: define available_externally i64 @_mm_sra_pi32
569 // CHECK: %[[TRUNC1:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
570 // CHECK: ashr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC1]]
571 // CHECK: %[[TRUNC2:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
572 // CHECK: ashr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC2]]
574 // CHECK-LABEL: define available_externally i64 @_mm_sra_pi16
575 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
576 // CHECK: br i1 %[[CMP]]
577 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
578 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
579 // CHECK: call <8 x i16> @vec_splats(unsigned short)(i16 noundef zeroext %[[TRUNC]])
580 // CHECK: call <8 x i16> @vec_sra(short vector[8], unsigned short vector[8])
581 // CHECK: store i64 0, ptr
583 // CHECK-LABEL: define available_externally i64 @_mm_srai_pi32
584 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
585 // CHECK: call i64 @_mm_sra_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
587 // CHECK-LABEL: define available_externally i64 @_mm_srai_pi16
588 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
589 // CHECK: call i64 @_mm_sra_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
591 void __attribute__((noinline))
592 test_alt_name_sra() {
593 res = _m_psrad(m1, m2);
594 res = _m_psraw(m1, m2);
595 res = _m_psradi(m1, i1);
596 res = _m_psrawi(m1, i1);
599 // CHECK-LABEL: @test_alt_name_sra
601 // CHECK-LABEL: define available_externally i64 @_m_psrad
602 // CHECK: call i64 @_mm_sra_pi32
604 // CHECK-LABEL: define available_externally i64 @_m_psraw
605 // CHECK: call i64 @_mm_sra_pi16
607 // CHECK-LABEL: define available_externally i64 @_m_psradi
608 // CHECK: call i64 @_mm_srai_pi32
610 // CHECK-LABEL: define available_externally i64 @_m_psrawi
611 // CHECK: call i64 @_mm_srai_pi16
613 void __attribute__((noinline))
614 test_srl() {
615 res = _mm_srl_si64(m1, m2);
616 res = _mm_srl_pi32(m1, m2);
617 res = _mm_srl_pi16(m1, m2);
618 res = _mm_srli_si64(m1, i1);
619 res = _mm_srli_pi32(m1, i1);
620 res = _mm_srli_pi16(m1, i1);
623 // CHECK-LABEL: @test_srl
625 // CHECK-LABEL: define available_externally i64 @_mm_srl_si64
626 // CHECK: lshr i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
628 // CHECK-LABEL: define available_externally i64 @_mm_srl_pi32
629 // CHECK: %[[TRUNC1:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
630 // CHECK: lshr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC1]]
631 // CHECK: %[[TRUNC2:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
632 // CHECK: lshr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC2]]
634 // CHECK-LABEL: define available_externally i64 @_mm_srl_pi16
635 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
636 // CHECK: br i1 %[[CMP]]
637 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
638 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
639 // CHECK: call <8 x i16> @vec_splats(unsigned short)
640 // CHECK: call <8 x i16> @vec_sr(unsigned short vector[8], unsigned short vector[8])
641 // CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8
643 // CHECK-LABEL: define available_externally i64 @_mm_srli_si64
644 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = zext i32 %{{[0-9a-zA-Z_.]+}} to i64
645 // CHECK: lshr i64 %{{[0-9a-zA-Z_.]+}}, %[[EXT]]
647 // CHECK-LABEL: define available_externally i64 @_mm_srli_pi32
648 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
649 // CHECK: call i64 @_mm_srl_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
651 // CHECK-LABEL: define available_externally i64 @_mm_srli_pi16
652 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
653 // CHECK: call i64 @_mm_srl_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
655 void __attribute__((noinline))
656 test_alt_name_srl() {
657 res = _m_psrlq(m1, m2);
658 res = _m_psrld(m1, m2);
659 res = _m_psrlw(m1, m2);
660 res = _m_psrlqi(m1, i1);
661 res = _m_psrldi(m1, i1);
662 res = _m_psrlwi(m1, i1);
665 // CHECK-LABEL: @test_alt_name_srl
667 // CHECK-LABEL: define available_externally i64 @_m_psrlq
668 // CHECK: call i64 @_mm_srl_si64
670 // CHECK-LABEL: define available_externally i64 @_m_psrld
671 // CHECK: call i64 @_mm_srl_pi32
673 // CHECK-LABEL: define available_externally i64 @_m_psrlw
674 // CHECK: call i64 @_mm_srl_pi16
676 // CHECK-LABEL: define available_externally i64 @_m_psrlqi
677 // CHECK: call i64 @_mm_srli_si64
679 // CHECK-LABEL: define available_externally i64 @_m_psrldi
680 // CHECK: call i64 @_mm_srli_pi32
682 // CHECK-LABEL: define available_externally i64 @_m_psrlwi
683 // CHECK: call i64 @_mm_srli_pi16
685 void __attribute__((noinline))
686 test_sub() {
687 res = _mm_sub_pi32(m1, m2);
688 res = _mm_sub_pi16(m1, m2);
689 res = _mm_sub_pi8(m1, m2);
690 res = _mm_subs_pi16(m1, m2);
691 res = _mm_subs_pi8(m1, m2);
692 res = _mm_subs_pu16(m1, m2);
693 res = _mm_subs_pu8(m1, m2);
696 // CHECK-LABEL: @test_sub
698 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi32
699 // CHECK-P8-COUNT-2: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
700 // CHECK-P8: sub nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
701 // CHECK-P8-COUNT-2: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
702 // CHECK-P8: sub nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
703 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
704 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
705 // CHECK-P9: call <4 x i32> @vec_sub(int vector[4], int vector[4])
707 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi16
708 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
709 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
710 // CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])
712 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi8
713 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
714 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
715 // CHECK: call <16 x i8> @vec_sub(signed char vector[16], signed char vector[16])
717 // CHECK-LABEL: define available_externally i64 @_mm_subs_pi16
718 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
719 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
720 // CHECK: call <8 x i16> @vec_subs(short vector[8], short vector[8])
722 // CHECK-LABEL: define available_externally i64 @_mm_subs_pi8
723 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
724 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
725 // CHECK: call <16 x i8> @vec_subs(signed char vector[16], signed char vector[16])
727 // CHECK-LABEL: define available_externally i64 @_mm_subs_pu16
728 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
729 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
730 // CHECK: call <8 x i16> @vec_subs(unsigned short vector[8], unsigned short vector[8])
732 // CHECK-LABEL: define available_externally i64 @_mm_subs_pu8
733 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
734 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
735 // CHECK: call <16 x i8> @vec_subs(unsigned char vector[16], unsigned char vector[16])
737 void __attribute__((noinline))
738 test_alt_name_sub() {
739 res = _m_psubd(m1, m2);
740 res = _m_psubw(m1, m2);
741 res = _m_psubb(m1, m2);
742 res = _m_psubsw(m1, m2);
743 res = _m_psubsb(m1, m2);
744 res = _m_psubusw(m1, m2);
745 res = _m_psubusb(m1, m2);
748 // CHECK-LABEL: @test_alt_name_sub
750 // CHECK-LABEL: define available_externally i64 @_m_psubd
751 // CHECK: call i64 @_mm_sub_pi32
753 // CHECK-LABEL: define available_externally i64 @_m_psubw
754 // CHECK: call i64 @_mm_sub_pi16
756 // CHECK-LABEL: define available_externally i64 @_m_psubb
757 // CHECK: call i64 @_mm_sub_pi8
759 // CHECK-LABEL: define available_externally i64 @_m_psubsw
760 // CHECK: call i64 @_mm_subs_pi16
762 // CHECK-LABEL: define available_externally i64 @_m_psubsb
763 // CHECK: call i64 @_mm_subs_pi8
765 // CHECK-LABEL: define available_externally i64 @_m_psubusw
766 // CHECK: call i64 @_mm_subs_pu16
768 // CHECK-LABEL: define available_externally i64 @_m_psubusb
769 // CHECK: call i64 @_mm_subs_pu8
771 void __attribute__((noinline))
772 test_unpack() {
773 res = _mm_unpackhi_pi32(m1, m2);
774 res = _mm_unpackhi_pi16(m1, m2);
775 res = _mm_unpackhi_pi8(m1, m2);
776 res = _mm_unpacklo_pi32(m1, m2);
777 res = _mm_unpacklo_pi16(m1, m2);
778 res = _mm_unpacklo_pi8(m1, m2);
781 // CHECK-LABEL: @test_unpack
783 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi32
784 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
785 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
786 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
787 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
788 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
789 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
791 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi16
792 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
793 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
794 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
795 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
796 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
797 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
798 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
799 // CHECK: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
800 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
801 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
802 // CHECK: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
803 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
805 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi8
806 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
807 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
808 // CHECK: call <16 x i8> @vec_mergel(unsigned char vector[16], unsigned char vector[16])
810 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi32
811 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
812 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
813 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
814 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
815 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
816 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
818 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi16
819 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
820 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
821 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
822 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
823 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
824 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
825 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
826 // CHECK: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
827 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
828 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
829 // CHECK: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
830 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
832 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi8
833 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
834 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
835 // CHECK: call <16 x i8> @vec_mergel(unsigned char vector[16], unsigned char vector[16])
837 void __attribute__((noinline))
838 test_alt_name_unpack() {
839 res = _m_punpckhdq(m1, m2);
840 res = _m_punpckhwd(m1, m2);
841 res = _m_punpckhbw(m1, m2);
842 res = _m_punpckldq(m1, m2);
843 res = _m_punpcklwd(m1, m2);
844 res = _m_punpcklbw(m1, m2);
847 // CHECK-LABEL: @test_alt_name_unpack
849 // CHECK-LABEL: define available_externally i64 @_m_punpckhdq
850 // CHECK: call i64 @_mm_unpackhi_pi32
852 // CHECK-LABEL: define available_externally i64 @_m_punpckhwd
853 // CHECK: call i64 @_mm_unpackhi_pi16
855 // CHECK-LABEL: define available_externally i64 @_m_punpckhbw
856 // CHECK: call i64 @_mm_unpackhi_pi8
858 // CHECK-LABEL: define available_externally i64 @_m_punpckldq
859 // CHECK: call i64 @_mm_unpacklo_pi32
861 // CHECK-LABEL: define available_externally i64 @_m_punpcklwd
862 // CHECK: call i64 @_mm_unpacklo_pi16
864 // CHECK-LABEL: define available_externally i64 @_m_punpcklbw
865 // CHECK: call i64 @_mm_unpacklo_pi8