1 // REQUIRES: powerpc-registered-target
3 // RUN: %clang -S -emit-llvm -target powerpc64-gnu-linux -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
4 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
5 // RUN: %clang -S -emit-llvm -target powerpc64le-gnu-linux -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
6 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
8 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
9 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
10 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
11 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
13 // RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
14 // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
16 #include <tmmintrin.h>
19 __m128i resi
, mi1
, mi2
;
21 void __attribute__((noinline
))
23 resi
= _mm_abs_epi16(mi1
);
24 resi
= _mm_abs_epi32(mi1
);
25 resi
= _mm_abs_epi8(mi1
);
26 res
= _mm_abs_pi16(m1
);
27 res
= _mm_abs_pi32(m1
);
28 res
= _mm_abs_pi8(m1
);
31 // CHECK-LABEL: @test_abs
33 // CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi16
34 // CHECK: call <8 x i16> @vec_abs(short vector[8])
36 // CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi32
37 // CHECK: call <4 x i32> @vec_abs(int vector[4])
39 // CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi8
40 // CHECK: call <16 x i8> @vec_abs(signed char vector[16])
42 // CHECK-LABEL: define available_externally i64 @_mm_abs_pi16
43 // CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_abs(short vector[8])
44 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %[[ABS]] to <2 x i64>
45 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
47 // CHECK-LABEL: define available_externally i64 @_mm_abs_pi32
48 // CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <4 x i32> @vec_abs(int vector[4])
49 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %[[ABS]] to <2 x i64>
50 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
52 // CHECK-LABEL: define available_externally i64 @_mm_abs_pi8
53 // CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <16 x i8> @vec_abs(signed char vector[16])
54 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %[[ABS]] to <2 x i64>
55 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
57 void __attribute__((noinline
))
59 resi
= _mm_alignr_epi8(mi1
, mi2
, 1U);
60 res
= _mm_alignr_pi8(m1
, m2
, 1U);
63 // CHECK-LABEL: @test_alignr
65 // CHECK-LABEL: define available_externally <2 x i64> @_mm_alignr_epi8
66 // CHECK: %[[CONST:[0-9a-zA-Z_.]+]] = call i1 @llvm.is.constant.i32(i32 %0)
67 // CHECK: br i1 %[[CONST]]
68 // CHECK-BE: call <16 x i8> @vec_sld(unsigned char vector[16], unsigned char vector[16], unsigned int)
69 // CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])
70 // CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])
71 // CHECk-LE: call <16 x i8> @vec_sld(unsigned char vector[16], unsigned char vector[16], unsigned int)
72 // CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])
73 // CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
74 // CHECK: store <2 x i64> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
75 // CHECK: %[[SUB:[0-9a-zA-Z_.]+]] = sub i32 %{{[0-9a-zA-Z_.]+}}, 16
76 // CHECK: %[[MUL:[0-9a-zA-Z_.]+]] = mul i32 %[[SUB]], 8
77 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %[[MUL]] to i8
78 // CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])
79 // CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])
80 // CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])
81 // CHECK: %[[SUB2:[0-9a-zA-Z_.]+]] = sub i32 16, %{{[0-9a-zA-Z_.]+}}
82 // CHECK: %[[MUL2:[0-9a-zA-Z_.]+]] = mul i32 %[[SUB2]], 8
83 // CHECK-BE: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %[[MUL2]] to i8
84 // CHECK-BE: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])
85 // CHECK-BE: mul i32 %{{[0-9a-zA-Z_.]+}}, 8
86 // CHECK-BE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])
87 // CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])
88 // CHECK-BE: call <16 x i8> @vec_or(unsigned char vector[16], unsigned char vector[16])
89 // CHECK-LE: %[[MUL3:[0-9a-zA-Z_.]+]] = mul i32 %{{[0-9a-zA-Z_.]+}}, 8
90 // CHECK-LE: trunc i32 %[[MUL3]] to i8
91 // CHECK-LE: call <16 x i8> @vec_splats(unsigned char)
92 // CHECK-LE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])
93 // CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])
94 // CHECK-LE: call <16 x i8> @vec_or(unsigned char vector[16], unsigned char vector[16])
96 // CHECK-LABEL: define available_externally i64 @_mm_alignr_pi8
97 // CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ult i32 %{{[0-9a-zA-Z_.]+}}, 16
98 // CHECK: br i1 %[[CMP]]
99 // CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])
100 // CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])
101 // CHECK: extractelement <2 x i64> %{{[0-9a-zA-Z_.]+}}, i32 0
102 // CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8
103 // CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8
105 void __attribute__((noinline
))
107 resi
= _mm_hadd_epi16(mi1
, mi2
);
108 resi
= _mm_hadd_epi32(mi1
, mi2
);
109 res
= _mm_hadd_pi16(m1
, m2
);
110 res
= _mm_hadd_pi32(m1
, m2
);
111 resi
= _mm_hadds_epi16(mi1
, mi2
);
112 res
= _mm_hadds_pi16(m1
, m2
);
115 // CHECK-LABEL: @test_hadd
117 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hadd_epi16
118 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
119 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
120 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)
121 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)
122 // CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])
124 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hadd_epi32
125 // CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
126 // CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
127 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>)
128 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>)
129 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
131 // CHECK-LABEL: define available_externally i64 @_mm_hadd_pi16
132 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
133 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
134 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)
135 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)
136 // CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])
137 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
138 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
140 // CHECK-LABEL: define available_externally i64 @_mm_hadd_pi32
141 // CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
142 // CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
143 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>)
144 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>)
145 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
146 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
147 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
149 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hadds_epi16
150 // CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
151 // CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
152 // CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])
153 // CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])
154 // CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])
156 // CHECK-LABEL: define available_externally i64 @_mm_hadds_pi16
157 // CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)
158 // CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])
159 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
160 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
162 void __attribute__((noinline
))
164 resi
= _mm_hsub_epi16(mi1
, mi2
);
165 resi
= _mm_hsub_epi32(mi1
, mi2
);
166 res
= _mm_hsub_pi16(m1
, m2
);
167 res
= _mm_hsub_pi32(m1
, m2
);
168 resi
= _mm_hsubs_epi16(mi1
, mi2
);
169 res
= _mm_hsubs_pi16(m1
, m2
);
172 // CHECK-LABEL: @test_hsub
174 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hsub_epi16
175 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
176 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
177 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)
178 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)
179 // CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])
181 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hsub_epi32
182 // CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
183 // CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
184 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>)
185 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>)
186 // CHECK: call <4 x i32> @vec_sub(int vector[4], int vector[4])
188 // CHECK-LABEL: define available_externally i64 @_mm_hsub_pi16
189 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
190 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
191 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)
192 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)
193 // CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])
194 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
195 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
197 // CHECK-LABEL: define available_externally i64 @_mm_hsub_pi32
198 // CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
199 // CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
200 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>)
201 // CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>)
202 // CHECK: call <4 x i32> @vec_sub(int vector[4], int vector[4])
203 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
204 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
206 // CHECK-LABEL: define available_externally <2 x i64> @_mm_hsubs_epi16
207 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
208 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
209 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)
210 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)
211 // CHECK: call <8 x i16> @vec_subs(short vector[8], short vector[8])
213 // CHECK-LABEL: define available_externally i64 @_mm_hsubs_pi16
214 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
215 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
216 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)
217 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)
218 // CHECK: call <8 x i16> @vec_subs(short vector[8], short vector[8])
219 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
220 // CHECK: extractelement <2 x i64> %[[CAST]], i32 1
222 void __attribute__((noinline
))
224 resi
= _mm_shuffle_epi8(mi1
, mi2
);
225 res
= _mm_shuffle_pi8(m1
, m2
);
228 // CHECK-LABEL: @test_shuffle
230 // CHECK-LABEL: define available_externally <2 x i64> @_mm_shuffle_epi8
231 // CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
232 // CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)
233 // CHECK: call <16 x i8> @vec_perm(signed char vector[16], signed char vector[16], unsigned char vector[16])
234 // CHECK: call <16 x i8> @vec_sel(signed char vector[16], signed 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_.]+}})
236 // CHECK-LABEL: define available_externally i64 @_mm_shuffle_pi8
237 // CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)
238 // CHECK: call <16 x i8> @vec_perm(signed char vector[16], signed char vector[16], unsigned char vector[16])
239 // CHECK: call <16 x i8> @vec_sel(signed char vector[16], signed 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_.]+}})
240 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
241 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
243 void __attribute__((noinline
))
245 resi
= _mm_sign_epi8(mi1
, mi2
);
246 resi
= _mm_sign_epi16(mi1
, mi2
);
247 resi
= _mm_sign_epi32(mi1
, mi2
);
248 res
= _mm_sign_pi8(m1
, m2
);
249 res
= _mm_sign_pi16(m1
, m2
);
250 res
= _mm_sign_pi32(m1
, m2
);
253 // CHECK-LABEL: @test_sign
255 // CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi8
256 // CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)
257 // CHECK: call <16 x i8> @vec_cmpgt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)
258 // CHECK: call <16 x i8> @vec_neg(signed char vector[16])
259 // CHECK: call <16 x i8> @vec_add(signed char vector[16], signed char vector[16])
260 // CHECK: call <16 x i8> @vec_mul(signed char vector[16], signed char vector[16])
262 // CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi16
263 // CHECK: call <8 x i16> @vec_cmplt(short vector[8], short vector[8])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef zeroinitializer)
264 // CHECK: call <8 x i16> @vec_cmpgt(short vector[8], short vector[8])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef zeroinitializer)
265 // CHECK: call <8 x i16> @vec_neg(short vector[8])
266 // CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])
267 // CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])
269 // CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi32
270 // CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
271 // CHECK: call <4 x i32> @vec_cmplt(int vector[4], int vector[4])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)
272 // CHECK: call <4 x i32> @vec_cmpgt(int vector[4], int vector[4])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)
273 // CHECK: call <4 x i32> @vec_neg(int vector[4])
274 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
275 // CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])
277 // CHECK-LABEL: define available_externally i64 @_mm_sign_pi8
278 // CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
279 // CHECK: call <2 x i64> @_mm_sign_epi8
280 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
281 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
283 // CHECK-LABEL: define available_externally i64 @_mm_sign_pi16
284 // CHECK: store <8 x i16> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
285 // CHECK: call <2 x i64> @_mm_sign_epi16
286 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
287 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
289 // CHECK-LABEL: define available_externally i64 @_mm_sign_pi32
290 // CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16
291 // CHECK: call <2 x i64> @_mm_sign_epi32
292 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
293 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
295 void __attribute__((noinline
))
297 resi
= _mm_maddubs_epi16(mi1
, mi2
);
298 res
= _mm_maddubs_pi16(m1
, m2
);
301 // CHECK-LABEL: @test_maddubs
303 // CHECK-LABEL: define available_externally <2 x i64> @_mm_maddubs_epi16
304 // CHECK: call <8 x i16> @vec_splats(short)(i16 noundef signext 255)
305 // CHECK: call <8 x i16> @vec_unpackh(signed char vector[16])
306 // CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])
307 // CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])
308 // CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])
309 // CHECK: call <8 x i16> @vec_unpackh(signed char vector[16])
310 // CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])
311 // CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])
312 // CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])
313 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
314 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
315 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)
316 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)
317 // CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])
319 // CHECK-LABEL: define available_externally i64 @_mm_maddubs_pi16
320 // CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])
321 // CHECK: call <8 x i16> @vec_splats(short)(i16 noundef signext 255)
322 // CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])
323 // CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])
324 // CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])
325 // CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
326 // CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16
327 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)
328 // CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)
329 // CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])
330 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
331 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0
333 void __attribute__((noinline
))
335 resi
= _mm_mulhrs_epi16(mi1
, mi2
);
336 res
= _mm_mulhrs_pi16(m1
, m2
);
339 // CHECK-LABEL: @test_mulhrs
341 // CHECK-LABEL: define available_externally <2 x i64> @_mm_mulhrs_epi16
342 // CHECK: call <4 x i32> @vec_unpackh(short vector[8])
343 // CHECK: call <4 x i32> @vec_unpackh(short vector[8])
344 // CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])
345 // CHECK: call <4 x i32> @vec_unpackl(short vector[8])
346 // CHECK: call <4 x i32> @vec_unpackl(short vector[8])
347 // CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])
348 // CHECK: call <4 x i32> @vec_splats(unsigned int)(i32 noundef zeroext 14)
349 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
350 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
351 // CHECK: call <4 x i32> @vec_splats(int)(i32 noundef signext 1)
352 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
353 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
354 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
355 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
356 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_pack(int vector[4], int vector[4])
358 // CHECK-LABEL: define available_externally i64 @_mm_mulhrs_pi16
359 // CHECK: call <4 x i32> @vec_unpackh(short vector[8])
360 // CHECK: call <4 x i32> @vec_unpackh(short vector[8])
361 // CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])
362 // CHECK: call <4 x i32> @vec_splats(unsigned int)(i32 noundef zeroext 14)
363 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
364 // CHECK: call <4 x i32> @vec_splats(int)(i32 noundef signext 1)
365 // CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])
366 // CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])
367 // CHECK: call <8 x i16> @vec_pack(int vector[4], int vector[4])
368 // CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>
369 // CHECK: extractelement <2 x i64> %[[CAST]], i32 0