[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / PowerPC / ppc-mmintrin.c
blob4cb5b8540092f9b9c515469abce45646e628508c
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 -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
13 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-BE
14 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
15 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-LE
16 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
17 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-BE
18 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr9 -DNO_WARN_X86_INTRINSICS %s \
19 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n| FileCheck %s --check-prefixes=CHECK-P9,CHECK,CHECK-LE
21 // RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \
22 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK-P8,CHECK,CHECK-BE
23 // RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -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-BE
26 #include <mmintrin.h>
28 unsigned long long int ull1, ull2;
29 int i1, i2;
30 short s[4];
31 signed char c[8];
32 long long int ll1;
33 __m64 m1, m2, res;
35 void __attribute__((noinline))
36 test_add() {
37 res = _mm_add_pi32(m1, m2);
38 res = _mm_add_pi16(m1, m2);
39 res = _mm_add_pi8(m1, m2);
40 res = _mm_adds_pu16(m1, m2);
41 res = _mm_adds_pu8(m1, m2);
42 res = _mm_adds_pi16(m1, m2);
43 res = _mm_adds_pi8(m1, m2);
46 // CHECK-LABEL: @test_add
48 // CHECK-LABEL: define available_externally i64 @_mm_add_pi32
49 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
50 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
51 // CHECK-P9: call <4 x i32> @vec_add(int vector[4], int vector[4])
52 // CHECK-P8: add nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
53 // CHECK-P8: add nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
55 // CHECK-LABEL: define available_externally i64 @_mm_add_pi16
56 // CHECK: call <2 x i64> @vec_splats
57 // CHECK: call <2 x i64> @vec_splats
58 // CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])
60 // CHECK-LABEL: define available_externally i64 @_mm_add_pi8
61 // CHECK: call <2 x i64> @vec_splats
62 // CHECK: call <2 x i64> @vec_splats
63 // CHECK: call <16 x i8> @vec_add(signed char vector[16], signed char vector[16])
65 // CHECK-LABEL: define available_externally i64 @_mm_adds_pu16
66 // CHECK: call <2 x i64> @vec_splats
67 // CHECK: call <2 x i64> @vec_splats
68 // CHECK: call <8 x i16> @vec_adds(unsigned short vector[8], unsigned short vector[8])
70 // CHECK-LABEL: define available_externally i64 @_mm_adds_pu8
71 // CHECK: call <2 x i64> @vec_splats
72 // CHECK: call <2 x i64> @vec_splats
73 // CHECK: call <16 x i8> @vec_adds(unsigned char vector[16], unsigned char vector[16])
75 // CHECK-LABEL: define available_externally i64 @_mm_adds_pi16
76 // CHECK: call <2 x i64> @vec_splats
77 // CHECK: call <2 x i64> @vec_splats
78 // CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])
80 // CHECK-LABEL: define available_externally i64 @_mm_adds_pi8
81 // CHECK: call <2 x i64> @vec_splats
82 // CHECK: call <2 x i64> @vec_splats
83 // CHECK: call <16 x i8> @vec_adds(signed char vector[16], signed char vector[16])
85 void __attribute__((noinline))
86 test_alt_name_add() {
87 res = _m_paddb(m1, m2);
88 res = _m_paddd(m1, m2);
89 res = _m_paddsb(m1, m2);
90 res = _m_paddsw(m1, m2);
91 res = _m_paddusb(m1, m2);
92 res = _m_paddusw(m1, m2);
93 res = _m_paddw(m1, m2);
96 // CHECK-LABEL: @test_alt_name_add
98 // CHECK-LABEL: define available_externally i64 @_m_paddb
99 // CHECK: call i64 @_mm_add_pi8
101 // CHECK-LABEL: define available_externally i64 @_m_paddd
102 // CHECK: call i64 @_mm_add_pi32
104 // CHECK-LABEL: define available_externally i64 @_m_paddsb
105 // CHECK: call i64 @_mm_adds_pi8
107 // CHECK-LABEL: define available_externally i64 @_m_paddsw
108 // CHECK: call i64 @_mm_adds_pi16
110 // CHECK-LABEL: define available_externally i64 @_m_paddusb
111 // CHECK: call i64 @_mm_adds_pu8
113 // CHECK-LABEL: define available_externally i64 @_m_paddusw
114 // CHECK: call i64 @_mm_adds_pu16
116 // CHECK-LABEL: define available_externally i64 @_m_paddw
117 // CHECK: call i64 @_mm_add_pi16
119 void __attribute__((noinline))
120 test_cmp() {
121 res = _mm_cmpeq_pi32(m1, m2);
122 res = _mm_cmpeq_pi16(m1, m2);
123 res = _mm_cmpeq_pi8(m1, m2);
124 res = _mm_cmpgt_pi32(m1, m2);
125 res = _mm_cmpgt_pi16(m1, m2);
126 res = _mm_cmpgt_pi8(m1, m2);
129 // CHECK-LABEL: @test_cmp
131 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi32
132 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
133 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
134 // CHECK-P9: call <4 x i32> @vec_cmpeq(int vector[4], int vector[4])
135 // CHECK-P8: %[[CMP1:[0-9a-zA-Z_.]+]] = icmp eq i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
136 // CHECK-P8: select i1 %[[CMP1]], i32 -1, i32 0
137 // CHECK-P8: %[[CMP2:[0-9a-zA-Z_.]+]] = icmp eq i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
138 // CHECK-P8: select i1 %[[CMP2]], i32 -1, i32 0
140 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi16
141 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
142 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
143 // CHECK: call <8 x i16> @vec_cmpeq(short vector[8], short vector[8])
145 // CHECK-LABEL: define available_externally i64 @_mm_cmpeq_pi8
146 // CHECK: call i64 asm "cmpb $0,$1,$2;\0A", "=r,r,r"
148 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi32
149 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
150 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
151 // CHECK-P9: call <4 x i32> @vec_cmpgt(int vector[4], int vector[4])
152 // CHECK-P8: %[[CMP1:[0-9a-zA-Z_.]+]] = icmp sgt i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
153 // CHECK-P8: select i1 %[[CMP1]], i32 -1, i32 0
154 // CHECK-P8: [[CMP2:[0-9a-zA-Z_.]+]] = icmp sgt i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
155 // CHECK-P8: select i1 %[[CMP2]], i32 -1, i32 0
157 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi16
158 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
159 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
160 // CHECK: call <8 x i16> @vec_cmpgt(short vector[8], short vector[8])
162 // CHECK-LABEL: define available_externally i64 @_mm_cmpgt_pi8
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 <16 x i8> @vec_cmpgt(signed char vector[16], signed char vector[16])
167 void __attribute__((noinline))
168 test_alt_name_cmp() {
169 res = _m_pcmpeqb(m1, m2);
170 res = _m_pcmpeqd(m1, m2);
171 res = _m_pcmpeqw(m1, m2);
172 res = _m_pcmpgtb(m1, m2);
173 res = _m_pcmpgtd(m1, m2);
174 res = _m_pcmpgtw(m1, m2);
177 // CHECK-LABEL: @test_alt_name_cmp
179 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqb
180 // CHECK: call i64 @_mm_cmpeq_pi8
182 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqd
183 // CHECK: call i64 @_mm_cmpeq_pi32
185 // CHECK-LABEL: define available_externally i64 @_m_pcmpeqw
186 // CHECK: call i64 @_mm_cmpeq_pi16
188 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtb
189 // CHECK: call i64 @_mm_cmpgt_pi8
191 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtd
192 // CHECK: call i64 @_mm_cmpgt_pi32
194 // CHECK-LABEL: define available_externally i64 @_m_pcmpgtw
195 // CHECK: call i64 @_mm_cmpgt_pi16
197 void __attribute__((noinline))
198 test_convert() {
199 ll1 = _mm_cvtm64_si64(m1);
200 m1 = _mm_cvtsi32_si64(i1);
201 m1 = _mm_cvtsi64_m64(ll1);
202 i1 = _mm_cvtsi64_si32(m1);
205 // CHECK-LABEL: @test_convert
207 // CHECK-LABEL: define available_externally i64 @_mm_cvtm64_si64
208 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
209 // CHECK-NEXT: ret i64 %[[RESULT]]
211 // CHECK-LABEL: define available_externally i64 @_mm_cvtsi32_si64
212 // CHECK: %[[LOAD:[0-9a-zA-Z_.]+]] = load i32, ptr %{{[0-9a-zA-Z_.]+}}
213 // CHECK-NEXT: %[[RESULT:[0-9a-zA-Z_.]+]] = zext i32 %[[LOAD]] to i64
214 // CHECK-NEXT: ret i64 %[[RESULT]]
216 // CHECK-LABEL: define available_externally i64 @_mm_cvtsi64_m64
217 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
218 // CHECK-NEXT: ret i64 %[[RESULT]]
220 // CHECK-LABEL: define available_externally signext i32 @_mm_cvtsi64_si32
221 // CHECK: %[[LOAD:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}, align 8
222 // CHECK-NEXT: %[[RESULT:[0-9a-zA-Z_.]+]] = trunc i64 %[[LOAD]] to i32
223 // CHECK-NEXT: ret i32 %[[RESULT]]
225 void __attribute__((noinline))
226 test_alt_name_convert() {
227 m1 = _m_from_int(i1);
228 m1 = _m_from_int64(ll1);
229 i1 = _m_to_int(m1);
230 ll1 = _m_to_int64(m1);
233 // CHECK-LABEL: @test_alt_name_convert
235 // CHECK-LABEL: define available_externally i64 @_m_from_int
236 // CHECK: call i64 @_mm_cvtsi32_si64
238 // CHECK-LABEL: define available_externally i64 @_m_from_int64
239 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}
240 // CHECK-NEXT: ret i64 %[[RESULT]]
242 // CHECK-LABEL: define available_externally signext i32 @_m_to_int
243 // CHECK: call signext i32 @_mm_cvtsi64_si32
245 // CHECK-LABEL: define available_externally i64 @_m_to_int64
246 // CHECK: %[[RESULT:[0-9a-zA-Z_.]+]] = load i64, ptr %{{[0-9a-zA-Z_.]+}}
247 // CHECK-NEXT: ret i64 %[[RESULT]]
249 void __attribute__((noinline))
250 test_empty() {
251 _mm_empty();
252 _m_empty();
255 // CHECK-LABEL: @test_empty
257 // CHECK-LABEL: define available_externally void @_mm_empty
258 // CHECK-NEXT: entry
259 // CHECK-NEXT: ret void
261 // CHECK-LABEL: define available_externally void @_m_empty
262 // CHECK-NEXT: entry
263 // CHECK-NEXT: ret void
265 void __attribute__((noinline))
266 test_logic() {
267 res = _mm_and_si64(m1, m2);
268 res = _mm_andnot_si64(m1, m2);
269 res = _mm_or_si64(m1, m2);
270 res = _mm_xor_si64(m1, m2);
273 // CHECK-LABEL: @test_logic
275 // CHECK-LABEL: define available_externally i64 @_mm_and_si64
276 // CHECK: and i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
278 // CHECK-LABEL: define available_externally i64 @_mm_andnot_si64
279 // CHECK: %[[XOR:[0-9a-zA-Z_.]+]] = xor i64 %{{[0-9a-zA-Z_.]+}}, -1
280 // CHECK: and i64 %[[XOR]], %{{[0-9a-zA-Z_.]+}}
282 // CHECK-LABEL: define available_externally i64 @_mm_or_si64
283 // CHECK: or i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
285 // CHECK-LABEL: define available_externally i64 @_mm_xor_si64
286 // CHECK: xor i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
288 void __attribute__((noinline))
289 test_alt_name_logic() {
290 res = _m_pand(m1, m2);
291 res = _m_pandn(m1, m2);
292 res = _m_por(m1, m2);
293 res = _m_pxor(m1, m2);
296 // CHECK-LABEL: @test_alt_name_logic
298 // CHECK-LABEL: define available_externally i64 @_m_pand
299 // CHECK: call i64 @_mm_and_si64
301 // CHECK-LABEL: define available_externally i64 @_m_pandn
302 // CHECK: call i64 @_mm_andnot_si64
304 // CHECK-LABEL: define available_externally i64 @_m_por
305 // CHECK: call i64 @_mm_or_si64
307 // CHECK-LABEL: define available_externally i64 @_m_pxor
308 // CHECK: call i64 @_mm_xor_si64
310 void __attribute__((noinline))
311 test_madd() {
312 res = _mm_madd_pi16(m1, m2);
313 res = _m_pmaddwd(m1, m2);
316 // CHECK-LABEL: @test_madd
318 // CHECK-LABEL: define available_externally i64 @_mm_madd_pi16
319 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
320 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
321 // CHECK: call <4 x i32> @vec_vmsumshm
323 // CHECK-LABEL: define available_externally i64 @_m_pmaddwd
324 // CHECK: call i64 @_mm_madd_pi16
326 void __attribute__((noinline))
327 test_mul() {
328 res = _mm_mulhi_pi16(m1, m2);
329 res = _mm_mullo_pi16(m1, m2);
332 // CHECK-LABEL: @test_mul
334 // CHECK-LABEL: define available_externally i64 @_mm_mulhi_pi16
335 // 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>
336 // 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>
337 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
338 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
339 // CHECK: call <4 x i32> @vec_vmulesh
340 // CHECK: call <4 x i32> @vec_vmulosh
341 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])
343 // CHECK-LABEL: define available_externally i64 @_mm_mullo_pi16
344 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
345 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
346 // CHECK: mul <8 x i16> %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
348 void __attribute__((noinline))
349 test_alt_name_mul() {
350 res = _m_pmulhw(m1, m2);
351 res = _m_pmullw(m1, m2);
354 // CHECK-LABEL: @test_alt_name_mul
356 // CHECK-LABEL: define available_externally i64 @_m_pmulhw
357 // CHECK: call i64 @_mm_mulhi_pi16
359 // CHECK-LABEL: define available_externally i64 @_m_pmullw
360 // CHECK: call i64 @_mm_mullo_pi16
362 void __attribute__((noinline))
363 test_packs() {
364 res = _mm_packs_pu16((__m64)ull1, (__m64)ull2);
365 res = _mm_packs_pi16((__m64)ull1, (__m64)ull2);
366 res = _mm_packs_pi32((__m64)ull1, (__m64)ull2);
369 // CHECK-LABEL: @test_packs
371 // CHECK-LABEL: define available_externally i64 @_mm_packs_pu16
372 // CHECK: call <8 x i16> @vec_cmplt
373 // CHECK: call <16 x i8> @vec_packs(unsigned short vector[8], unsigned short vector[8])
374 // CHECK: call <16 x i8> @vec_pack(bool vector[8], bool vector[8])
375 // 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_.]+}})
377 // CHECK-LABEL: define available_externally i64 @_mm_packs_pi16
378 // CHECK: call <16 x i8> @vec_packs(short vector[8], short vector[8])
380 // CHECK-LABEL: define available_externally i64 @_mm_packs_pi32
381 // CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])
383 void __attribute__((noinline))
384 test_alt_name_packs() {
385 res = _m_packssdw(m1, m2);
386 res = _m_packsswb(m1, m2);
387 res = _m_packuswb(m1, m2);
390 // CHECK-LABEL: @test_alt_name_packs
392 // CHECK-LABEL: define available_externally i64 @_m_packssdw
393 // CHECK: call i64 @_mm_packs_pi32
395 // CHECK-LABEL: define available_externally i64 @_m_packsswb
396 // CHECK: call i64 @_mm_packs_pi16
398 // CHECK-LABEL: define available_externally i64 @_m_packuswb
399 // CHECK: call i64 @_mm_packs_pu16
401 void __attribute__((noinline))
402 test_set() {
403 m1 = _mm_set_pi32(2134, -128);
404 m1 = _mm_set_pi16(2134, -128, 1234, 6354);
405 m1 = _mm_set_pi8(-128, 10, 0, 123, -1, -5, 127, 5);
408 // CHECK-LABEL: @test_set
410 // CHECK-LABEL: define available_externally i64 @_mm_set_pi32
411 // CHECK-COUNT-2: store i32 %{{[0-9a-zA-Z_.]+}}, ptr
413 // CHECK-LABEL: define available_externally i64 @_mm_set_pi16
414 // CHECK-COUNT-4: store i16 %{{[0-9a-zA-Z_.]+}}, ptr
416 // CHECK-LABEL: define available_externally i64 @_mm_set_pi8
417 // CHECK-COUNT-8: store i8 %{{[0-9a-zA-Z_.]+}}, ptr
419 void __attribute__((noinline))
420 test_set1() {
421 res = _mm_set1_pi32(i1);
422 res = _mm_set1_pi16(s[0]);
423 res = _mm_set1_pi8(c[0]);
426 // CHECK-LABEL: @test_set1
428 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi32
429 // CHECK-COUNT-2: store i32 %{{[0-9a-zA-Z_.]+}}, ptr
431 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi16
432 // CHECK-P9: call <8 x i16> @vec_splats(short)
433 // CHECK-P9: extractelement <2 x i64> %{{[0-9a-zA-Z_.]+}}, i32 0
434 // CHECK-P8: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
435 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
436 // CHECK-P8: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
437 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
438 // CHECK-P8: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
439 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
440 // CHECK-P8: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
441 // CHECK-P8: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
444 // CHECK-LABEL: define available_externally i64 @_mm_set1_pi8
445 // CHECK: call <16 x i8> @vec_splats(signed char)
446 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
447 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
449 void __attribute__((noinline))
450 test_setr() {
451 res = _mm_setr_pi32(i1, i2);
452 res = _mm_setr_pi16(s[0], s[1], s[2], s[3]);
453 res = _mm_setr_pi8(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
456 // CHECK-LABEL: @test_setr
458 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi32
459 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
460 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
461 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
462 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
464 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi16
465 // CHECK: call i64 @_mm_set_pi16
467 // CHECK-LABEL: define available_externally i64 @_mm_setr_pi8
468 // CHECK: call i64 @_mm_set_pi8
470 void __attribute__((noinline))
471 test_setzero() {
472 res = _mm_setzero_si64();
475 // CHECK-LABEL: @test_setzero
477 // CHECK-LABEL: define available_externally i64 @_mm_setzero_si64
478 // CHECK: entry
479 // CHECK-NEXT: ret i64 0
481 void __attribute__((noinline))
482 test_sll() {
483 res = _mm_sll_pi16(m1, m2);
484 res = _mm_sll_pi32(m1, m2);
485 res = _mm_sll_si64(m1, m2);
486 res = _mm_slli_pi16(m1, i1);
487 res = _mm_slli_pi32(m1, i1);
488 res = _mm_slli_si64(m1, i1);
491 // CHECK-LABEL: @test_sll
493 // CHECK-LABEL: define available_externally i64 @_mm_sll_pi16
494 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
495 // CHECK-NEXT: br i1 %[[CMP]]
496 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
497 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
498 // CHECK: call <8 x i16> @vec_splats(unsigned short)
499 // CHECK: call <8 x i16> @vec_sl(short vector[8], unsigned short vector[8])
500 // CHECK: store i64 0, ptr
502 // CHECK-LABEL: define available_externally i64 @_mm_sll_pi32
503 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
504 // CHECK: shl i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC]]
505 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
506 // CHECK: shl i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
508 // CHECK-LABEL: define available_externally i64 @_mm_sll_si64
509 // CHECK: shl i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
511 // CHECK-LABEL: define available_externally i64 @_mm_slli_pi16
512 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
513 // CHECK: call i64 @_mm_sll_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
515 // CHECK-LABEL: define available_externally i64 @_mm_slli_pi32
516 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
517 // CHECK: call i64 @_mm_sll_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
519 // CHECK-LABEL: define available_externally i64 @_mm_slli_si64
520 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = zext i32 %{{[0-9a-zA-Z_.]+}} to i64
521 // CHECK: shl i64 %{{[0-9a-zA-Z_.]+}}, %[[EXT]]
523 void __attribute__((noinline))
524 test_alt_name_sll() {
525 res = _m_pslld(m1, m2);
526 res = _m_pslldi(m1, i1);
527 res = _m_psllq(m1, m2);
528 res = _m_psllqi(m1, i1);
529 res = _m_psllw(m1, m2);
530 res = _m_psllwi(m1, i1);
533 // CHECK-LABEL: @test_alt_name_sll
535 // CHECK-LABEL: define available_externally i64 @_m_pslld
536 // CHECK: call i64 @_mm_sll_pi32
538 // CHECK-LABEL: define available_externally i64 @_m_pslldi
539 // CHECK: call i64 @_mm_slli_pi32
541 // CHECK-LABEL: define available_externally i64 @_m_psllq
542 // CHECK: call i64 @_mm_sll_si64
544 // CHECK-LABEL: define available_externally i64 @_m_psllqi
545 // CHECK: call i64 @_mm_slli_si64
547 // CHECK-LABEL: define available_externally i64 @_m_psllw
548 // CHECK: call i64 @_mm_sll_pi16
550 // CHECK-LABEL: define available_externally i64 @_m_psllwi
551 // CHECK: call i64 @_mm_slli_pi16
553 void __attribute__((noinline))
554 test_sra() {
555 res = _mm_sra_pi32(m1, m2);
556 res = _mm_sra_pi16(m1, m2);
557 res = _mm_srai_pi32(m1, i1);
558 res = _mm_srai_pi16(m1, i1);
561 // CHECK-LABEL: @test_sra
563 // CHECK-LABEL: define available_externally i64 @_mm_sra_pi32
564 // CHECK: %[[TRUNC1:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
565 // CHECK: ashr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC1]]
566 // CHECK: %[[TRUNC2:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
567 // CHECK: ashr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC2]]
569 // CHECK-LABEL: define available_externally i64 @_mm_sra_pi16
570 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
571 // CHECK: br i1 %[[CMP]]
572 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
573 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
574 // CHECK: call <8 x i16> @vec_splats(unsigned short)(i16 noundef zeroext %[[TRUNC]])
575 // CHECK: call <8 x i16> @vec_sra(short vector[8], unsigned short vector[8])
576 // CHECK: store i64 0, ptr
578 // CHECK-LABEL: define available_externally i64 @_mm_srai_pi32
579 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
580 // CHECK: call i64 @_mm_sra_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
582 // CHECK-LABEL: define available_externally i64 @_mm_srai_pi16
583 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
584 // CHECK: call i64 @_mm_sra_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
586 void __attribute__((noinline))
587 test_alt_name_sra() {
588 res = _m_psrad(m1, m2);
589 res = _m_psraw(m1, m2);
590 res = _m_psradi(m1, i1);
591 res = _m_psrawi(m1, i1);
594 // CHECK-LABEL: @test_alt_name_sra
596 // CHECK-LABEL: define available_externally i64 @_m_psrad
597 // CHECK: call i64 @_mm_sra_pi32
599 // CHECK-LABEL: define available_externally i64 @_m_psraw
600 // CHECK: call i64 @_mm_sra_pi16
602 // CHECK-LABEL: define available_externally i64 @_m_psradi
603 // CHECK: call i64 @_mm_srai_pi32
605 // CHECK-LABEL: define available_externally i64 @_m_psrawi
606 // CHECK: call i64 @_mm_srai_pi16
608 void __attribute__((noinline))
609 test_srl() {
610 res = _mm_srl_si64(m1, m2);
611 res = _mm_srl_pi32(m1, m2);
612 res = _mm_srl_pi16(m1, m2);
613 res = _mm_srli_si64(m1, i1);
614 res = _mm_srli_pi32(m1, i1);
615 res = _mm_srli_pi16(m1, i1);
618 // CHECK-LABEL: @test_srl
620 // CHECK-LABEL: define available_externally i64 @_mm_srl_si64
621 // CHECK: lshr i64 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
623 // CHECK-LABEL: define available_externally i64 @_mm_srl_pi32
624 // CHECK: %[[TRUNC1:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
625 // CHECK: lshr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC1]]
626 // CHECK: %[[TRUNC2:[0-9a-zA-Z_.]+]] = trunc i64 %{{[0-9a-zA-Z_.]+}} to i32
627 // CHECK: lshr i32 %{{[0-9a-zA-Z_.]+}}, %[[TRUNC2]]
629 // CHECK-LABEL: define available_externally i64 @_mm_srl_pi16
630 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ule i64 %{{[0-9a-zA-Z_.]+}}, 15
631 // CHECK: br i1 %[[CMP]]
632 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
633 // CHECK: trunc i64 %{{[0-9a-zA-Z_.]+}} to i16
634 // CHECK: call <8 x i16> @vec_splats(unsigned short)
635 // CHECK: call <8 x i16> @vec_sr(unsigned short vector[8], unsigned short vector[8])
636 // CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8
638 // CHECK-LABEL: define available_externally i64 @_mm_srli_si64
639 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = zext i32 %{{[0-9a-zA-Z_.]+}} to i64
640 // CHECK: lshr i64 %{{[0-9a-zA-Z_.]+}}, %[[EXT]]
642 // CHECK-LABEL: define available_externally i64 @_mm_srli_pi32
643 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
644 // CHECK: call i64 @_mm_srl_pi32(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
646 // CHECK-LABEL: define available_externally i64 @_mm_srli_pi16
647 // CHECK: %[[EXT:[0-9a-zA-Z_.]+]] = sext i32 %{{[0-9a-zA-Z_.]+}} to i64
648 // CHECK: call i64 @_mm_srl_pi16(i64 noundef %{{[0-9a-zA-Z_.]+}}, i64 noundef %[[EXT]])
650 void __attribute__((noinline))
651 test_alt_name_srl() {
652 res = _m_psrlq(m1, m2);
653 res = _m_psrld(m1, m2);
654 res = _m_psrlw(m1, m2);
655 res = _m_psrlqi(m1, i1);
656 res = _m_psrldi(m1, i1);
657 res = _m_psrlwi(m1, i1);
660 // CHECK-LABEL: @test_alt_name_srl
662 // CHECK-LABEL: define available_externally i64 @_m_psrlq
663 // CHECK: call i64 @_mm_srl_si64
665 // CHECK-LABEL: define available_externally i64 @_m_psrld
666 // CHECK: call i64 @_mm_srl_pi32
668 // CHECK-LABEL: define available_externally i64 @_m_psrlw
669 // CHECK: call i64 @_mm_srl_pi16
671 // CHECK-LABEL: define available_externally i64 @_m_psrlqi
672 // CHECK: call i64 @_mm_srli_si64
674 // CHECK-LABEL: define available_externally i64 @_m_psrldi
675 // CHECK: call i64 @_mm_srli_pi32
677 // CHECK-LABEL: define available_externally i64 @_m_psrlwi
678 // CHECK: call i64 @_mm_srli_pi16
680 void __attribute__((noinline))
681 test_sub() {
682 res = _mm_sub_pi32(m1, m2);
683 res = _mm_sub_pi16(m1, m2);
684 res = _mm_sub_pi8(m1, m2);
685 res = _mm_subs_pi16(m1, m2);
686 res = _mm_subs_pi8(m1, m2);
687 res = _mm_subs_pu16(m1, m2);
688 res = _mm_subs_pu8(m1, m2);
691 // CHECK-LABEL: @test_sub
693 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi32
694 // CHECK-P8-COUNT-2: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
695 // CHECK-P8: sub nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
696 // CHECK-P8-COUNT-2: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
697 // CHECK-P8: sub nsw i32 %{{[0-9a-zA-Z_.]+}}, %{{[0-9a-zA-Z_.]+}}
698 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
699 // CHECK-P9: call <2 x i64> @vec_splats(unsigned long long)
700 // CHECK-P9: call <4 x i32> @vec_sub(int vector[4], int vector[4])
702 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi16
703 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
704 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
705 // CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])
707 // CHECK-LABEL: define available_externally i64 @_mm_sub_pi8
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 <16 x i8> @vec_sub(signed char vector[16], signed char vector[16])
712 // CHECK-LABEL: define available_externally i64 @_mm_subs_pi16
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 <8 x i16> @vec_subs(short vector[8], short vector[8])
717 // CHECK-LABEL: define available_externally i64 @_mm_subs_pi8
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 <16 x i8> @vec_subs(signed char vector[16], signed char vector[16])
722 // CHECK-LABEL: define available_externally i64 @_mm_subs_pu16
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 <8 x i16> @vec_subs(unsigned short vector[8], unsigned short vector[8])
727 // CHECK-LABEL: define available_externally i64 @_mm_subs_pu8
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 <16 x i8> @vec_subs(unsigned char vector[16], unsigned char vector[16])
732 void __attribute__((noinline))
733 test_alt_name_sub() {
734 res = _m_psubd(m1, m2);
735 res = _m_psubw(m1, m2);
736 res = _m_psubb(m1, m2);
737 res = _m_psubsw(m1, m2);
738 res = _m_psubsb(m1, m2);
739 res = _m_psubusw(m1, m2);
740 res = _m_psubusb(m1, m2);
743 // CHECK-LABEL: @test_alt_name_sub
745 // CHECK-LABEL: define available_externally i64 @_m_psubd
746 // CHECK: call i64 @_mm_sub_pi32
748 // CHECK-LABEL: define available_externally i64 @_m_psubw
749 // CHECK: call i64 @_mm_sub_pi16
751 // CHECK-LABEL: define available_externally i64 @_m_psubb
752 // CHECK: call i64 @_mm_sub_pi8
754 // CHECK-LABEL: define available_externally i64 @_m_psubsw
755 // CHECK: call i64 @_mm_subs_pi16
757 // CHECK-LABEL: define available_externally i64 @_m_psubsb
758 // CHECK: call i64 @_mm_subs_pi8
760 // CHECK-LABEL: define available_externally i64 @_m_psubusw
761 // CHECK: call i64 @_mm_subs_pu16
763 // CHECK-LABEL: define available_externally i64 @_m_psubusb
764 // CHECK: call i64 @_mm_subs_pu8
766 void __attribute__((noinline))
767 test_unpack() {
768 res = _mm_unpackhi_pi32(m1, m2);
769 res = _mm_unpackhi_pi16(m1, m2);
770 res = _mm_unpackhi_pi8(m1, m2);
771 res = _mm_unpacklo_pi32(m1, m2);
772 res = _mm_unpacklo_pi16(m1, m2);
773 res = _mm_unpacklo_pi8(m1, m2);
776 // CHECK-LABEL: @test_unpack
778 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi32
779 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
780 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
781 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
782 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
783 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
784 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
786 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi16
787 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
788 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
789 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
790 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
791 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
792 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
793 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
794 // CHECK: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
795 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
796 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
797 // CHECK: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
798 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
800 // CHECK-LABEL: define available_externally i64 @_mm_unpackhi_pi8
801 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
802 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
803 // CHECK: call <16 x i8> @vec_mergel(unsigned char vector[16], unsigned char vector[16])
805 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi32
806 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
807 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
808 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
809 // CHECK: getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
810 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [2 x i32], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
811 // CHECK: store i32 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 4
813 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi16
814 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
815 // CHECK: %[[ADDR1:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
816 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR1]], align 8
817 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 0
818 // CHECK: %[[ADDR2:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
819 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR2]], align 2
820 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
821 // CHECK: %[[ADDR3:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 2
822 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR3]], align 4
823 // CHECK: getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 1
824 // CHECK: %[[ADDR4:[0-9a-zA-Z_.]+]] = getelementptr inbounds [4 x i16], ptr %{{[0-9a-zA-Z_.]+}}, i64 0, i64 3
825 // CHECK: store i16 %{{[0-9a-zA-Z_.]+}}, ptr %[[ADDR4]], align 2
827 // CHECK-LABEL: define available_externally i64 @_mm_unpacklo_pi8
828 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
829 // CHECK: call <2 x i64> @vec_splats(unsigned long long)
830 // CHECK: call <16 x i8> @vec_mergel(unsigned char vector[16], unsigned char vector[16])
832 void __attribute__((noinline))
833 test_alt_name_unpack() {
834 res = _m_punpckhdq(m1, m2);
835 res = _m_punpckhwd(m1, m2);
836 res = _m_punpckhbw(m1, m2);
837 res = _m_punpckldq(m1, m2);
838 res = _m_punpcklwd(m1, m2);
839 res = _m_punpcklbw(m1, m2);
842 // CHECK-LABEL: @test_alt_name_unpack
844 // CHECK-LABEL: define available_externally i64 @_m_punpckhdq
845 // CHECK: call i64 @_mm_unpackhi_pi32
847 // CHECK-LABEL: define available_externally i64 @_m_punpckhwd
848 // CHECK: call i64 @_mm_unpackhi_pi16
850 // CHECK-LABEL: define available_externally i64 @_m_punpckhbw
851 // CHECK: call i64 @_mm_unpackhi_pi8
853 // CHECK-LABEL: define available_externally i64 @_m_punpckldq
854 // CHECK: call i64 @_mm_unpacklo_pi32
856 // CHECK-LABEL: define available_externally i64 @_m_punpcklwd
857 // CHECK: call i64 @_mm_unpacklo_pi16
859 // CHECK-LABEL: define available_externally i64 @_m_punpcklbw
860 // CHECK: call i64 @_mm_unpacklo_pi8