1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=SSE2 | FileCheck %s --check-prefixes=CHECK,SSE
3 ; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=AVX2 | FileCheck %s --check-prefixes=CHECK,AVX
5 ; x86 does not have a cheap v16i8 shuffle until SSSE3 (pshufb)
7 define <16 x i8> @bitcast_shuf_narrow_element(<4 x i32> %v) {
8 ; SSE-LABEL: @bitcast_shuf_narrow_element(
9 ; SSE-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[V:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
10 ; SSE-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to <16 x i8>
11 ; SSE-NEXT: ret <16 x i8> [[R]]
13 ; AVX-LABEL: @bitcast_shuf_narrow_element(
14 ; AVX-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V:%.*]] to <16 x i8>
15 ; AVX-NEXT: [[R:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> poison, <16 x i32> <i32 12, i32 13, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>
16 ; AVX-NEXT: ret <16 x i8> [[R]]
18 %shuf = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
19 %r = bitcast <4 x i32> %shuf to <16 x i8>
23 ; v4f32 is the same cost as v4i32, so this always works
25 define <4 x float> @bitcast_shuf_same_size(<4 x i32> %v) {
26 ; CHECK-LABEL: @bitcast_shuf_same_size(
27 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V:%.*]] to <4 x float>
28 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
29 ; CHECK-NEXT: ret <4 x float> [[R]]
31 %shuf = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
32 %r = bitcast <4 x i32> %shuf to <4 x float>
36 ; Negative test - length-changing shuffle
38 define <16 x i8> @bitcast_shuf_narrow_element_wrong_size(<2 x i32> %v) {
39 ; CHECK-LABEL: @bitcast_shuf_narrow_element_wrong_size(
40 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <2 x i32> [[V:%.*]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
41 ; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to <16 x i8>
42 ; CHECK-NEXT: ret <16 x i8> [[R]]
44 %shuf = shufflevector <2 x i32> %v, <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
45 %r = bitcast <4 x i32> %shuf to <16 x i8>
49 ; Negative test - must cast to vector type
51 define i128 @bitcast_shuf_narrow_element_wrong_type(<4 x i32> %v) {
52 ; CHECK-LABEL: @bitcast_shuf_narrow_element_wrong_type(
53 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[V:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
54 ; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to i128
55 ; CHECK-NEXT: ret i128 [[R]]
57 %shuf = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
58 %r = bitcast <4 x i32> %shuf to i128
62 ; Widen shuffle elements
64 define <4 x i32> @bitcast_shuf_wide_element(<8 x i16> %v) {
65 ; CHECK-LABEL: @bitcast_shuf_wide_element(
66 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[V:%.*]] to <4 x i32>
67 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
68 ; CHECK-NEXT: ret <4 x i32> [[R]]
70 %shuf = shufflevector <8 x i16> %v, <8 x i16> poison, <8 x i32> <i32 0, i32 1, i32 0, i32 1, i32 2, i32 3, i32 2, i32 3>
71 %r = bitcast <8 x i16> %shuf to <4 x i32>
75 declare void @use(<4 x i32>)
77 ; Negative test - don't create an extra shuffle
79 define <16 x i8> @bitcast_shuf_uses(<4 x i32> %v) {
80 ; CHECK-LABEL: @bitcast_shuf_uses(
81 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[V:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
82 ; CHECK-NEXT: call void @use(<4 x i32> [[SHUF]])
83 ; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to <16 x i8>
84 ; CHECK-NEXT: ret <16 x i8> [[R]]
86 %shuf = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
87 call void @use(<4 x i32> %shuf)
88 %r = bitcast <4 x i32> %shuf to <16 x i8>
92 define <2 x i64> @PR35454_1(<2 x i64> %v) {
93 ; SSE-LABEL: @PR35454_1(
94 ; SSE-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[V:%.*]] to <4 x i32>
95 ; SSE-NEXT: [[PERMIL:%.*]] = shufflevector <4 x i32> [[BC]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
96 ; SSE-NEXT: [[BC1:%.*]] = bitcast <4 x i32> [[PERMIL]] to <16 x i8>
97 ; SSE-NEXT: [[ADD:%.*]] = shl <16 x i8> [[BC1]], <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
98 ; SSE-NEXT: [[BC2:%.*]] = bitcast <16 x i8> [[ADD]] to <4 x i32>
99 ; SSE-NEXT: [[PERMIL1:%.*]] = shufflevector <4 x i32> [[BC2]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
100 ; SSE-NEXT: [[BC3:%.*]] = bitcast <4 x i32> [[PERMIL1]] to <2 x i64>
101 ; SSE-NEXT: ret <2 x i64> [[BC3]]
103 ; AVX-LABEL: @PR35454_1(
104 ; AVX-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[V:%.*]] to <4 x i32>
105 ; AVX-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[BC]] to <16 x i8>
106 ; AVX-NEXT: [[BC1:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> poison, <16 x i32> <i32 12, i32 13, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>
107 ; AVX-NEXT: [[ADD:%.*]] = shl <16 x i8> [[BC1]], <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
108 ; AVX-NEXT: [[BC2:%.*]] = bitcast <16 x i8> [[ADD]] to <4 x i32>
109 ; AVX-NEXT: [[PERMIL1:%.*]] = shufflevector <4 x i32> [[BC2]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
110 ; AVX-NEXT: [[BC3:%.*]] = bitcast <4 x i32> [[PERMIL1]] to <2 x i64>
111 ; AVX-NEXT: ret <2 x i64> [[BC3]]
113 %bc = bitcast <2 x i64> %v to <4 x i32>
114 %permil = shufflevector <4 x i32> %bc, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
115 %bc1 = bitcast <4 x i32> %permil to <16 x i8>
116 %add = shl <16 x i8> %bc1, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
117 %bc2 = bitcast <16 x i8> %add to <4 x i32>
118 %permil1 = shufflevector <4 x i32> %bc2, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
119 %bc3 = bitcast <4 x i32> %permil1 to <2 x i64>
123 define <2 x i64> @PR35454_2(<2 x i64> %v) {
124 ; SSE-LABEL: @PR35454_2(
125 ; SSE-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[V:%.*]] to <4 x i32>
126 ; SSE-NEXT: [[PERMIL:%.*]] = shufflevector <4 x i32> [[BC]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
127 ; SSE-NEXT: [[BC1:%.*]] = bitcast <4 x i32> [[PERMIL]] to <8 x i16>
128 ; SSE-NEXT: [[ADD:%.*]] = shl <8 x i16> [[BC1]], <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
129 ; SSE-NEXT: [[BC2:%.*]] = bitcast <8 x i16> [[ADD]] to <4 x i32>
130 ; SSE-NEXT: [[PERMIL1:%.*]] = shufflevector <4 x i32> [[BC2]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
131 ; SSE-NEXT: [[BC3:%.*]] = bitcast <4 x i32> [[PERMIL1]] to <2 x i64>
132 ; SSE-NEXT: ret <2 x i64> [[BC3]]
134 ; AVX-LABEL: @PR35454_2(
135 ; AVX-NEXT: [[BC:%.*]] = bitcast <2 x i64> [[V:%.*]] to <4 x i32>
136 ; AVX-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[BC]] to <8 x i16>
137 ; AVX-NEXT: [[BC1:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> poison, <8 x i32> <i32 6, i32 7, i32 4, i32 5, i32 2, i32 3, i32 0, i32 1>
138 ; AVX-NEXT: [[ADD:%.*]] = shl <8 x i16> [[BC1]], <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
139 ; AVX-NEXT: [[BC2:%.*]] = bitcast <8 x i16> [[ADD]] to <4 x i32>
140 ; AVX-NEXT: [[PERMIL1:%.*]] = shufflevector <4 x i32> [[BC2]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
141 ; AVX-NEXT: [[BC3:%.*]] = bitcast <4 x i32> [[PERMIL1]] to <2 x i64>
142 ; AVX-NEXT: ret <2 x i64> [[BC3]]
144 %bc = bitcast <2 x i64> %v to <4 x i32>
145 %permil = shufflevector <4 x i32> %bc, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
146 %bc1 = bitcast <4 x i32> %permil to <8 x i16>
147 %add = shl <8 x i16> %bc1, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
148 %bc2 = bitcast <8 x i16> %add to <4 x i32>
149 %permil1 = shufflevector <4 x i32> %bc2, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
150 %bc3 = bitcast <4 x i32> %permil1 to <2 x i64>
154 ; Shuffle is much cheaper than fdiv. FMF are intersected.
156 define <4 x float> @shuf_fdiv_v4f32_yy(<4 x float> %x, <4 x float> %y, <4 x float> %z) {
157 ; CHECK-LABEL: @shuf_fdiv_v4f32_yy(
158 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[X:%.*]], <4 x float> [[Z:%.*]], <4 x i32> <i32 1, i32 3, i32 5, i32 7>
159 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> poison, <4 x i32> <i32 1, i32 3, i32 1, i32 3>
160 ; CHECK-NEXT: [[R:%.*]] = fdiv arcp <4 x float> [[TMP1]], [[TMP2]]
161 ; CHECK-NEXT: ret <4 x float> [[R]]
163 %b0 = fdiv fast <4 x float> %x, %y
164 %b1 = fdiv arcp <4 x float> %z, %y
165 %r = shufflevector <4 x float> %b0, <4 x float> %b1, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
169 ; Common operand is op0 of the binops.
171 define <4 x i32> @shuf_add_v4i32_xx(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
172 ; CHECK-LABEL: @shuf_add_v4i32_xx(
173 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 poison, i32 poison, i32 2, i32 0>
174 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[Y:%.*]], <4 x i32> [[Z:%.*]], <4 x i32> <i32 poison, i32 poison, i32 6, i32 0>
175 ; CHECK-NEXT: [[R:%.*]] = add <4 x i32> [[TMP1]], [[TMP2]]
176 ; CHECK-NEXT: ret <4 x i32> [[R]]
178 %b0 = add <4 x i32> %x, %y
179 %b1 = add <4 x i32> %x, %z
180 %r = shufflevector <4 x i32> %b0, <4 x i32> %b1, <4 x i32> <i32 poison, i32 poison, i32 6, i32 0>
184 ; For commutative instructions, common operand may be swapped.
186 define <4 x float> @shuf_fmul_v4f32_xx_swap(<4 x float> %x, <4 x float> %y, <4 x float> %z) {
187 ; CHECK-LABEL: @shuf_fmul_v4f32_xx_swap(
188 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[Z:%.*]], <4 x i32> <i32 0, i32 3, i32 4, i32 7>
189 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[X:%.*]], <4 x float> poison, <4 x i32> <i32 0, i32 3, i32 0, i32 3>
190 ; CHECK-NEXT: [[R:%.*]] = fmul <4 x float> [[TMP1]], [[TMP2]]
191 ; CHECK-NEXT: ret <4 x float> [[R]]
193 %b0 = fmul <4 x float> %x, %y
194 %b1 = fmul <4 x float> %z, %x
195 %r = shufflevector <4 x float> %b0, <4 x float> %b1, <4 x i32> <i32 0, i32 3, i32 4, i32 7>
199 ; For commutative instructions, common operand may be swapped.
201 define <2 x i64> @shuf_and_v2i64_yy_swap(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
202 ; CHECK-LABEL: @shuf_and_v2i64_yy_swap(
203 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i64> [[Y:%.*]], <2 x i64> poison, <2 x i32> <i32 1, i32 0>
204 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i64> [[X:%.*]], <2 x i64> [[Z:%.*]], <2 x i32> <i32 3, i32 0>
205 ; CHECK-NEXT: [[R:%.*]] = and <2 x i64> [[TMP1]], [[TMP2]]
206 ; CHECK-NEXT: ret <2 x i64> [[R]]
208 %b0 = and <2 x i64> %x, %y
209 %b1 = and <2 x i64> %y, %z
210 %r = shufflevector <2 x i64> %b0, <2 x i64> %b1, <2 x i32> <i32 3, i32 0>
214 ; non-commutative binop, but common op0
216 define <4 x i32> @shuf_shl_v4i32_xx(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
217 ; CHECK-LABEL: @shuf_shl_v4i32_xx(
218 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 1, i32 1, i32 2>
219 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[Y:%.*]], <4 x i32> [[Z:%.*]], <4 x i32> <i32 3, i32 1, i32 1, i32 6>
220 ; CHECK-NEXT: [[R:%.*]] = shl <4 x i32> [[TMP1]], [[TMP2]]
221 ; CHECK-NEXT: ret <4 x i32> [[R]]
223 %b0 = shl <4 x i32> %x, %y
224 %b1 = shl <4 x i32> %x, %z
225 %r = shufflevector <4 x i32> %b0, <4 x i32> %b1, <4 x i32> <i32 3, i32 1, i32 1, i32 6>
229 ; negative test - common operand, but not commutable
231 define <4 x i32> @shuf_shl_v4i32_xx_swap(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
232 ; CHECK-LABEL: @shuf_shl_v4i32_xx_swap(
233 ; CHECK-NEXT: [[B0:%.*]] = shl <4 x i32> [[X:%.*]], [[Y:%.*]]
234 ; CHECK-NEXT: [[B1:%.*]] = shl <4 x i32> [[Z:%.*]], [[X]]
235 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[B0]], <4 x i32> [[B1]], <4 x i32> <i32 3, i32 2, i32 2, i32 5>
236 ; CHECK-NEXT: ret <4 x i32> [[R]]
238 %b0 = shl <4 x i32> %x, %y
239 %b1 = shl <4 x i32> %z, %x
240 %r = shufflevector <4 x i32> %b0, <4 x i32> %b1, <4 x i32> <i32 3, i32 2, i32 2, i32 5>
244 ; negative test - mismatched opcodes
246 define <2 x i64> @shuf_sub_add_v2i64_yy(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
247 ; CHECK-LABEL: @shuf_sub_add_v2i64_yy(
248 ; CHECK-NEXT: [[B0:%.*]] = sub <2 x i64> [[X:%.*]], [[Y:%.*]]
249 ; CHECK-NEXT: [[B1:%.*]] = add <2 x i64> [[Z:%.*]], [[Y]]
250 ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i64> [[B0]], <2 x i64> [[B1]], <2 x i32> <i32 3, i32 0>
251 ; CHECK-NEXT: ret <2 x i64> [[R]]
253 %b0 = sub <2 x i64> %x, %y
254 %b1 = add <2 x i64> %z, %y
255 %r = shufflevector <2 x i64> %b0, <2 x i64> %b1, <2 x i32> <i32 3, i32 0>
259 ; negative test - type change via shuffle
261 define <8 x float> @shuf_fmul_v4f32_xx_type(<4 x float> %x, <4 x float> %y, <4 x float> %z) {
262 ; CHECK-LABEL: @shuf_fmul_v4f32_xx_type(
263 ; CHECK-NEXT: [[B0:%.*]] = fmul <4 x float> [[X:%.*]], [[Y:%.*]]
264 ; CHECK-NEXT: [[B1:%.*]] = fmul <4 x float> [[Z:%.*]], [[X]]
265 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[B0]], <4 x float> [[B1]], <8 x i32> <i32 0, i32 3, i32 4, i32 7, i32 0, i32 1, i32 1, i32 6>
266 ; CHECK-NEXT: ret <8 x float> [[R]]
268 %b0 = fmul <4 x float> %x, %y
269 %b1 = fmul <4 x float> %z, %x
270 %r = shufflevector <4 x float> %b0, <4 x float> %b1, <8 x i32> <i32 0, i32 3, i32 4, i32 7, i32 0, i32 1, i32 1, i32 6>
274 ; negative test - uses
276 define <4 x i32> @shuf_lshr_v4i32_yy_use1(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
277 ; CHECK-LABEL: @shuf_lshr_v4i32_yy_use1(
278 ; CHECK-NEXT: [[B0:%.*]] = lshr <4 x i32> [[X:%.*]], [[Y:%.*]]
279 ; CHECK-NEXT: call void @use(<4 x i32> [[B0]])
280 ; CHECK-NEXT: [[B1:%.*]] = lshr <4 x i32> [[Z:%.*]], [[Y]]
281 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[B0]], <4 x i32> [[B1]], <4 x i32> <i32 0, i32 2, i32 4, i32 6>
282 ; CHECK-NEXT: ret <4 x i32> [[R]]
284 %b0 = lshr <4 x i32> %x, %y
285 call void @use(<4 x i32> %b0)
286 %b1 = lshr <4 x i32> %z, %y
287 %r = shufflevector <4 x i32> %b0, <4 x i32> %b1, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
291 ; negative test - uses
293 define <4 x i32> @shuf_mul_v4i32_yy_use2(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
294 ; CHECK-LABEL: @shuf_mul_v4i32_yy_use2(
295 ; CHECK-NEXT: [[B0:%.*]] = mul <4 x i32> [[X:%.*]], [[Y:%.*]]
296 ; CHECK-NEXT: [[B1:%.*]] = mul <4 x i32> [[Z:%.*]], [[Y]]
297 ; CHECK-NEXT: call void @use(<4 x i32> [[B1]])
298 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[B0]], <4 x i32> [[B1]], <4 x i32> <i32 1, i32 3, i32 5, i32 7>
299 ; CHECK-NEXT: ret <4 x i32> [[R]]
301 %b0 = mul <4 x i32> %x, %y
302 %b1 = mul <4 x i32> %z, %y
303 call void @use(<4 x i32> %b1)
304 %r = shufflevector <4 x i32> %b0, <4 x i32> %b1, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
308 ; negative test - must have matching operand
310 define <4 x float> @shuf_fadd_v4f32_no_common_op(<4 x float> %x, <4 x float> %y, <4 x float> %z, <4 x float> %w) {
311 ; CHECK-LABEL: @shuf_fadd_v4f32_no_common_op(
312 ; CHECK-NEXT: [[B0:%.*]] = fadd <4 x float> [[X:%.*]], [[Y:%.*]]
313 ; CHECK-NEXT: [[B1:%.*]] = fadd <4 x float> [[Z:%.*]], [[W:%.*]]
314 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[B0]], <4 x float> [[B1]], <4 x i32> <i32 1, i32 3, i32 5, i32 7>
315 ; CHECK-NEXT: ret <4 x float> [[R]]
317 %b0 = fadd <4 x float> %x, %y
318 %b1 = fadd <4 x float> %z, %w
319 %r = shufflevector <4 x float> %b0, <4 x float> %b1, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
323 ; negative test - binops may be relatively cheap
325 define <16 x i16> @shuf_and_v16i16_yy_expensive_shuf(<16 x i16> %x, <16 x i16> %y, <16 x i16> %z) {
326 ; CHECK-LABEL: @shuf_and_v16i16_yy_expensive_shuf(
327 ; CHECK-NEXT: [[B0:%.*]] = and <16 x i16> [[X:%.*]], [[Y:%.*]]
328 ; CHECK-NEXT: [[B1:%.*]] = and <16 x i16> [[Y]], [[Z:%.*]]
329 ; CHECK-NEXT: [[R:%.*]] = shufflevector <16 x i16> [[B0]], <16 x i16> [[B1]], <16 x i32> <i32 15, i32 22, i32 25, i32 13, i32 28, i32 0, i32 poison, i32 3, i32 0, i32 30, i32 3, i32 7, i32 9, i32 19, i32 2, i32 22>
330 ; CHECK-NEXT: ret <16 x i16> [[R]]
332 %b0 = and <16 x i16> %x, %y
333 %b1 = and <16 x i16> %y, %z
334 %r = shufflevector <16 x i16> %b0, <16 x i16> %b1, <16 x i32> <i32 15, i32 22, i32 25, i32 13, i32 28, i32 0, i32 poison, i32 3, i32 0, i32 30, i32 3, i32 7, i32 9, i32 19, i32 2, i32 22>