Lines Matching full:4
4 define <4 x i32> @const_folding(<4 x i32> %x) {
6 ; CHECK-NEXT: ret <4 x i32> zeroinitializer
8 %shuf = shufflevector <4 x i32> %x, <4 x i32> zeroinitializer, <4 x i32> <i32 5, i32 4, i32 5, i32 4>
9 ret <4 x i32> %shuf
12 define <4 x i32> @const_folding1(<4 x i32> %x) {
14 ; CHECK-NEXT: ret <4 x i32> splat (i32 5)
16 %shuf = shufflevector <4 x i32> <i32 5, i32 4, i32 5, i32 4>, <4 x i32> %x, <4 x i32> zeroinitializer
17 ret <4 x i32> %shuf
20 define <4 x i32> @const_folding_negative(<3 x i32> %x) {
22 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <3 x i32> [[X:%.*]], <3 x i32> zeroinitializer, <4 x i32> <i32 2, i32 4, i32 5, i32 4>
23 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
25 %shuf = shufflevector <3 x i32> %x, <3 x i32> zeroinitializer, <4 x i32> <i32 2, i32 4, i32 5, i32 4>
26 ret <4 x i32> %shuf
29 define <4 x i32> @splat_operand(<4 x i32> %x) {
31 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
32 ; CHECK-NEXT: ret <4 x i32> [[SPLAT]]
34 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
35 %shuf = shufflevector <4 x i32> %splat, <4 x i32> undef, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
36 ret <4 x i32> %shuf
39 define <4 x i32> @splat_operand_poison(<4 x i32> %x) {
41 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
42 ; CHECK-NEXT: ret <4 x i32> [[SPLAT]]
44 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
45 %shuf = shufflevector <4 x i32> %splat, <4 x i32> poison, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
46 ret <4 x i32> %shuf
49 define <4 x i32> @splat_operand1(<4 x i32> %x, <4 x i32> %y) {
51 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> [[Y:%.*]], <4 x i32> zeroinitializer
52 ; CHECK-NEXT: ret <4 x i32> [[SPLAT]]
54 %splat = shufflevector <4 x i32> %x, <4 x i32> %y, <4 x i32> zeroinitializer
55 %shuf = shufflevector <4 x i32> %splat, <4 x i32> undef, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
56 ret <4 x i32> %shuf
59 define <4 x i32> @splat_operand2(<4 x i32> %x, <4 x i32> %y) {
61 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
62 ; CHECK-NEXT: ret <4 x i32> [[SPLAT]]
64 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
65 %shuf = shufflevector <4 x i32> %splat, <4 x i32> %y, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
66 ret <4 x i32> %shuf
69 define <4 x i32> @splat_operand3(<4 x i32> %x) {
71 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
72 ; CHECK-NEXT: ret <4 x i32> [[SPLAT]]
74 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
75 %shuf = shufflevector <4 x i32> zeroinitializer, <4 x i32> %splat, <4 x i32> <i32 7, i32 6, i32 5, i32 5>
76 ret <4 x i32> %shuf
79 define <8 x i32> @splat_operand_negative(<4 x i32> %x) {
81 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
82 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[SPLAT]], <4 x i32> undef, <8 x i32> <i32 0, i32 3, i32 2, i32 1, i32 poison, i32 poison, i32 poison, i32 poison>
85 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
86 %shuf = shufflevector <4 x i32> %splat, <4 x i32> undef, <8 x i32> <i32 0, i32 3, i32 2, i32 1, i32 undef, i32 undef, i32 undef, i32 undef>
90 define <4 x i32> @splat_operand_negative2(<4 x i32> %x, <4 x i32> %y) {
92 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
93 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[SPLAT]], <4 x i32> [[Y:%.*]], <4 x i32> <i32 0, i32 3, i32 4, i32 1>
94 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
96 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
97 %shuf = shufflevector <4 x i32> %splat, <4 x i32> %y, <4 x i32> <i32 0, i32 3, i32 4, i32 1>
98 ret <4 x i32> %shuf
101 define <4 x i32> @splat_operand_negative3(<4 x i32> %x, <4 x i32> %y) {
103 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer
104 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[Y:%.*]], <4 x i32> [[SPLAT]], <4 x i32> <i32 0, i32 3, i32 4, i32 1>
105 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
107 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer
108 %shuf = shufflevector <4 x i32> %y, <4 x i32> %splat, <4 x i32> <i32 0, i32 3, i32 4, i32 1>
109 ret <4 x i32> %shuf
112 define <4 x i32> @splat_operand_negative4(<4 x i32> %x) {
114 ; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> <i32 2, i32 poison, i32 2, i32 poison>
115 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[SPLAT]], <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 poison, i32 poison>
116 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
118 %splat = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 2, i32 undef>
119 %shuf = shufflevector <4 x i32> %splat, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>
120 ret <4 x i32> %shuf
123 define <4 x i32> @undef_mask(<4 x i32> %x) {
125 ; CHECK-NEXT: ret <4 x i32> poison
127 %shuf = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> undef
128 ret <4 x i32> %shuf
131 define <4 x i32> @undef_mask_1(<4 x i32> %x, <4 x i32> %y) {
133 ; CHECK-NEXT: ret <4 x i32> poison
135 %shuf = shufflevector <4 x i32> %x, <4 x i32> %y, <4 x i32> undef
136 ret <4 x i32> %shuf
139 define <4 x i32> @identity_mask_0(<4 x i32> %x) {
141 ; CHECK-NEXT: ret <4 x i32> [[X:%.*]]
143 %shuf = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
144 ret <4 x i32> %shuf
147 define <4 x i32> @identity_mask_1(<4 x i32> %x) {
149 ; CHECK-NEXT: ret <4 x i32> [[X:%.*]]
151 %shuf = shufflevector <4 x i32> undef, <4 x i32> %x, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
152 ret <4 x i32> %shuf
155 define <4 x i32> @pseudo_identity_mask(<4 x i32> %x) {
157 ; CHECK-NEXT: ret <4 x i32> [[X:%.*]]
159 %shuf = shufflevector <4 x i32> %x, <4 x i32> %x, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
160 ret <4 x i32> %shuf
163 define <4 x i32> @not_identity_mask(<4 x i32> %x) {
165 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> [[X]], <4 x i32> <i32 0, i32 1, i32 2, i32 6>
166 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
168 %shuf = shufflevector <4 x i32> %x, <4 x i32> %x, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
169 ret <4 x i32> %shuf
174 define <4 x i32> @possible_identity_mask(<4 x i32> %x) {
176 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 poison>
177 ; CHECK-NEXT: ret <4 x i32> [[SHUF]]
179 %shuf = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef>
180 ret <4 x i32> %shuf
183 define <4 x i32> @const_operand(<4 x i32> %x) {
185 ; CHECK-NEXT: ret <4 x i32> <i32 42, i32 45, i32 44, i32 43>
187 %shuf = shufflevector <4 x i32> <i32 42, i32 43, i32 44, i32 45>, <4 x i32> %x, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
188 ret <4 x i32> %shuf
191 define <4 x i32> @merge(<4 x i32> %x) {
193 ; CHECK-NEXT: ret <4 x i32> [[X:%.*]]
195 %lower = shufflevector <4 x i32> %x, <4 x i32> undef, <2 x i32> <i32 1, i32 0>
196 %upper = shufflevector <4 x i32> %x, <4 x i32> undef, <2 x i32> <i32 2, i32 3>
197 %merged = shufflevector <2 x i32> %upper, <2 x i32> %lower, <4 x i32> <i32 3, i32 2, i32 0, i32 1>
198 ret <4 x i32> %merged
203 define <4 x i32> @not_merge(<4 x i32> %x) {
205 ; CHECK-NEXT: [[L:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <2 x i32> <i32 0, i32 1>
206 ; CHECK-NEXT: [[U:%.*]] = shufflevector <4 x i32> [[X]], <4 x i32> undef, <2 x i32> <i32 2, i32 3>
207 ; CHECK-NEXT: [[MERGED:%.*]] = shufflevector <2 x i32> [[U]], <2 x i32> [[L]], <4 x i32> <i32 3, i32 2, i32 0, i32 1>
208 ; CHECK-NEXT: ret <4 x i32> [[MERGED]]
210 %l = shufflevector <4 x i32> %x, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
211 %u = shufflevector <4 x i32> %x, <4 x i32> undef, <2 x i32> <i32 2, i32 3>
212 %merged = shufflevector <2 x i32> %u, <2 x i32> %l, <4 x i32> <i32 3, i32 2, i32 0, i32 1>
213 ret <4 x i32> %merged
222 %s3 = shufflevector <8 x double> %x, <8 x double> undef, <2 x i32> <i32 4, i32 5>
224 %s5 = shufflevector <2 x double> %s1, <2 x double> %s2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
225 %s6 = shufflevector <2 x double> %s3, <2 x double> %s4, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
226 %s7 = shufflevector <4 x double> %s5, <4 x double> %s6, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
236 %s1 = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 0, i32 4>
240 %s5 = shufflevector <2 x i64> %s1, <2 x i64> %s2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
241 %s6 = shufflevector <2 x i64> %s3, <2 x i64> %s4, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
242 %s7 = shufflevector <4 x i64> %s5, <4 x i64> %s6, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 1, i32 3, i32 5, i32 7>
252 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <2 x float> [[X:%.*]], <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
253 ; CHECK-NEXT: [[SHUF2:%.*]] = shufflevector <4 x float> zeroinitializer, <4 x float> [[SHUF]], <2 x i32> <i32 4, i32 5>
256 %shuf = shufflevector <2 x float> %x, <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
257 %shuf2 = shufflevector <4 x float> zeroinitializer, <4 x float> %shuf, <2 x i32> <i32 4, i32 5>
261 define <5 x i8> @splat_inserted_constant(<4 x i8> %x) {
265 %ins3 = insertelement <4 x i8> %x, i8 42, i64 3
266 %splat5 = shufflevector <4 x i8> %ins3, <4 x i8> undef, <5 x i32> <i32 3, i32 3, i32 3, i32 3, i32 3>
270 define <4 x float> @splat_inserted_constant_undef_elt(<4 x float> %x) {
272 ; CHECK-NEXT: ret <4 x float> <float 1.200000e+01, float 1.200000e+01, float poison, float 1.200000e+01>
274 %ins1 = insertelement <4 x float> %x, float 12.0, i32 1
275 %splat1 = shufflevector <4 x float> %ins1, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 undef, i32 1>
276 ret <4 x float> %splat1
288 define <4 x i32> @fold_identity(<4 x i32> %x) {
290 ; CHECK-NEXT: ret <4 x i32> [[X:%.*]]
292 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
293 %revshuf = shufflevector <4 x i32> %shuf, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
294 ret <4 x i32> %revshuf
297 define <4 x i32> @fold_identity2(<4 x i32> %x) {
299 ; CHECK-NEXT: [[SHL:%.*]] = shl <4 x i32> [[X:%.*]], splat (i32 1)
300 ; CHECK-NEXT: ret <4 x i32> [[SHL]]
302 %shl = shl <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1>
303 %shuf = shufflevector <4 x i32> %shl, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
304 %revshuf = shufflevector <4 x i32> %shuf, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
305 ret <4 x i32> %revshuf
308 define <4 x i32> @fold_identity3(<4 x i32> %x) {
310 ; CHECK-NEXT: [[SHL:%.*]] = shl <4 x i32> [[X:%.*]], [[X]]
311 ; CHECK-NEXT: ret <4 x i32> [[SHL]]
313 %shl = shl <4 x i32> %x, %x
314 %shuf = shufflevector <4 x i32> %shl, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
315 %revshuf = shufflevector <4 x i32> %shuf, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
316 ret <4 x i32> %revshuf
319 define <4 x i32> @not_fold_identity(<4 x i32> %x) {
321 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
322 ; CHECK-NEXT: [[REVSHUF:%.*]] = shufflevector <4 x i32> [[SHUF]], <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
323 ; CHECK-NEXT: ret <4 x i32> [[REVSHUF]]
325 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
326 %revshuf = shufflevector <4 x i32> %shuf, <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
327 ret <4 x i32> %revshuf
330 define <4 x i32> @not_fold_identity2(<4 x i32> %x) {
332 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
333 ; CHECK-NEXT: [[REVSHUF:%.*]] = shufflevector <4 x i32> [[SHUF]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
334 ; CHECK-NEXT: ret <4 x i32> [[REVSHUF]]
336 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
337 %revshuf = shufflevector <4 x i32> %shuf, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
338 ret <4 x i32> %revshuf