Debian Codegraph @

clang/test/CodeGen/X86/avx-shuffle-builtins.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // REQUIRES: x86-registered-target
3 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-- -target-feature +avx -disable-O0-optnone -emit-llvm -o - | opt -S -passes=mem2reg | FileCheck %s
4 // RUN: %clang_cc1 -ffreestanding %s -triple=i386-- -target-feature +avx -disable-O0-optnone -emit-llvm -o - | opt -S -passes=mem2reg | FileCheck %s
5
6
7 #include <immintrin.h>
8
9 //
10 // Test LLVM IR codegen of shuffle instructions, checking if the masks are correct
11 //
12
13 // CHECK-LABEL: define dso_local <8 x float> @x(
14 // CHECK-SAME: <8 x float> noundef [[A:%.*]], <8 x float> noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] {
15 // CHECK-NEXT: [[ENTRY:.*:]]
16 // CHECK-NEXT: [[SHUFP:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <8 x i32> <i32 3, i32 2, i32 8, i32 11, i32 7, i32 6, i32 12, i32 15>
17 // CHECK-NEXT: ret <8 x float> [[SHUFP]]
18 //
19 __m256 x(__m256 a, __m256 b) {
20 return _mm256_shuffle_ps(a, b, 203);
21 }
22
23 // CHECK-LABEL: define dso_local <2 x double> @test_mm_permute_pd(
24 // CHECK-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR1:[0-9]+]] {
25 // CHECK-NEXT: [[ENTRY:.*:]]
26 // CHECK-NEXT: [[PERMIL:%.*]] = shufflevector <2 x double> [[A]], <2 x double> poison, <2 x i32> <i32 1, i32 0>
27 // CHECK-NEXT: ret <2 x double> [[PERMIL]]
28 //
29 __m128d test_mm_permute_pd(__m128d a) {
30 return _mm_permute_pd(a, 1);
31 }
32
33 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_permute_pd(
34 // CHECK-SAME: <4 x double> noundef [[A:%.*]]) #[[ATTR0]] {
35 // CHECK-NEXT: [[ENTRY:.*:]]
36 // CHECK-NEXT: [[PERMIL:%.*]] = shufflevector <4 x double> [[A]], <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
37 // CHECK-NEXT: ret <4 x double> [[PERMIL]]
38 //
39 __m256d test_mm256_permute_pd(__m256d a) {
40 return _mm256_permute_pd(a, 5);
41 }
42
43 // CHECK-LABEL: define dso_local <4 x float> @test_mm_permute_ps(
44 // CHECK-SAME: <4 x float> noundef [[A:%.*]]) #[[ATTR1]] {
45 // CHECK-NEXT: [[ENTRY:.*:]]
46 // CHECK-NEXT: [[PERMIL:%.*]] = shufflevector <4 x float> [[A]], <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
47 // CHECK-NEXT: ret <4 x float> [[PERMIL]]
48 //
49 __m128 test_mm_permute_ps(__m128 a) {
50 return _mm_permute_ps(a, 0x1b);
51 }
52
53 // CHECK-LABEL: define dso_local <4 x float> @test_mm_permute_ps2(
54 // CHECK-SAME: <4 x float> noundef [[A:%.*]]) #[[ATTR1]] {
55 // CHECK-NEXT: [[ENTRY:.*:]]
56 // CHECK-NEXT: [[PERMIL:%.*]] = shufflevector <4 x float> [[A]], <4 x float> poison, <4 x i32> <i32 2, i32 1, i32 2, i32 3>
57 // CHECK-NEXT: ret <4 x float> [[PERMIL]]
58 //
59 __m128 test_mm_permute_ps2(__m128 a) {
60 return _mm_permute_ps(a, 0xe6);
61 }
62
63 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_permute_ps(
64 // CHECK-SAME: <8 x float> noundef [[A:%.*]]) #[[ATTR0]] {
65 // CHECK-NEXT: [[ENTRY:.*:]]
66 // CHECK-NEXT: [[PERMIL:%.*]] = shufflevector <8 x float> [[A]], <8 x float> poison, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
67 // CHECK-NEXT: ret <8 x float> [[PERMIL]]
68 //
69 __m256 test_mm256_permute_ps(__m256 a) {
70 return _mm256_permute_ps(a, 0x1b);
71 }
72
73 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_permute2f128_pd(
74 // CHECK-SAME: <4 x double> noundef [[A:%.*]], <4 x double> noundef [[B:%.*]]) #[[ATTR0]] {
75 // CHECK-NEXT: [[ENTRY:.*:]]
76 // CHECK-NEXT: [[VPERM:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <4 x i32> <i32 2, i32 3, i32 6, i32 7>
77 // CHECK-NEXT: ret <4 x double> [[VPERM]]
78 //
79 __m256d test_mm256_permute2f128_pd(__m256d a, __m256d b) {
80 return _mm256_permute2f128_pd(a, b, 0x31);
81 }
82
83 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_permute2f128_ps(
84 // CHECK-SAME: <8 x float> noundef [[A:%.*]], <8 x float> noundef [[B:%.*]]) #[[ATTR0]] {
85 // CHECK-NEXT: [[ENTRY:.*:]]
86 // CHECK-NEXT: [[VPERM:%.*]] = shufflevector <8 x float> [[B]], <8 x float> [[A]], <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 12, i32 13, i32 14, i32 15>
87 // CHECK-NEXT: ret <8 x float> [[VPERM]]
88 //
89 __m256 test_mm256_permute2f128_ps(__m256 a, __m256 b) {
90 return _mm256_permute2f128_ps(a, b, 0x13);
91 }
92
93 // CHECK-LABEL: define dso_local <4 x i64> @test_mm256_permute2f128_si256(
94 // CHECK-SAME: <4 x i64> noundef [[A:%.*]], <4 x i64> noundef [[B:%.*]]) #[[ATTR0]] {
95 // CHECK-NEXT: [[ENTRY:.*:]]
96 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
97 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i64> [[B]] to <8 x i32>
98 // CHECK-NEXT: [[VPERM:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> [[TMP1]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
99 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i32> [[VPERM]] to <4 x i64>
100 // CHECK-NEXT: ret <4 x i64> [[TMP2]]
101 //
102 __m256i test_mm256_permute2f128_si256(__m256i a, __m256i b) {
103 return _mm256_permute2f128_si256(a, b, 0x20);
104 }
105
106 // CHECK-LABEL: define dso_local <4 x float> @test_mm_broadcast_ss(
107 // CHECK-SAME: ptr noundef [[__A:%.*]]) #[[ATTR1]] {
108 // CHECK-NEXT: [[ENTRY:.*:]]
109 // CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__A]], align 1
110 // CHECK-NEXT: [[VECINIT_I:%.*]] = insertelement <4 x float> poison, float [[TMP0]], i32 0
111 // CHECK-NEXT: [[VECINIT2_I:%.*]] = insertelement <4 x float> [[VECINIT_I]], float [[TMP0]], i32 1
112 // CHECK-NEXT: [[VECINIT3_I:%.*]] = insertelement <4 x float> [[VECINIT2_I]], float [[TMP0]], i32 2
113 // CHECK-NEXT: [[VECINIT4_I:%.*]] = insertelement <4 x float> [[VECINIT3_I]], float [[TMP0]], i32 3
114 // CHECK-NEXT: ret <4 x float> [[VECINIT4_I]]
115 //
116 __m128 test_mm_broadcast_ss(float const *__a) {
117 return _mm_broadcast_ss(__a);
118 }
119
120 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_broadcast_sd(
121 // CHECK-SAME: ptr noundef [[__A:%.*]]) #[[ATTR0]] {
122 // CHECK-NEXT: [[ENTRY:.*:]]
123 // CHECK-NEXT: [[TMP0:%.*]] = load double, ptr [[__A]], align 1
124 // CHECK-NEXT: [[VECINIT_I:%.*]] = insertelement <4 x double> poison, double [[TMP0]], i32 0
125 // CHECK-NEXT: [[VECINIT2_I:%.*]] = insertelement <4 x double> [[VECINIT_I]], double [[TMP0]], i32 1
126 // CHECK-NEXT: [[VECINIT3_I:%.*]] = insertelement <4 x double> [[VECINIT2_I]], double [[TMP0]], i32 2
127 // CHECK-NEXT: [[VECINIT4_I:%.*]] = insertelement <4 x double> [[VECINIT3_I]], double [[TMP0]], i32 3
128 // CHECK-NEXT: ret <4 x double> [[VECINIT4_I]]
129 //
130 __m256d test_mm256_broadcast_sd(double const *__a) {
131 return _mm256_broadcast_sd(__a);
132 }
133
134 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_broadcast_ss(
135 // CHECK-SAME: ptr noundef [[__A:%.*]]) #[[ATTR0]] {
136 // CHECK-NEXT: [[ENTRY:.*:]]
137 // CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__A]], align 1
138 // CHECK-NEXT: [[VECINIT_I:%.*]] = insertelement <8 x float> poison, float [[TMP0]], i32 0
139 // CHECK-NEXT: [[VECINIT2_I:%.*]] = insertelement <8 x float> [[VECINIT_I]], float [[TMP0]], i32 1
140 // CHECK-NEXT: [[VECINIT3_I:%.*]] = insertelement <8 x float> [[VECINIT2_I]], float [[TMP0]], i32 2
141 // CHECK-NEXT: [[VECINIT4_I:%.*]] = insertelement <8 x float> [[VECINIT3_I]], float [[TMP0]], i32 3
142 // CHECK-NEXT: [[VECINIT5_I:%.*]] = insertelement <8 x float> [[VECINIT4_I]], float [[TMP0]], i32 4
143 // CHECK-NEXT: [[VECINIT6_I:%.*]] = insertelement <8 x float> [[VECINIT5_I]], float [[TMP0]], i32 5
144 // CHECK-NEXT: [[VECINIT7_I:%.*]] = insertelement <8 x float> [[VECINIT6_I]], float [[TMP0]], i32 6
145 // CHECK-NEXT: [[VECINIT8_I:%.*]] = insertelement <8 x float> [[VECINIT7_I]], float [[TMP0]], i32 7
146 // CHECK-NEXT: ret <8 x float> [[VECINIT8_I]]
147 //
148 __m256 test_mm256_broadcast_ss(float const *__a) {
149 return _mm256_broadcast_ss(__a);
150 }
151
152 // Make sure we have the correct mask for each insertf128 case.
153
154 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_insertf128_ps_0(
155 // CHECK-SAME: <8 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) #[[ATTR0]] {
156 // CHECK-NEXT: [[ENTRY:.*:]]
157 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <4 x float> [[B]], <4 x float> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
158 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[WIDEN]], <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7>
159 // CHECK-NEXT: ret <8 x float> [[INSERT]]
160 //
161 __m256 test_mm256_insertf128_ps_0(__m256 a, __m128 b) {
162 return _mm256_insertf128_ps(a, b, 0);
163 }
164
165 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_insertf128_pd_0(
166 // CHECK-SAME: <4 x double> noundef [[A:%.*]], <2 x double> noundef [[B:%.*]]) #[[ATTR0]] {
167 // CHECK-NEXT: [[ENTRY:.*:]]
168 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <2 x double> [[B]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
169 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[WIDEN]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
170 // CHECK-NEXT: ret <4 x double> [[INSERT]]
171 //
172 __m256d test_mm256_insertf128_pd_0(__m256d a, __m128d b) {
173 return _mm256_insertf128_pd(a, b, 0);
174 }
175
176 // CHECK-LABEL: define dso_local <4 x i64> @test_mm256_insertf128_si256_0(
177 // CHECK-SAME: <4 x i64> noundef [[A:%.*]], <2 x i64> noundef [[B:%.*]]) #[[ATTR0]] {
178 // CHECK-NEXT: [[ENTRY:.*:]]
179 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
180 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[B]] to <4 x i32>
181 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
182 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> [[WIDEN]], <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7>
183 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i32> [[INSERT]] to <4 x i64>
184 // CHECK-NEXT: ret <4 x i64> [[TMP2]]
185 //
186 __m256i test_mm256_insertf128_si256_0(__m256i a, __m128i b) {
187 return _mm256_insertf128_si256(a, b, 0);
188 }
189
190 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_insertf128_ps_1(
191 // CHECK-SAME: <8 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) #[[ATTR0]] {
192 // CHECK-NEXT: [[ENTRY:.*:]]
193 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <4 x float> [[B]], <4 x float> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
194 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[WIDEN]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
195 // CHECK-NEXT: ret <8 x float> [[INSERT]]
196 //
197 __m256 test_mm256_insertf128_ps_1(__m256 a, __m128 b) {
198 return _mm256_insertf128_ps(a, b, 1);
199 }
200
201 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_insertf128_pd_1(
202 // CHECK-SAME: <4 x double> noundef [[A:%.*]], <2 x double> noundef [[B:%.*]]) #[[ATTR0]] {
203 // CHECK-NEXT: [[ENTRY:.*:]]
204 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <2 x double> [[B]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
205 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[WIDEN]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
206 // CHECK-NEXT: ret <4 x double> [[INSERT]]
207 //
208 __m256d test_mm256_insertf128_pd_1(__m256d a, __m128d b) {
209 return _mm256_insertf128_pd(a, b, 1);
210 }
211
212 // CHECK-LABEL: define dso_local <4 x i64> @test_mm256_insertf128_si256_1(
213 // CHECK-SAME: <4 x i64> noundef [[A:%.*]], <2 x i64> noundef [[B:%.*]]) #[[ATTR0]] {
214 // CHECK-NEXT: [[ENTRY:.*:]]
215 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
216 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[B]] to <4 x i32>
217 // CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
218 // CHECK-NEXT: [[INSERT:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> [[WIDEN]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
219 // CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i32> [[INSERT]] to <4 x i64>
220 // CHECK-NEXT: ret <4 x i64> [[TMP2]]
221 //
222 __m256i test_mm256_insertf128_si256_1(__m256i a, __m128i b) {
223 return _mm256_insertf128_si256(a, b, 1);
224 }
225
226 // Make sure we have the correct mask for each extractf128 case.
227
228 // CHECK-LABEL: define dso_local <4 x float> @test_mm256_extractf128_ps_0(
229 // CHECK-SAME: <8 x float> noundef [[A:%.*]]) #[[ATTR0]] {
230 // CHECK-NEXT: [[ENTRY:.*:]]
231 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <8 x float> [[A]], <8 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
232 // CHECK-NEXT: ret <4 x float> [[EXTRACT]]
233 //
234 __m128 test_mm256_extractf128_ps_0(__m256 a) {
235 return _mm256_extractf128_ps(a, 0);
236 }
237
238 // CHECK-LABEL: define dso_local <2 x double> @test_mm256_extractf128_pd_0(
239 // CHECK-SAME: <4 x double> noundef [[A:%.*]]) #[[ATTR0]] {
240 // CHECK-NEXT: [[ENTRY:.*:]]
241 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <4 x double> [[A]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
242 // CHECK-NEXT: ret <2 x double> [[EXTRACT]]
243 //
244 __m128d test_mm256_extractf128_pd_0(__m256d a) {
245 return _mm256_extractf128_pd(a, 0);
246 }
247
248 // CHECK-LABEL: define dso_local <2 x i64> @test_mm256_extractf128_si256_0(
249 // CHECK-SAME: <4 x i64> noundef [[A:%.*]]) #[[ATTR0]] {
250 // CHECK-NEXT: [[ENTRY:.*:]]
251 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
252 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
253 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[EXTRACT]] to <2 x i64>
254 // CHECK-NEXT: ret <2 x i64> [[TMP1]]
255 //
256 __m128i test_mm256_extractf128_si256_0(__m256i a) {
257 return _mm256_extractf128_si256(a, 0);
258 }
259
260 // CHECK-LABEL: define dso_local <4 x float> @test_mm256_extractf128_ps_1(
261 // CHECK-SAME: <8 x float> noundef [[A:%.*]]) #[[ATTR0]] {
262 // CHECK-NEXT: [[ENTRY:.*:]]
263 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <8 x float> [[A]], <8 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
264 // CHECK-NEXT: ret <4 x float> [[EXTRACT]]
265 //
266 __m128 test_mm256_extractf128_ps_1(__m256 a) {
267 return _mm256_extractf128_ps(a, 1);
268 }
269
270 // CHECK-LABEL: define dso_local <2 x double> @test_mm256_extractf128_pd_1(
271 // CHECK-SAME: <4 x double> noundef [[A:%.*]]) #[[ATTR0]] {
272 // CHECK-NEXT: [[ENTRY:.*:]]
273 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <4 x double> [[A]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
274 // CHECK-NEXT: ret <2 x double> [[EXTRACT]]
275 //
276 __m128d test_mm256_extractf128_pd_1(__m256d a) {
277 return _mm256_extractf128_pd(a, 1);
278 }
279
280 // CHECK-LABEL: define dso_local <2 x i64> @test_mm256_extractf128_si256_1(
281 // CHECK-SAME: <4 x i64> noundef [[A:%.*]]) #[[ATTR0]] {
282 // CHECK-NEXT: [[ENTRY:.*:]]
283 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
284 // CHECK-NEXT: [[EXTRACT:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
285 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[EXTRACT]] to <2 x i64>
286 // CHECK-NEXT: ret <2 x i64> [[TMP1]]
287 //
288 __m128i test_mm256_extractf128_si256_1(__m256i a) {
289 return _mm256_extractf128_si256(a, 1);
290 }
291
292 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_set_m128(
293 // CHECK-SAME: <4 x float> noundef [[HI:%.*]], <4 x float> noundef [[LO:%.*]]) #[[ATTR0]] {
294 // CHECK-NEXT: [[ENTRY:.*:]]
295 // CHECK-NEXT: [[SHUFFLE_I:%.*]] = shufflevector <4 x float> [[LO]], <4 x float> [[HI]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
296 // CHECK-NEXT: ret <8 x float> [[SHUFFLE_I]]
297 //
298 __m256 test_mm256_set_m128(__m128 hi, __m128 lo) {
299 return _mm256_set_m128(hi, lo);
300 }
301
302 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_set_m128d(
303 // CHECK-SAME: <2 x double> noundef [[HI:%.*]], <2 x double> noundef [[LO:%.*]]) #[[ATTR0]] {
304 // CHECK-NEXT: [[ENTRY:.*:]]
305 // CHECK-NEXT: [[SHUFFLE_I:%.*]] = shufflevector <2 x double> [[LO]], <2 x double> [[HI]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
306 // CHECK-NEXT: ret <4 x double> [[SHUFFLE_I]]
307 //
308 __m256d test_mm256_set_m128d(__m128d hi, __m128d lo) {
309 return _mm256_set_m128d(hi, lo);
310 }
311
312 // CHECK-LABEL: define dso_local <4 x i64> @test_mm256_set_m128i(
313 // CHECK-SAME: <2 x i64> noundef [[HI:%.*]], <2 x i64> noundef [[LO:%.*]]) #[[ATTR0]] {
314 // CHECK-NEXT: [[ENTRY:.*:]]
315 // CHECK-NEXT: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> [[LO]], <2 x i64> [[HI]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
316 // CHECK-NEXT: ret <4 x i64> [[SHUFFLE_I]]
317 //
318 __m256i test_mm256_set_m128i(__m128i hi, __m128i lo) {
319 return _mm256_set_m128i(hi, lo);
320 }
321
322 // CHECK-LABEL: define dso_local <8 x float> @test_mm256_setr_m128(
323 // CHECK-SAME: <4 x float> noundef [[HI:%.*]], <4 x float> noundef [[LO:%.*]]) #[[ATTR0]] {
324 // CHECK-NEXT: [[ENTRY:.*:]]
325 // CHECK-NEXT: [[SHUFFLE_I_I:%.*]] = shufflevector <4 x float> [[LO]], <4 x float> [[HI]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
326 // CHECK-NEXT: ret <8 x float> [[SHUFFLE_I_I]]
327 //
328 __m256 test_mm256_setr_m128(__m128 hi, __m128 lo) {
329 return _mm256_setr_m128(lo, hi);
330 }
331
332 // CHECK-LABEL: define dso_local <4 x double> @test_mm256_setr_m128d(
333 // CHECK-SAME: <2 x double> noundef [[HI:%.*]], <2 x double> noundef [[LO:%.*]]) #[[ATTR0]] {
334 // CHECK-NEXT: [[ENTRY:.*:]]
335 // CHECK-NEXT: [[SHUFFLE_I_I:%.*]] = shufflevector <2 x double> [[LO]], <2 x double> [[HI]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
336 // CHECK-NEXT: ret <4 x double> [[SHUFFLE_I_I]]
337 //
338 __m256d test_mm256_setr_m128d(__m128d hi, __m128d lo) {
339 return _mm256_setr_m128d(lo, hi);
340 }
341
342 // CHECK-LABEL: define dso_local <4 x i64> @test_mm256_setr_m128i(
343 // CHECK-SAME: <2 x i64> noundef [[HI:%.*]], <2 x i64> noundef [[LO:%.*]]) #[[ATTR0]] {
344 // CHECK-NEXT: [[ENTRY:.*:]]
345 // CHECK-NEXT: [[SHUFFLE_I_I:%.*]] = shufflevector <2 x i64> [[LO]], <2 x i64> [[HI]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
346 // CHECK-NEXT: ret <4 x i64> [[SHUFFLE_I_I]]
347 //
348 __m256i test_mm256_setr_m128i(__m128i hi, __m128i lo) {
349 return _mm256_setr_m128i(lo, hi);
350 }