Debian Codegraph @

llvm/test/Transforms/VectorCombine/AArch64/shuffletoidentity.ll

raw
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=vector-combine -S %s | FileCheck %s
3
4 target triple = "aarch64"
5
6 define <8 x i8> @trivial(<8 x i8> %a) {
7 ; CHECK-LABEL: @trivial(
8 ; CHECK-NEXT: ret <8 x i8> [[A:%.*]]
9 ;
10 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
11 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
12 %r = shufflevector <4 x i8> %at, <4 x i8> %ab, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
13 ret <8 x i8> %r
14 }
15
16 define <4 x i32> @add_same_operands(<4 x i32> %x) {
17 ; CHECK-LABEL: @add_same_operands(
18 ; CHECK-NEXT: [[REVSHUF:%.*]] = add <4 x i32> [[X:%.*]], [[X]]
19 ; CHECK-NEXT: ret <4 x i32> [[REVSHUF]]
20 ;
21 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
22 %add = add <4 x i32> %shuf, %shuf
23 %revshuf = shufflevector <4 x i32> %add, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
24 ret <4 x i32> %revshuf
25 }
26
27 define <8 x i8> @add_different_operands(<8 x i8> %a, <8 x i8> %b) {
28 ; CHECK-LABEL: @add_different_operands(
29 ; CHECK-NEXT: [[R:%.*]] = add <8 x i8> [[A:%.*]], [[B:%.*]]
30 ; CHECK-NEXT: ret <8 x i8> [[R]]
31 ;
32 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
33 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
34 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
35 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
36 %abt = add <4 x i8> %at, %bt
37 %abb = add <4 x i8> %ab, %bb
38 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
39 ret <8 x i8> %r
40 }
41
42 ; Different opcodes
43 define <8 x i8> @wrong_addsub(<8 x i8> %a, <8 x i8> %b) {
44 ; CHECK-LABEL: @wrong_addsub(
45 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
46 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
47 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
48 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
49 ; CHECK-NEXT: [[ABT:%.*]] = add <4 x i8> [[AT]], [[BT]]
50 ; CHECK-NEXT: [[ABB:%.*]] = sub <4 x i8> [[AB]], [[BB]]
51 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
52 ; CHECK-NEXT: ret <8 x i8> [[R]]
53 ;
54 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
55 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
56 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
57 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
58 %abt = add <4 x i8> %at, %bt
59 %abb = sub <4 x i8> %ab, %bb
60 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
61 ret <8 x i8> %r
62 }
63
64 ; Different lanes that do not make an identity
65 define <8 x i8> @wrong_lanes(<8 x i8> %a, <8 x i8> %b) {
66 ; CHECK-LABEL: @wrong_lanes(
67 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
68 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
69 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
70 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
71 ; CHECK-NEXT: [[ABT:%.*]] = add <4 x i8> [[AT]], [[BT]]
72 ; CHECK-NEXT: [[ABB:%.*]] = add <4 x i8> [[AB]], [[BB]]
73 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 6, i32 7, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
74 ; CHECK-NEXT: ret <8 x i8> [[R]]
75 ;
76 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
77 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
78 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
79 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
80 %abt = add <4 x i8> %at, %bt
81 %abb = add <4 x i8> %ab, %bb
82 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 6, i32 7, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
83 ret <8 x i8> %r
84 }
85
86 define <8 x half> @fadd(<8 x half> %a, <8 x half> %b) {
87 ; CHECK-LABEL: @fadd(
88 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[A:%.*]], [[B:%.*]]
89 ; CHECK-NEXT: ret <8 x half> [[R]]
90 ;
91 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
92 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
93 %bb = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
94 %bt = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
95 %abt = fadd <4 x half> %at, %bt
96 %abb = fadd <4 x half> %ab, %bb
97 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
98 ret <8 x half> %r
99 }
100
101 define <8 x half> @fneg(<8 x half> %a, <8 x half> %b) {
102 ; CHECK-LABEL: @fneg(
103 ; CHECK-NEXT: [[R:%.*]] = fneg <8 x half> [[A:%.*]]
104 ; CHECK-NEXT: ret <8 x half> [[R]]
105 ;
106 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
107 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
108 %abt = fneg <4 x half> %at
109 %abb = fneg <4 x half> %ab
110 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
111 ret <8 x half> %r
112 }
113
114 define <8 x i8> @abs(<8 x i8> %a) {
115 ; CHECK-LABEL: @abs(
116 ; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.abs.v8i8(<8 x i8> [[A:%.*]], i1 false)
117 ; CHECK-NEXT: ret <8 x i8> [[R]]
118 ;
119 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
120 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
121 %abt = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %at, i1 false)
122 %abb = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %ab, i1 false)
123 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
124 ret <8 x i8> %r
125 }
126
127 define <8 x half> @powi(<8 x half> %a) {
128 ; CHECK-LABEL: @powi(
129 ; CHECK-NEXT: [[R:%.*]] = call <8 x half> @llvm.powi.v8f16.i32(<8 x half> [[A:%.*]], i32 10)
130 ; CHECK-NEXT: ret <8 x half> [[R]]
131 ;
132 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
133 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
134 %abt = call <4 x half> @llvm.powi.v4f16.i32(<4 x half> %at, i32 10)
135 %abb = call <4 x half> @llvm.powi.v4f16.i32(<4 x half> %ab, i32 10)
136 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
137 ret <8 x half> %r
138 }
139
140 ; Check that call instructions are treated separately from intrinsics.
141 define <8 x half> @callinst(<8 x half> %a) {
142 ; CHECK-LABEL: @callinst(
143 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x half> [[A:%.*]], <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
144 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x half> [[A]], <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
145 ; CHECK-NEXT: [[ABT:%.*]] = call <4 x half> @othercall(<4 x half> [[AT]])
146 ; CHECK-NEXT: [[ABB:%.*]] = call <4 x half> @llvm.fabs.v4f16(<4 x half> [[AB]])
147 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x half> [[ABT]], <4 x half> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
148 ; CHECK-NEXT: ret <8 x half> [[R]]
149 ;
150 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
151 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
152 %abt = call <4 x half> @othercall(<4 x half> %at)
153 %abb = call <4 x half> @llvm.fabs.v4f16(<4 x half> %ab)
154 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
155 ret <8 x half> %r
156 }
157 define <8 x half> @callinst2(<8 x half> %a) {
158 ; CHECK-LABEL: @callinst2(
159 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x half> [[A:%.*]], <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
160 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x half> [[A]], <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
161 ; CHECK-NEXT: [[ABT:%.*]] = call <4 x half> @llvm.fabs.v4f16(<4 x half> [[AT]])
162 ; CHECK-NEXT: [[ABB:%.*]] = call <4 x half> @othercall(<4 x half> [[AB]])
163 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x half> [[ABT]], <4 x half> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
164 ; CHECK-NEXT: ret <8 x half> [[R]]
165 ;
166 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
167 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
168 %abt = call <4 x half> @llvm.fabs.v4f16(<4 x half> %at)
169 %abb = call <4 x half> @othercall(<4 x half> %ab)
170 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
171 ret <8 x half> %r
172 }
173 declare <4 x half> @othercall(<4 x half>)
174
175 define <8 x i32> @lrint(<8 x half> %a) {
176 ; CHECK-LABEL: @lrint(
177 ; CHECK-NEXT: [[R:%.*]] = call <8 x i32> @llvm.lrint.v8i32.v8f16(<8 x half> [[A:%.*]])
178 ; CHECK-NEXT: ret <8 x i32> [[R]]
179 ;
180 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
181 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
182 %abt = call <4 x i32> @llvm.lrint.v4i32.v4f16(<4 x half> %at)
183 %abb = call <4 x i32> @llvm.lrint.v4i32.v4f16(<4 x half> %ab)
184 %r = shufflevector <4 x i32> %abt, <4 x i32> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
185 ret <8 x i32> %r
186 }
187
188 define <8 x i8> @abs_different(<8 x i8> %a) {
189 ; CHECK-LABEL: @abs_different(
190 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
191 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
192 ; CHECK-NEXT: [[ABT:%.*]] = call <4 x i8> @llvm.abs.v4i8(<4 x i8> [[AT]], i1 true)
193 ; CHECK-NEXT: [[ABB:%.*]] = call <4 x i8> @llvm.abs.v4i8(<4 x i8> [[AB]], i1 false)
194 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
195 ; CHECK-NEXT: ret <8 x i8> [[R]]
196 ;
197 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
198 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
199 %abt = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %at, i1 true)
200 %abb = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %ab, i1 false)
201 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
202 ret <8 x i8> %r
203 }
204
205 define <4 x i32> @poison_intrinsic(<2 x i16> %l256) {
206 ; CHECK-LABEL: @poison_intrinsic(
207 ; CHECK-NEXT: [[L267:%.*]] = shufflevector <2 x i16> [[L266:%.*]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
208 ; CHECK-NEXT: [[TMP2:%.*]] = call <4 x i16> @llvm.abs.v4i16(<4 x i16> [[L267]], i1 false)
209 ; CHECK-NEXT: [[L271:%.*]] = zext <4 x i16> [[TMP2]] to <4 x i32>
210 ; CHECK-NEXT: ret <4 x i32> [[L271]]
211 ;
212 %l266 = call <2 x i16> @llvm.abs.v2i16(<2 x i16> %l256, i1 false)
213 %l267 = zext <2 x i16> %l266 to <2 x i32>
214 %l271 = shufflevector <2 x i32> %l267, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
215 ret <4 x i32> %l271
216 }
217
218 define <8 x half> @splat0(<8 x half> %a, <8 x half> %b) {
219 ; CHECK-LABEL: @splat0(
220 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x half> [[B:%.*]], <8 x half> poison, <8 x i32> zeroinitializer
221 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[A:%.*]], [[TMP1]]
222 ; CHECK-NEXT: ret <8 x half> [[R]]
223 ;
224 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
225 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
226 %bs = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> zeroinitializer
227 %abt = fadd <4 x half> %at, %bs
228 %abb = fadd <4 x half> %ab, %bs
229 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
230 ret <8 x half> %r
231 }
232
233 define <8 x half> @splat2(<8 x half> %a, <8 x half> %b) {
234 ; CHECK-LABEL: @splat2(
235 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x half> [[B:%.*]], <8 x half> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
236 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[A:%.*]], [[TMP1]]
237 ; CHECK-NEXT: ret <8 x half> [[R]]
238 ;
239 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
240 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
241 %bs = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
242 %abt = fadd <4 x half> %at, %bs
243 %abb = fadd <4 x half> %ab, %bs
244 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
245 ret <8 x half> %r
246 }
247
248 define <8 x half> @splatandidentity(<8 x half> %a, <8 x half> %b) {
249 ; CHECK-LABEL: @splatandidentity(
250 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x half> [[A:%.*]], <8 x half> poison, <8 x i32> zeroinitializer
251 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[A]], [[TMP1]]
252 ; CHECK-NEXT: ret <8 x half> [[R]]
253 ;
254 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
255 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
256 %bs = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> zeroinitializer
257 %abt = fadd <4 x half> %at, %bs
258 %abb = fadd <4 x half> %ab, %bs
259 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
260 ret <8 x half> %r
261 }
262
263 define <8 x half> @splattwice(<8 x half> %a, <8 x half> %b) {
264 ; CHECK-LABEL: @splattwice(
265 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x half> [[A:%.*]], <8 x half> poison, <8 x i32> zeroinitializer
266 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x half> [[B:%.*]], <8 x half> poison, <8 x i32> zeroinitializer
267 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[TMP1]], [[TMP2]]
268 ; CHECK-NEXT: ret <8 x half> [[R]]
269 ;
270 %as = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> zeroinitializer
271 %bs = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> zeroinitializer
272 %ab1 = fadd <4 x half> %as, %bs
273 %ab2 = fadd <4 x half> %as, %bs
274 %r = shufflevector <4 x half> %ab1, <4 x half> %ab2, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
275 ret <8 x half> %r
276 }
277
278 define <8 x i8> @undeflane(<8 x i8> %a, <8 x i8> %b) {
279 ; CHECK-LABEL: @undeflane(
280 ; CHECK-NEXT: [[R:%.*]] = add <8 x i8> [[A:%.*]], [[B:%.*]]
281 ; CHECK-NEXT: ret <8 x i8> [[R]]
282 ;
283 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
284 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
285 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
286 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
287 %abt = add <4 x i8> %at, %bt
288 %abb = add <4 x i8> %ab, %bb
289 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 poison, i32 1, i32 0>
290 ret <8 x i8> %r
291 }
292
293 define <8 x i8> @constantsplat(<8 x i8> %a) {
294 ; CHECK-LABEL: @constantsplat(
295 ; CHECK-NEXT: [[R:%.*]] = add <8 x i8> [[A:%.*]], splat (i8 10)
296 ; CHECK-NEXT: ret <8 x i8> [[R]]
297 ;
298 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
299 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
300 %abt = add <4 x i8> %at, <i8 10, i8 10, i8 10, i8 10>
301 %abb = add <4 x i8> %ab, <i8 10, i8 10, i8 10, i8 10>
302 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
303 ret <8 x i8> %r
304 }
305
306 define <8 x i8> @constantdiff(<8 x i8> %a) {
307 ; CHECK-LABEL: @constantdiff(
308 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
309 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
310 ; CHECK-NEXT: [[ABT:%.*]] = add <4 x i8> [[AT]], <i8 1, i8 2, i8 3, i8 4>
311 ; CHECK-NEXT: [[ABB:%.*]] = add <4 x i8> [[AB]], <i8 5, i8 6, i8 7, i8 8>
312 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
313 ; CHECK-NEXT: ret <8 x i8> [[R]]
314 ;
315 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
316 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
317 %abt = add <4 x i8> %at, <i8 1, i8 2, i8 3, i8 4>
318 %abb = add <4 x i8> %ab, <i8 5, i8 6, i8 7, i8 8>
319 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
320 ret <8 x i8> %r
321 }
322
323 define <8 x i8> @constantdiff2(<8 x i8> %a) {
324 ; CHECK-LABEL: @constantdiff2(
325 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
326 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
327 ; CHECK-NEXT: [[ABT:%.*]] = add <4 x i8> [[AT]], <i8 1, i8 2, i8 3, i8 4>
328 ; CHECK-NEXT: [[ABB:%.*]] = add <4 x i8> [[AB]], <i8 1, i8 2, i8 3, i8 4>
329 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
330 ; CHECK-NEXT: ret <8 x i8> [[R]]
331 ;
332 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
333 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
334 %abt = add <4 x i8> %at, <i8 1, i8 2, i8 3, i8 4>
335 %abb = add <4 x i8> %ab, <i8 1, i8 2, i8 3, i8 4>
336 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
337 ret <8 x i8> %r
338 }
339
340 define <8 x half> @constantsplatf(<8 x half> %a) {
341 ; CHECK-LABEL: @constantsplatf(
342 ; CHECK-NEXT: [[R:%.*]] = fadd <8 x half> [[A:%.*]], splat (half 0xH4900)
343 ; CHECK-NEXT: ret <8 x half> [[R]]
344 ;
345 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
346 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
347 %abt = fadd <4 x half> %at, <half 10.0, half 10.0, half 10.0, half 10.0>
348 %abb = fadd <4 x half> %ab, <half 10.0, half 10.0, half 10.0, half 10.0>
349 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
350 ret <8 x half> %r
351 }
352
353 define <8 x i8> @inner_shuffle(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c) {
354 ; CHECK-LABEL: @inner_shuffle(
355 ; CHECK-NEXT: [[TMP1:%.*]] = mul <8 x i8> [[A:%.*]], [[B:%.*]]
356 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x i8> [[C:%.*]], <8 x i8> poison, <8 x i32> zeroinitializer
357 ; CHECK-NEXT: [[R:%.*]] = add <8 x i8> [[TMP1]], [[TMP2]]
358 ; CHECK-NEXT: ret <8 x i8> [[R]]
359 ;
360 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
361 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
362 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
363 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
364 %cs = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> zeroinitializer
365 %abt = mul <4 x i8> %at, %bt
366 %abb = mul <4 x i8> %ab, %bb
367 %abt2 = shufflevector <4 x i8> %abt, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
368 %abb2 = shufflevector <4 x i8> %abb, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
369 %abt3 = add <4 x i8> %abt2, %cs
370 %abb3 = add <4 x i8> %abb2, %cs
371 %r = shufflevector <4 x i8> %abt3, <4 x i8> %abb3, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
372 ret <8 x i8> %r
373 }
374
375 define <4 x i32> @extrause_add_same_operands(<4 x i32> %x) {
376 ; CHECK-LABEL: @extrause_add_same_operands(
377 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
378 ; CHECK-NEXT: [[REVSHUF:%.*]] = add <4 x i32> [[X]], [[X]]
379 ; CHECK-NEXT: [[ADD2:%.*]] = add <4 x i32> [[SHUF]], [[REVSHUF]]
380 ; CHECK-NEXT: ret <4 x i32> [[ADD2]]
381 ;
382 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
383 %add = add <4 x i32> %shuf, %shuf
384 %revshuf = shufflevector <4 x i32> %add, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
385 %add2 = add <4 x i32> %shuf, %revshuf
386 ret <4 x i32> %add2
387 }
388
389 define <8 x i8> @extrause_add_different_operands(<8 x i8> %a, <8 x i8> %b) {
390 ; CHECK-LABEL: @extrause_add_different_operands(
391 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
392 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
393 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
394 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
395 ; CHECK-NEXT: [[ABT:%.*]] = add <4 x i8> [[AT]], [[BT]]
396 ; CHECK-NEXT: [[ABB:%.*]] = add <4 x i8> [[AB]], [[BB]]
397 ; CHECK-NEXT: call void @use(<4 x i8> [[ABB]])
398 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
399 ; CHECK-NEXT: ret <8 x i8> [[R]]
400 ;
401 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
402 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
403 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
404 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
405 %abt = add <4 x i8> %at, %bt
406 %abb = add <4 x i8> %ab, %bb
407 call void @use(<4 x i8> %abb)
408 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
409 ret <8 x i8> %r
410 }
411
412 define <8 x i8> @extrause_shuffle(<8 x i8> %a, <8 x i8> %b) {
413 ; CHECK-LABEL: @extrause_shuffle(
414 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
415 ; CHECK-NEXT: call void @use(<4 x i8> [[BT]])
416 ; CHECK-NEXT: [[R:%.*]] = add <8 x i8> [[A:%.*]], [[B]]
417 ; CHECK-NEXT: ret <8 x i8> [[R]]
418 ;
419 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
420 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
421 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
422 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
423 call void @use(<4 x i8> %bt)
424 %abt = add <4 x i8> %at, %bt
425 %abb = add <4 x i8> %ab, %bb
426 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
427 ret <8 x i8> %r
428 }
429
430 define <8 x i8> @icmpsel(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
431 ; CHECK-LABEL: @icmpsel(
432 ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt <8 x i8> [[A:%.*]], [[B:%.*]]
433 ; CHECK-NEXT: [[R:%.*]] = select <8 x i1> [[TMP1]], <8 x i8> [[C:%.*]], <8 x i8> [[D:%.*]]
434 ; CHECK-NEXT: ret <8 x i8> [[R]]
435 ;
436 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
437 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
438 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
439 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
440 %cb = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
441 %ct = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
442 %db = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
443 %dt = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
444 %abt1 = icmp slt <4 x i8> %at, %bt
445 %abb1 = icmp slt <4 x i8> %ab, %bb
446 %abt = select <4 x i1> %abt1, <4 x i8> %ct, <4 x i8> %dt
447 %abb = select <4 x i1> %abb1, <4 x i8> %cb, <4 x i8> %db
448 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
449 ret <8 x i8> %r
450 }
451
452 define <8 x i8> @icmpsel_diffentcond(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
453 ; CHECK-LABEL: @icmpsel_diffentcond(
454 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
455 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
456 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
457 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
458 ; CHECK-NEXT: [[CB:%.*]] = shufflevector <8 x i8> [[C:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
459 ; CHECK-NEXT: [[CT:%.*]] = shufflevector <8 x i8> [[C]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
460 ; CHECK-NEXT: [[DB:%.*]] = shufflevector <8 x i8> [[D:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
461 ; CHECK-NEXT: [[DT:%.*]] = shufflevector <8 x i8> [[D]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
462 ; CHECK-NEXT: [[ABT1:%.*]] = icmp slt <4 x i8> [[AT]], [[BT]]
463 ; CHECK-NEXT: [[ABB1:%.*]] = icmp ult <4 x i8> [[AB]], [[BB]]
464 ; CHECK-NEXT: [[ABT:%.*]] = select <4 x i1> [[ABT1]], <4 x i8> [[CT]], <4 x i8> [[DT]]
465 ; CHECK-NEXT: [[ABB:%.*]] = select <4 x i1> [[ABB1]], <4 x i8> [[CB]], <4 x i8> [[DB]]
466 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
467 ; CHECK-NEXT: ret <8 x i8> [[R]]
468 ;
469 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
470 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
471 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
472 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
473 %cb = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
474 %ct = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
475 %db = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
476 %dt = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
477 %abt1 = icmp slt <4 x i8> %at, %bt
478 %abb1 = icmp ult <4 x i8> %ab, %bb
479 %abt = select <4 x i1> %abt1, <4 x i8> %ct, <4 x i8> %dt
480 %abb = select <4 x i1> %abb1, <4 x i8> %cb, <4 x i8> %db
481 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
482 ret <8 x i8> %r
483 }
484
485 define <8 x i8> @fcmpsel(<8 x half> %a, <8 x half> %b, <8 x i8> %c, <8 x i8> %d) {
486 ; CHECK-LABEL: @fcmpsel(
487 ; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <8 x half> [[A:%.*]], [[B:%.*]]
488 ; CHECK-NEXT: [[R:%.*]] = select <8 x i1> [[TMP1]], <8 x i8> [[C:%.*]], <8 x i8> [[D:%.*]]
489 ; CHECK-NEXT: ret <8 x i8> [[R]]
490 ;
491 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
492 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
493 %bb = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
494 %bt = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
495 %cb = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
496 %ct = shufflevector <8 x i8> %c, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
497 %db = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
498 %dt = shufflevector <8 x i8> %d, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
499 %abt1 = fcmp olt <4 x half> %at, %bt
500 %abb1 = fcmp olt <4 x half> %ab, %bb
501 %abt = select <4 x i1> %abt1, <4 x i8> %ct, <4 x i8> %dt
502 %abb = select <4 x i1> %abb1, <4 x i8> %cb, <4 x i8> %db
503 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
504 ret <8 x i8> %r
505 }
506
507 define <8 x half> @fma(<8 x half> %a, <8 x half> %b, <8 x half> %c) {
508 ; CHECK-LABEL: @fma(
509 ; CHECK-NEXT: [[R:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], <8 x half> [[C:%.*]])
510 ; CHECK-NEXT: ret <8 x half> [[R]]
511 ;
512 %ab = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
513 %at = shufflevector <8 x half> %a, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
514 %bb = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
515 %bt = shufflevector <8 x half> %b, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
516 %cb = shufflevector <8 x half> %c, <8 x half> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
517 %ct = shufflevector <8 x half> %c, <8 x half> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
518 %abb = call <4 x half> @llvm.fma.v4f16(<4 x half> %ab, <4 x half> %bb, <4 x half> %cb)
519 %abt = call <4 x half> @llvm.fma.v4f16(<4 x half> %at, <4 x half> %bt, <4 x half> %ct)
520 %r = shufflevector <4 x half> %abt, <4 x half> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
521 ret <8 x half> %r
522 }
523
524 define <4 x i64> @single_zext(<4 x i32> %x) {
525 ; CHECK-LABEL: @single_zext(
526 ; CHECK-NEXT: [[REVSHUF:%.*]] = zext <4 x i32> [[X:%.*]] to <4 x i64>
527 ; CHECK-NEXT: ret <4 x i64> [[REVSHUF]]
528 ;
529 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
530 %zext = zext <4 x i32> %shuf to <4 x i64>
531 %revshuf = shufflevector <4 x i64> %zext, <4 x i64> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
532 ret <4 x i64> %revshuf
533 }
534
535 define <4 x i64> @not_zext(<4 x i32> %x) {
536 ; CHECK-LABEL: @not_zext(
537 ; CHECK-NEXT: [[REVSHUF:%.*]] = shufflevector <4 x i32> [[X]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
538 ; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[REVSHUF:%.*]] to <4 x i64>
539 ; CHECK-NEXT: ret <4 x i64> [[ZEXT]]
540 ;
541 %zext = zext <4 x i32> %x to <4 x i64>
542 %revshuf = shufflevector <4 x i64> %zext, <4 x i64> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
543 ret <4 x i64> %revshuf
544 }
545
546 define <4 x i64> @not_zext2(<4 x i32> %x) {
547 ; CHECK-LABEL: @not_zext2(
548 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
549 ; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[SHUF]] to <4 x i64>
550 ; CHECK-NEXT: ret <4 x i64> [[ZEXT]]
551 ;
552 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
553 %zext = zext <4 x i32> %shuf to <4 x i64>
554 ret <4 x i64> %zext
555 }
556
557 define i32 @not_bitcast(<4 x i8> %x) {
558 ; CHECK-LABEL: @not_bitcast(
559 ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
560 ; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <4 x i8> [[SHUF]] to i32
561 ; CHECK-NEXT: ret i32 [[BITCAST]]
562 ;
563 %shuf = shufflevector <4 x i8> %x, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
564 %bitcast = bitcast <4 x i8> %shuf to i32
565 ret i32 %bitcast
566 }
567
568 define <8 x i16> @not_bitcast2(<4 x i32> %x, <8 x i16> %y) {
569 ; CHECK-LABEL: @not_bitcast2(
570 ; CHECK-NEXT: [[CAST:%.*]] = bitcast <4 x i32> [[X:%.*]] to <8 x i16>
571 ; CHECK-NEXT: [[OUT:%.*]] = shufflevector <8 x i16> [[Y:%.*]], <8 x i16> [[CAST]], <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
572 ; CHECK-NEXT: ret <8 x i16> [[OUT]]
573 ;
574 %cast = bitcast <4 x i32> %x to <8 x i16>
575 %out = shufflevector <8 x i16> %y, <8 x i16> %cast, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
576 ret <8 x i16> %out
577 }
578
579 define void @exttrunc(<8 x i32> %a, <8 x i32> %b, ptr %p) {
580 ; CHECK-LABEL: @exttrunc(
581 ; CHECK-NEXT: [[TMP1:%.*]] = zext <8 x i32> [[A:%.*]] to <8 x i64>
582 ; CHECK-NEXT: [[TMP2:%.*]] = sext <8 x i32> [[B:%.*]] to <8 x i64>
583 ; CHECK-NEXT: [[TMP3:%.*]] = add <8 x i64> [[TMP1]], [[TMP2]]
584 ; CHECK-NEXT: [[R:%.*]] = trunc <8 x i64> [[TMP3]] to <8 x i32>
585 ; CHECK-NEXT: store <8 x i32> [[R]], ptr [[P:%.*]], align 32
586 ; CHECK-NEXT: ret void
587 ;
588 %ab = shufflevector <8 x i32> %a, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
589 %at = shufflevector <8 x i32> %a, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
590 %bb = shufflevector <8 x i32> %b, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
591 %bt = shufflevector <8 x i32> %b, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
592 %ab1 = zext <4 x i32> %ab to <4 x i64>
593 %at1 = zext <4 x i32> %at to <4 x i64>
594 %bb1 = sext <4 x i32> %bb to <4 x i64>
595 %bt1 = sext <4 x i32> %bt to <4 x i64>
596 %abb = add <4 x i64> %ab1, %bb1
597 %abt = add <4 x i64> %at1, %bt1
598 %abb1 = trunc <4 x i64> %abb to <4 x i32>
599 %abt1 = trunc <4 x i64> %abt to <4 x i32>
600 %r = shufflevector <4 x i32> %abb1, <4 x i32> %abt1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
601 store <8 x i32> %r, ptr %p
602 ret void
603 }
604
605 define void @zext(<8 x i16> %a, <8 x i16> %b, ptr %p) {
606 ; CHECK-LABEL: @zext(
607 ; CHECK-NEXT: [[TMP1:%.*]] = zext <8 x i16> [[A:%.*]] to <8 x i32>
608 ; CHECK-NEXT: [[TMP2:%.*]] = zext <8 x i16> [[B:%.*]] to <8 x i32>
609 ; CHECK-NEXT: [[R:%.*]] = add <8 x i32> [[TMP1]], [[TMP2]]
610 ; CHECK-NEXT: store <8 x i32> [[R]], ptr [[P:%.*]], align 32
611 ; CHECK-NEXT: ret void
612 ;
613 %ab = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
614 %at = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
615 %bb = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
616 %bt = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
617 %ab1 = zext <4 x i16> %ab to <4 x i32>
618 %at1 = zext <4 x i16> %at to <4 x i32>
619 %bb1 = zext <4 x i16> %bb to <4 x i32>
620 %bt1 = zext <4 x i16> %bt to <4 x i32>
621 %abb = add <4 x i32> %ab1, %bb1
622 %abt = add <4 x i32> %at1, %bt1
623 %r = shufflevector <4 x i32> %abb, <4 x i32> %abt, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
624 store <8 x i32> %r, ptr %p
625 ret void
626 }
627
628 define void @sext(<8 x i16> %a, <8 x i16> %b, ptr %p) {
629 ; CHECK-LABEL: @sext(
630 ; CHECK-NEXT: [[TMP1:%.*]] = sext <8 x i16> [[A:%.*]] to <8 x i32>
631 ; CHECK-NEXT: [[TMP2:%.*]] = sext <8 x i16> [[B:%.*]] to <8 x i32>
632 ; CHECK-NEXT: [[R:%.*]] = add <8 x i32> [[TMP1]], [[TMP2]]
633 ; CHECK-NEXT: store <8 x i32> [[R]], ptr [[P:%.*]], align 32
634 ; CHECK-NEXT: ret void
635 ;
636 %ab = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
637 %at = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
638 %bb = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
639 %bt = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
640 %ab1 = sext <4 x i16> %ab to <4 x i32>
641 %at1 = sext <4 x i16> %at to <4 x i32>
642 %bb1 = sext <4 x i16> %bb to <4 x i32>
643 %bt1 = sext <4 x i16> %bt to <4 x i32>
644 %abb = add <4 x i32> %ab1, %bb1
645 %abt = add <4 x i32> %at1, %bt1
646 %r = shufflevector <4 x i32> %abb, <4 x i32> %abt, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
647 store <8 x i32> %r, ptr %p
648 ret void
649 }
650
651 define void @szext(<8 x i32> %a, <8 x i32> %b, ptr %p) {
652 ; CHECK-LABEL: @szext(
653 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
654 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
655 ; CHECK-NEXT: [[AB1:%.*]] = sext <4 x i32> [[AB]] to <4 x i64>
656 ; CHECK-NEXT: [[AT1:%.*]] = zext <4 x i32> [[AT]] to <4 x i64>
657 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i64> [[AB1]], <4 x i64> [[AT1]], <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
658 ; CHECK-NEXT: store <8 x i64> [[R]], ptr [[P:%.*]], align 64
659 ; CHECK-NEXT: ret void
660 ;
661 %ab = shufflevector <8 x i32> %a, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
662 %at = shufflevector <8 x i32> %a, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
663 %ab1 = sext <4 x i32> %ab to <4 x i64>
664 %at1 = zext <4 x i32> %at to <4 x i64>
665 %r = shufflevector <4 x i64> %ab1, <4 x i64> %at1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
666 store <8 x i64> %r, ptr %p
667 ret void
668 }
669
670 define void @zext_types(<8 x i16> %a, <8 x i32> %b, ptr %p) {
671 ; CHECK-LABEL: @zext_types(
672 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i16> [[A:%.*]], <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
673 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i32> [[B:%.*]], <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
674 ; CHECK-NEXT: [[AB1:%.*]] = zext <4 x i16> [[AB]] to <4 x i64>
675 ; CHECK-NEXT: [[AT1:%.*]] = zext <4 x i32> [[AT]] to <4 x i64>
676 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i64> [[AB1]], <4 x i64> [[AT1]], <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
677 ; CHECK-NEXT: store <8 x i64> [[R]], ptr [[P:%.*]], align 64
678 ; CHECK-NEXT: ret void
679 ;
680 %ab = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
681 %at = shufflevector <8 x i32> %b, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
682 %ab1 = zext <4 x i16> %ab to <4 x i64>
683 %at1 = zext <4 x i32> %at to <4 x i64>
684 %r = shufflevector <4 x i64> %ab1, <4 x i64> %at1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
685 store <8 x i64> %r, ptr %p
686 ret void
687 }
688
689 define void @trunc(<8 x i64> %a, <8 x i64> %b, ptr %p) {
690 ; CHECK-LABEL: @trunc(
691 ; CHECK-NEXT: [[R:%.*]] = trunc <8 x i64> [[A:%.*]] to <8 x i32>
692 ; CHECK-NEXT: store <8 x i32> [[R]], ptr [[P:%.*]], align 32
693 ; CHECK-NEXT: ret void
694 ;
695 %ab = shufflevector <8 x i64> %a, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
696 %at = shufflevector <8 x i64> %a, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
697 %abb1 = trunc <4 x i64> %ab to <4 x i32>
698 %abt1 = trunc <4 x i64> %at to <4 x i32>
699 %r = shufflevector <4 x i32> %abb1, <4 x i32> %abt1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
700 store <8 x i32> %r, ptr %p
701 ret void
702 }
703
704 define <4 x i64> @zext_chain(<4 x i16> %x) {
705 ; CHECK-LABEL: @zext_chain(
706 ; CHECK-NEXT: [[TMP1:%.*]] = zext <4 x i16> [[X:%.*]] to <4 x i32>
707 ; CHECK-NEXT: [[REVSHUF:%.*]] = sext <4 x i32> [[TMP1]] to <4 x i64>
708 ; CHECK-NEXT: ret <4 x i64> [[REVSHUF]]
709 ;
710 %shuf = shufflevector <4 x i16> %x, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
711 %zext = zext <4 x i16> %shuf to <4 x i32>
712 %sext = sext <4 x i32> %zext to <4 x i64>
713 %revshuf = shufflevector <4 x i64> %sext, <4 x i64> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
714 ret <4 x i64> %revshuf
715 }
716
717 define <4 x i32> @add_chain(<4 x i32> %x) {
718 ; CHECK-LABEL: @add_chain(
719 ; CHECK-NEXT: [[ADD:%.*]] = add <4 x i32> [[SHUF:%.*]], [[SHUF]]
720 ; CHECK-NEXT: [[TMP2:%.*]] = add <4 x i32> [[SHUF]], [[SHUF]]
721 ; CHECK-NEXT: [[REVSHUF:%.*]] = add <4 x i32> [[ADD]], [[TMP2]]
722 ; CHECK-NEXT: ret <4 x i32> [[REVSHUF]]
723 ;
724 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
725 %add = add <4 x i32> %shuf, %shuf
726 %add2 = add <4 x i32> %add, %add
727 %revshuf = shufflevector <4 x i32> %add2, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
728 ret <4 x i32> %revshuf
729 }
730
731 define <4 x i64> @zext_add_chain(<4 x i32> %x) {
732 ; CHECK-LABEL: @zext_add_chain(
733 ; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[SHUF:%.*]] to <4 x i64>
734 ; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i32> [[SHUF]] to <4 x i64>
735 ; CHECK-NEXT: [[REVSHUF:%.*]] = add <4 x i64> [[ZEXT]], [[TMP2]]
736 ; CHECK-NEXT: ret <4 x i64> [[REVSHUF]]
737 ;
738 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
739 %zext = zext <4 x i32> %shuf to <4 x i64>
740 %add = add <4 x i64> %zext, %zext
741 %revshuf = shufflevector <4 x i64> %add, <4 x i64> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
742 ret <4 x i64> %revshuf
743 }
744
745 define <8 x i8> @intrinsics_minmax(<8 x i8> %a, <8 x i8> %b) {
746 ; CHECK-LABEL: @intrinsics_minmax(
747 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i8> @llvm.smin.v8i8(<8 x i8> [[A:%.*]], <8 x i8> [[B:%.*]])
748 ; CHECK-NEXT: [[TMP2:%.*]] = call <8 x i8> @llvm.smax.v8i8(<8 x i8> [[TMP1]], <8 x i8> [[B]])
749 ; CHECK-NEXT: [[TMP3:%.*]] = call <8 x i8> @llvm.umin.v8i8(<8 x i8> [[TMP2]], <8 x i8> [[B]])
750 ; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.umax.v8i8(<8 x i8> [[TMP3]], <8 x i8> [[B]])
751 ; CHECK-NEXT: ret <8 x i8> [[R]]
752 ;
753 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
754 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
755 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
756 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
757 %abt = call <4 x i8> @llvm.smin.v4i8(<4 x i8> %at, <4 x i8> %bt)
758 %abb = call <4 x i8> @llvm.smin.v4i8(<4 x i8> %ab, <4 x i8> %bb)
759 %abt1 = call <4 x i8> @llvm.smax.v4i8(<4 x i8> %abt, <4 x i8> %bt)
760 %abb1 = call <4 x i8> @llvm.smax.v4i8(<4 x i8> %abb, <4 x i8> %bb)
761 %abt2 = call <4 x i8> @llvm.umin.v4i8(<4 x i8> %abt1, <4 x i8> %bt)
762 %abb2 = call <4 x i8> @llvm.umin.v4i8(<4 x i8> %abb1, <4 x i8> %bb)
763 %abt3 = call <4 x i8> @llvm.umax.v4i8(<4 x i8> %abt2, <4 x i8> %bt)
764 %abb3 = call <4 x i8> @llvm.umax.v4i8(<4 x i8> %abb2, <4 x i8> %bb)
765 %r = shufflevector <4 x i8> %abt3, <4 x i8> %abb3, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
766 ret <8 x i8> %r
767 }
768
769 define <8 x i8> @intrinsics_addsat(<8 x i8> %a, <8 x i8> %b) {
770 ; CHECK-LABEL: @intrinsics_addsat(
771 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> [[A:%.*]], <8 x i8> [[B:%.*]])
772 ; CHECK-NEXT: [[TMP2:%.*]] = call <8 x i8> @llvm.ssub.sat.v8i8(<8 x i8> [[TMP1]], <8 x i8> [[B]])
773 ; CHECK-NEXT: [[TMP3:%.*]] = call <8 x i8> @llvm.uadd.sat.v8i8(<8 x i8> [[TMP2]], <8 x i8> [[B]])
774 ; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.usub.sat.v8i8(<8 x i8> [[TMP3]], <8 x i8> [[B]])
775 ; CHECK-NEXT: ret <8 x i8> [[R]]
776 ;
777 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
778 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
779 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
780 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
781 %abt = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %at, <4 x i8> %bt)
782 %abb = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %ab, <4 x i8> %bb)
783 %abt1 = call <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8> %abt, <4 x i8> %bt)
784 %abb1 = call <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8> %abb, <4 x i8> %bb)
785 %abt2 = call <4 x i8> @llvm.uadd.sat.v4i8(<4 x i8> %abt1, <4 x i8> %bt)
786 %abb2 = call <4 x i8> @llvm.uadd.sat.v4i8(<4 x i8> %abb1, <4 x i8> %bb)
787 %abt3 = call <4 x i8> @llvm.usub.sat.v4i8(<4 x i8> %abt2, <4 x i8> %bt)
788 %abb3 = call <4 x i8> @llvm.usub.sat.v4i8(<4 x i8> %abb2, <4 x i8> %bb)
789 %r = shufflevector <4 x i8> %abt3, <4 x i8> %abb3, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
790 ret <8 x i8> %r
791 }
792
793 define <8 x i8> @intrinsics_different(<8 x i8> %a, <8 x i8> %b) {
794 ; CHECK-LABEL: @intrinsics_different(
795 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
796 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
797 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
798 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
799 ; CHECK-NEXT: [[ABT:%.*]] = call <4 x i8> @llvm.smin.v4i8(<4 x i8> [[AT]], <4 x i8> [[BT]])
800 ; CHECK-NEXT: [[ABB:%.*]] = call <4 x i8> @llvm.umin.v4i8(<4 x i8> [[AB]], <4 x i8> [[BB]])
801 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
802 ; CHECK-NEXT: ret <8 x i8> [[R]]
803 ;
804 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
805 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
806 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
807 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
808 %abt = call <4 x i8> @llvm.smin(<4 x i8> %at, <4 x i8> %bt)
809 %abb = call <4 x i8> @llvm.umin(<4 x i8> %ab, <4 x i8> %bb)
810 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
811 ret <8 x i8> %r
812 }
813
814 ; div and rem are currently excluded.
815 define <8 x i8> @div(<8 x i8> %a, <8 x i8> %b) {
816 ; CHECK-LABEL: @div(
817 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
818 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
819 ; CHECK-NEXT: [[BB:%.*]] = shufflevector <8 x i8> [[B:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
820 ; CHECK-NEXT: [[BT:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
821 ; CHECK-NEXT: [[ABT:%.*]] = udiv <4 x i8> [[AT]], [[BT]]
822 ; CHECK-NEXT: [[ABB:%.*]] = udiv <4 x i8> [[AB]], [[BB]]
823 ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[ABT]], <4 x i8> [[ABB]], <8 x i32> <i32 7, i32 poison, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
824 ; CHECK-NEXT: ret <8 x i8> [[R]]
825 ;
826 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
827 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
828 %bb = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
829 %bt = shufflevector <8 x i8> %b, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
830 %abt = udiv <4 x i8> %at, %bt
831 %abb = udiv <4 x i8> %ab, %bb
832 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 poison, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
833 ret <8 x i8> %r
834 }
835
836 define void @v8f64interleave(i64 %0, ptr %1, ptr %x, double %z) {
837 ; CHECK-LABEL: @v8f64interleave(
838 ; CHECK-NEXT: entry:
839 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[Z:%.*]], i64 0
840 ; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <16 x double>, ptr [[TMP1:%.*]], align 8
841 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds double, ptr [[X:%.*]], i64 [[TMP0:%.*]]
842 ; CHECK-NEXT: [[WIDE_VEC34:%.*]] = load <16 x double>, ptr [[TMP2]], align 8
843 ; CHECK-NEXT: [[TMP3:%.*]] = or disjoint i64 [[TMP0]], 7
844 ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, ptr [[X]], i64 [[TMP3]]
845 ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 -56
846 ; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <16 x i32> zeroinitializer
847 ; CHECK-NEXT: [[TMP7:%.*]] = fmul fast <16 x double> [[WIDE_VEC]], [[TMP6]]
848 ; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = fadd fast <16 x double> [[WIDE_VEC34]], [[TMP7]]
849 ; CHECK-NEXT: store <16 x double> [[INTERLEAVED_VEC]], ptr [[TMP5]], align 8
850 ; CHECK-NEXT: ret void
851 ;
852 entry:
853 %broadcast.splatinsert = insertelement <2 x double> poison, double %z, i64 0
854 %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
855 %wide.vec = load <16 x double>, ptr %1, align 8
856 %strided.vec = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 0, i32 8>
857 %strided.vec27 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 1, i32 9>
858 %strided.vec28 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 2, i32 10>
859 %strided.vec29 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 3, i32 11>
860 %strided.vec30 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 4, i32 12>
861 %strided.vec31 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 5, i32 13>
862 %strided.vec32 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 6, i32 14>
863 %strided.vec33 = shufflevector <16 x double> %wide.vec, <16 x double> poison, <2 x i32> <i32 7, i32 15>
864 %2 = fmul fast <2 x double> %strided.vec, %broadcast.splat
865 %3 = getelementptr inbounds double, ptr %x, i64 %0
866 %wide.vec34 = load <16 x double>, ptr %3, align 8
867 %strided.vec35 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 0, i32 8>
868 %strided.vec36 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 1, i32 9>
869 %strided.vec37 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 2, i32 10>
870 %strided.vec38 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 3, i32 11>
871 %strided.vec39 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 4, i32 12>
872 %strided.vec40 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 5, i32 13>
873 %strided.vec41 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 6, i32 14>
874 %strided.vec42 = shufflevector <16 x double> %wide.vec34, <16 x double> poison, <2 x i32> <i32 7, i32 15>
875 %4 = fadd fast <2 x double> %strided.vec35, %2
876 %5 = fmul fast <2 x double> %strided.vec27, %broadcast.splat
877 %6 = fadd fast <2 x double> %strided.vec36, %5
878 %7 = fmul fast <2 x double> %strided.vec28, %broadcast.splat
879 %8 = fadd fast <2 x double> %strided.vec37, %7
880 %9 = fmul fast <2 x double> %strided.vec29, %broadcast.splat
881 %10 = fadd fast <2 x double> %strided.vec38, %9
882 %11 = fmul fast <2 x double> %strided.vec30, %broadcast.splat
883 %12 = fadd fast <2 x double> %strided.vec39, %11
884 %13 = fmul fast <2 x double> %strided.vec31, %broadcast.splat
885 %14 = fadd fast <2 x double> %strided.vec40, %13
886 %15 = fmul fast <2 x double> %strided.vec32, %broadcast.splat
887 %16 = fadd fast <2 x double> %strided.vec41, %15
888 %17 = or disjoint i64 %0, 7
889 %18 = fmul fast <2 x double> %strided.vec33, %broadcast.splat
890 %19 = getelementptr inbounds double, ptr %x, i64 %17
891 %20 = fadd fast <2 x double> %strided.vec42, %18
892 %21 = getelementptr inbounds i8, ptr %19, i64 -56
893 %22 = shufflevector <2 x double> %4, <2 x double> %6, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
894 %23 = shufflevector <2 x double> %8, <2 x double> %10, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
895 %24 = shufflevector <2 x double> %12, <2 x double> %14, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
896 %25 = shufflevector <2 x double> %16, <2 x double> %20, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
897 %26 = shufflevector <4 x double> %22, <4 x double> %23, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
898 %27 = shufflevector <4 x double> %24, <4 x double> %25, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
899 %interleaved.vec = shufflevector <8 x double> %26, <8 x double> %27, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>
900 store <16 x double> %interleaved.vec, ptr %21, align 8
901 ret void
902 }
903
904 define <4 x i8> @singleop(<4 x i8> %a, <4 x i8> %b) {
905 ; CHECK-LABEL: @singleop(
906 ; CHECK-NEXT: [[TMP1:%.*]] = zext <4 x i8> [[A:%.*]] to <4 x i16>
907 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i8> [[B:%.*]], <4 x i8> poison, <4 x i32> zeroinitializer
908 ; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i8> [[TMP2]] to <4 x i16>
909 ; CHECK-NEXT: [[TMP4:%.*]] = add <4 x i16> [[TMP1]], [[TMP3]]
910 ; CHECK-NEXT: [[R:%.*]] = trunc <4 x i16> [[TMP4]] to <4 x i8>
911 ; CHECK-NEXT: ret <4 x i8> [[R]]
912 ;
913 %a1 = shufflevector <4 x i8> %a, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
914 %b1 = shufflevector <4 x i8> %b, <4 x i8> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
915 %a2 = zext <4 x i8> %a1 to <4 x i16>
916 %b2 = zext <4 x i8> %b1 to <4 x i16>
917 %ab = add <4 x i16> %a2, %b2
918 %t = trunc <4 x i16> %ab to <4 x i8>
919 %r = shufflevector <4 x i8> %t, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
920 ret <4 x i8> %r
921 }
922
923 define <4 x i64> @cast_mismatched_types(<4 x i32> %x) {
924 ; CHECK-LABEL: @cast_mismatched_types(
925 ; CHECK-SAME: <4 x i32> [[X:%.*]]) {
926 ; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[X]] to <4 x i64>
927 ; CHECK-NEXT: ret <4 x i64> [[ZEXT]]
928 ;
929 %shuf = shufflevector <4 x i32> %x, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
930 %zext = zext <2 x i32> %shuf to <2 x i64>
931 %extshuf = shufflevector <2 x i64> %zext, <2 x i64> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
932 ret <4 x i64> %extshuf
933 }
934
935 define <4 x float> @fadd_mismatched_types(<4 x float> %x, <4 x float> %y) {
936 ; CHECK-LABEL: @fadd_mismatched_types(
937 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> poison, <4 x i32> <i32 1, i32 poison, i32 3, i32 poison>
938 ; CHECK-NEXT: [[EXTSHUF:%.*]] = fadd fast <4 x float> [[TMP1:%.*]], [[TMP2]]
939 ; CHECK-NEXT: ret <4 x float> [[EXTSHUF]]
940 ;
941 %shuf.x = shufflevector <4 x float> %x, <4 x float> poison, <2 x i32> <i32 0, i32 2>
942 %shuf.y = shufflevector <4 x float> %y, <4 x float> poison, <2 x i32> <i32 1, i32 3>
943 %fadd = fadd fast <2 x float> %shuf.x, %shuf.y
944 %extshuf = shufflevector <2 x float> %fadd, <2 x float> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
945 ret <4 x float> %extshuf
946 }
947
948 define void @maximal_legal_fpmath(ptr %addr1, ptr %addr2, ptr %result, float %val) {
949 ; CHECK-LABEL: @maximal_legal_fpmath(
950 ; CHECK-NEXT: [[SPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[VAL:%.*]], i64 0
951 ; CHECK-NEXT: [[VEC1:%.*]] = load <16 x float>, ptr [[ADDR1:%.*]], align 4
952 ; CHECK-NEXT: [[VEC2:%.*]] = load <16 x float>, ptr [[ADDR2:%.*]], align 4
953 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[SPLATINSERT]], <4 x float> poison, <16 x i32> zeroinitializer
954 ; CHECK-NEXT: [[TMP2:%.*]] = fmul contract <16 x float> [[TMP1]], [[VEC2]]
955 ; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = fadd reassoc contract <16 x float> [[VEC1]], [[TMP2]]
956 ; CHECK-NEXT: store <16 x float> [[INTERLEAVED_VEC]], ptr [[RESULT:%.*]], align 4
957 ; CHECK-NEXT: ret void
958 ;
959 %splatinsert = insertelement <4 x float> poison, float %val, i64 0
960 %incoming.vec = shufflevector <4 x float> %splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
961
962 %vec1 = load <16 x float>, ptr %addr1, align 4
963 %strided.vec1 = shufflevector <16 x float> %vec1, <16 x float> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
964 %strided.vec2 = shufflevector <16 x float> %vec1, <16 x float> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
965 %strided.vec3 = shufflevector <16 x float> %vec1, <16 x float> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
966 %strided.vec4 = shufflevector <16 x float> %vec1, <16 x float> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
967
968 %vec2 = load <16 x float>, ptr %addr2, align 4
969 %strided.vec6 = shufflevector <16 x float> %vec2, <16 x float> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
970 %strided.vec7 = shufflevector <16 x float> %vec2, <16 x float> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
971 %strided.vec8 = shufflevector <16 x float> %vec2, <16 x float> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
972 %strided.vec9 = shufflevector <16 x float> %vec2, <16 x float> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
973
974 %1 = fmul fast <4 x float> %incoming.vec, %strided.vec6
975 %2 = fadd fast <4 x float> %strided.vec1, %1
976 %3 = fmul contract <4 x float> %incoming.vec, %strided.vec7
977 %4 = fadd fast <4 x float> %strided.vec2, %3
978 %5 = fmul contract reassoc <4 x float> %incoming.vec, %strided.vec8
979 %6 = fadd fast <4 x float> %strided.vec3, %5
980 %7 = fmul contract reassoc <4 x float> %incoming.vec, %strided.vec9
981 %8 = fadd contract reassoc <4 x float> %strided.vec4, %7
982
983 %9 = shufflevector <4 x float> %2, <4 x float> %4, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
984 %10 = shufflevector <4 x float> %6, <4 x float> %8, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
985 %interleaved.vec = shufflevector <8 x float> %9, <8 x float> %10, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15>
986 store <16 x float> %interleaved.vec, ptr %result, align 4
987
988 ret void
989 }
990
991 ; Peek through (repeated) bitcasts to find a common source value.
992 define <4 x i64> @bitcast_smax_v8i32_v4i32(<4 x i64> %a, <4 x i64> %b) {
993 ; CHECK-LABEL: @bitcast_smax_v8i32_v4i32(
994 ; CHECK-NEXT: [[A_BC0:%.*]] = bitcast <4 x i64> [[A:%.*]] to <8 x i32>
995 ; CHECK-NEXT: [[B_BC0:%.*]] = bitcast <4 x i64> [[B:%.*]] to <8 x i32>
996 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt <8 x i32> [[A_BC0]], [[B_BC0]]
997 ; CHECK-NEXT: [[B_BC1:%.*]] = bitcast <4 x i64> [[B]] to <8 x i32>
998 ; CHECK-NEXT: [[A_BC1:%.*]] = bitcast <4 x i64> [[A]] to <8 x i32>
999 ; CHECK-NEXT: [[CONCAT:%.*]] = select <8 x i1> [[CMP]], <8 x i32> [[B_BC1]], <8 x i32> [[A_BC1]]
1000 ; CHECK-NEXT: [[RES:%.*]] = bitcast <8 x i32> [[CONCAT]] to <4 x i64>
1001 ; CHECK-NEXT: ret <4 x i64> [[RES]]
1002 ;
1003 %a.bc0 = bitcast <4 x i64> %a to <8 x i32>
1004 %b.bc0 = bitcast <4 x i64> %b to <8 x i32>
1005 %cmp = icmp slt <8 x i32> %a.bc0, %b.bc0
1006 %cmp.lo = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1007 %cmp.hi = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
1008
1009 %a.bc1 = bitcast <4 x i64> %a to <8 x i32>
1010 %b.bc1 = bitcast <4 x i64> %b to <8 x i32>
1011 %a.lo = shufflevector <8 x i32> %a.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1012 %b.lo = shufflevector <8 x i32> %b.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1013 %lo = select <4 x i1> %cmp.lo, <4 x i32> %b.lo, <4 x i32> %a.lo
1014
1015 %a.bc2 = bitcast <4 x i64> %a to <8 x i32>
1016 %b.bc2 = bitcast <4 x i64> %b to <8 x i32>
1017 %a.hi = shufflevector <8 x i32> %a.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
1018 %b.hi = shufflevector <8 x i32> %b.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
1019 %hi = select <4 x i1> %cmp.hi, <4 x i32> %b.hi, <4 x i32> %a.hi
1020
1021 %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
1022 %res = bitcast <8 x i32> %concat to <4 x i64>
1023 ret <4 x i64> %res
1024 }
1025
1026 define void @bitcast_srcty_mismatch() {
1027 ; CHECK-LABEL: @bitcast_srcty_mismatch(
1028 ; CHECK-NEXT: entry:
1029 ; CHECK-NEXT: [[SHUFFLE_I_I:%.*]] = shufflevector <2 x i64> zeroinitializer, <2 x i64> zeroinitializer, <2 x i32> <i32 1, i32 3>
1030 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i32> zeroinitializer to <4 x float>
1031 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[SHUFFLE_I_I]] to <4 x float>
1032 ; CHECK-NEXT: [[SHUFP_I196:%.*]] = shufflevector <4 x float> [[TMP0]], <4 x float> [[TMP1]], <4 x i32> <i32 2, i32 1, i32 4, i32 7>
1033 ; CHECK-NEXT: store <4 x float> [[SHUFP_I196]], ptr null, align 16
1034 ; CHECK-NEXT: ret void
1035 ;
1036 entry:
1037 %shuffle.i.i = shufflevector <2 x i64> zeroinitializer, <2 x i64> zeroinitializer, <2 x i32> <i32 1, i32 3>
1038 %0 = bitcast <4 x i32> zeroinitializer to <4 x float>
1039 %1 = bitcast <2 x i64> %shuffle.i.i to <4 x float>
1040 %shufp.i196 = shufflevector <4 x float> %0, <4 x float> %1, <4 x i32> <i32 2, i32 1, i32 4, i32 7>
1041 store <4 x float> %shufp.i196, ptr null, align 16
1042 ret void
1043 }
1044
1045 define <2 x float> @first_scalar_select(<2 x float> %0, <2 x float> %1, float %x) {
1046 ; CHECK-LABEL: @first_scalar_select(
1047 ; CHECK-NEXT: entry:
1048 ; CHECK-NEXT: [[CMP_I903:%.*]] = fcmp ogt float [[X:%.*]], 0.000000e+00
1049 ; CHECK-NEXT: [[SEL1639:%.*]] = select i1 [[CMP_I903]], <2 x float> [[TMP0:%.*]], <2 x float> [[TMP1:%.*]]
1050 ; CHECK-NEXT: [[TMP2:%.*]] = fcmp ogt <2 x float> [[TMP0]], zeroinitializer
1051 ; CHECK-NEXT: [[SEL48_I913:%.*]] = select <2 x i1> [[TMP2]], <2 x float> [[TMP0]], <2 x float> [[TMP1]]
1052 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x float> [[SEL1639]], <2 x float> [[SEL48_I913]], <2 x i32> <i32 0, i32 3>
1053 ; CHECK-NEXT: ret <2 x float> [[TMP3]]
1054 ;
1055 entry:
1056 %cmp.i903 = fcmp ogt float %x, 0.000000e+00
1057 %sel1639 = select i1 %cmp.i903, <2 x float> %0, <2 x float> %1
1058 %3 = fcmp ogt <2 x float> %0, zeroinitializer
1059 %sel48.i913 = select <2 x i1> %3, <2 x float> %0, <2 x float> %1
1060 %4 = shufflevector <2 x float> %sel1639, <2 x float> %sel48.i913, <2 x i32> <i32 0, i32 3>
1061 ret <2 x float> %4
1062 }
1063
1064 define <16 x i64> @operandbundles(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c) {
1065 ; CHECK-LABEL: @operandbundles(
1066 ; CHECK-NEXT: [[CALL:%.*]] = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <4 x i64> [[C:%.*]]) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1067 ; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <4 x i64> [[CALL]], <4 x i64> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
1068 ; CHECK-NEXT: [[SHUFFLEVECTOR1:%.*]] = shufflevector <16 x i64> [[SHUFFLEVECTOR]], <16 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1069 ; CHECK-NEXT: ret <16 x i64> [[SHUFFLEVECTOR1]]
1070 ;
1071 %call = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1072 %shufflevector = shufflevector <4 x i64> %call, <4 x i64> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
1073 %shufflevector1 = shufflevector <16 x i64> %shufflevector, <16 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1074 ret <16 x i64> %shufflevector1
1075 }
1076
1077 define <8 x i8> @operandbundles_first(<8 x i8> %a) {
1078 ; CHECK-LABEL: @operandbundles_first(
1079 ; CHECK-NEXT: [[AT:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1080 ; CHECK-NEXT: [[ABT:%.*]] = call <4 x i8> @llvm.abs.v4i8(<4 x i8> [[AT]], i1 false) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1081 ; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.abs.v8i8(<8 x i8> [[A]], i1 false)
1082 ; CHECK-NEXT: ret <8 x i8> [[R]]
1083 ;
1084 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1085 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1086 %abt = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %at, i1 false) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1087 %abb = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %ab, i1 false)
1088 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
1089 ret <8 x i8> %r
1090 }
1091
1092 define <8 x i8> @operandbundles_second(<8 x i8> %a) {
1093 ; CHECK-LABEL: @operandbundles_second(
1094 ; CHECK-NEXT: [[AB:%.*]] = shufflevector <8 x i8> [[A:%.*]], <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1095 ; CHECK-NEXT: [[ABB:%.*]] = call <4 x i8> @llvm.abs.v4i8(<4 x i8> [[AB]], i1 false) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1096 ; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.abs.v8i8(<8 x i8> [[A]], i1 false)
1097 ; CHECK-NEXT: ret <8 x i8> [[R]]
1098 ;
1099 %ab = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1100 %at = shufflevector <8 x i8> %a, <8 x i8> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1101 %abt = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %at, i1 false)
1102 %abb = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %ab, i1 false) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
1103 %r = shufflevector <4 x i8> %abt, <4 x i8> %abb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
1104 ret <8 x i8> %r
1105 }
1106
1107 define <8 x i32> @fptoi(<8 x float> %a, <8 x float> %b) {
1108 ; CHECK-LABEL: @fptoi(
1109 ; CHECK-NEXT: [[TMP1:%.*]] = fptosi <8 x float> [[A:%.*]] to <8 x i32>
1110 ; CHECK-NEXT: [[TMP2:%.*]] = fptoui <8 x float> [[B:%.*]] to <8 x i32>
1111 ; CHECK-NEXT: [[R:%.*]] = mul <8 x i32> [[TMP1]], [[TMP2]]
1112 ; CHECK-NEXT: ret <8 x i32> [[R]]
1113 ;
1114 %ab = shufflevector <8 x float> %a, <8 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1115 %at = shufflevector <8 x float> %a, <8 x float> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1116 %bb = shufflevector <8 x float> %b, <8 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1117 %bt = shufflevector <8 x float> %b, <8 x float> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1118 %abt = fptosi <4 x float> %at to <4 x i32>
1119 %abb = fptosi <4 x float> %ab to <4 x i32>
1120 %bbt = fptoui <4 x float> %bt to <4 x i32>
1121 %bbb = fptoui <4 x float> %bb to <4 x i32>
1122 %mt = mul <4 x i32> %abt, %bbt
1123 %mb = mul <4 x i32> %abb, %bbb
1124 %r = shufflevector <4 x i32> %mt, <4 x i32> %mb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
1125 ret <8 x i32> %r
1126 }
1127
1128 define <8 x half> @itofp(<8 x i16> %a, <8 x i16> %b) {
1129 ; CHECK-LABEL: @itofp(
1130 ; CHECK-NEXT: [[TMP1:%.*]] = sitofp <8 x i16> [[A:%.*]] to <8 x half>
1131 ; CHECK-NEXT: [[TMP2:%.*]] = uitofp <8 x i16> [[B:%.*]] to <8 x half>
1132 ; CHECK-NEXT: [[R:%.*]] = fmul <8 x half> [[TMP1]], [[TMP2]]
1133 ; CHECK-NEXT: ret <8 x half> [[R]]
1134 ;
1135 %ab = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1136 %at = shufflevector <8 x i16> %a, <8 x i16> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1137 %bb = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1138 %bt = shufflevector <8 x i16> %b, <8 x i16> poison, <4 x i32> <i32 7, i32 6, i32 5, i32 4>
1139 %abt = sitofp <4 x i16> %at to <4 x half>
1140 %abb = sitofp <4 x i16> %ab to <4 x half>
1141 %bbt = uitofp <4 x i16> %bt to <4 x half>
1142 %bbb = uitofp <4 x i16> %bb to <4 x half>
1143 %mt = fmul <4 x half> %abt, %bbt
1144 %mb = fmul <4 x half> %abb, %bbb
1145 %r = shufflevector <4 x half> %mt, <4 x half> %mb, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
1146 ret <8 x half> %r
1147 }
1148
1149 define <16 x i32> @const_types(<16 x i32> %wide.vec, <16 x i32> %wide.vec116) {
1150 ; CHECK-LABEL: @const_types(
1151 ; CHECK-NEXT: [[TMP1:%.*]] = sext <16 x i32> [[WIDE_VEC116:%.*]] to <16 x i64>
1152 ; CHECK-NEXT: [[TMP2:%.*]] = sext <16 x i32> [[WIDE_VEC:%.*]] to <16 x i64>
1153 ; CHECK-NEXT: [[TMP3:%.*]] = mul nsw <16 x i64> [[TMP1]], [[TMP2]]
1154 ; CHECK-NEXT: [[TMP4:%.*]] = lshr <16 x i64> [[TMP3]], splat (i64 32)
1155 ; CHECK-NEXT: [[TMP5:%.*]] = trunc nuw <16 x i64> [[TMP4]] to <16 x i32>
1156 ; CHECK-NEXT: [[TMP6:%.*]] = call <16 x i32> @llvm.smin.v16i32(<16 x i32> [[TMP5]], <16 x i32> splat (i32 1073741823))
1157 ; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shl <16 x i32> [[TMP6]], splat (i32 1)
1158 ; CHECK-NEXT: ret <16 x i32> [[INTERLEAVED_VEC]]
1159 ;
1160 %strided.vec = shufflevector <16 x i32> %wide.vec, <16 x i32> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
1161 %strided.vec113 = shufflevector <16 x i32> %wide.vec, <16 x i32> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
1162 %strided.vec114 = shufflevector <16 x i32> %wide.vec, <16 x i32> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
1163 %strided.vec115 = shufflevector <16 x i32> %wide.vec, <16 x i32> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
1164 %10 = sext <4 x i32> %strided.vec to <4 x i64>
1165 %strided.vec117 = shufflevector <16 x i32> %wide.vec116, <16 x i32> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
1166 %strided.vec118 = shufflevector <16 x i32> %wide.vec116, <16 x i32> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
1167 %strided.vec119 = shufflevector <16 x i32> %wide.vec116, <16 x i32> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
1168 %strided.vec120 = shufflevector <16 x i32> %wide.vec116, <16 x i32> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
1169 %11 = sext <4 x i32> %strided.vec117 to <4 x i64>
1170 %12 = mul nsw <4 x i64> %11, %10
1171 %13 = lshr <4 x i64> %12, splat (i64 32)
1172 %14 = trunc nuw <4 x i64> %13 to <4 x i32>
1173 %15 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %14, <4 x i32> splat (i32 1073741823))
1174 %16 = shl <4 x i32> %15, splat (i32 1)
1175 %17 = sext <4 x i32> %strided.vec113 to <4 x i64>
1176 %18 = sext <4 x i32> %strided.vec118 to <4 x i64>
1177 %19 = mul nsw <4 x i64> %18, %17
1178 %20 = lshr <4 x i64> %19, splat (i64 32)
1179 %21 = trunc nuw <4 x i64> %20 to <4 x i32>
1180 %22 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %21, <4 x i32> splat (i32 1073741823))
1181 %23 = shl <4 x i32> %22, splat (i32 1)
1182 %24 = sext <4 x i32> %strided.vec114 to <4 x i64>
1183 %25 = sext <4 x i32> %strided.vec119 to <4 x i64>
1184 %26 = mul nsw <4 x i64> %25, %24
1185 %27 = lshr <4 x i64> %26, splat (i64 32)
1186 %28 = trunc nuw <4 x i64> %27 to <4 x i32>
1187 %29 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %28, <4 x i32> splat (i32 1073741823))
1188 %30 = shl <4 x i32> %29, splat (i32 1)
1189 %31 = sext <4 x i32> %strided.vec115 to <4 x i64>
1190 %32 = sext <4 x i32> %strided.vec120 to <4 x i64>
1191 %33 = mul nsw <4 x i64> %32, %31
1192 %34 = lshr <4 x i64> %33, splat (i64 32)
1193 %35 = trunc nuw <4 x i64> %34 to <4 x i32>
1194 %36 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %35, <4 x i32> splat (i32 1073741823))
1195 %37 = shl <4 x i32> %36, splat (i32 1)
1196 %38 = shufflevector <4 x i32> %16, <4 x i32> %23, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
1197 %39 = shufflevector <4 x i32> %30, <4 x i32> %37, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
1198 %interleaved.vec = shufflevector <8 x i32> %38, <8 x i32> %39, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15>
1199 ret <16 x i32> %interleaved.vec
1200 }
1201
1202 define <32 x half> @cast_types(<32 x i16> %wide.vec) {
1203 ; CHECK-LABEL: @cast_types(
1204 ; CHECK-NEXT: [[TMP1:%.*]] = sitofp <32 x i16> [[WIDE_VEC:%.*]] to <32 x half>
1205 ; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = fmul fast <32 x half> [[TMP1]], splat (half 0xH0200)
1206 ; CHECK-NEXT: ret <32 x half> [[INTERLEAVED_VEC]]
1207 ;
1208 %strided.vec = shufflevector <32 x i16> %wide.vec, <32 x i16> poison, <8 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28>
1209 %strided.vec49 = shufflevector <32 x i16> %wide.vec, <32 x i16> poison, <8 x i32> <i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29>
1210 %strided.vec50 = shufflevector <32 x i16> %wide.vec, <32 x i16> poison, <8 x i32> <i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30>
1211 %strided.vec51 = shufflevector <32 x i16> %wide.vec, <32 x i16> poison, <8 x i32> <i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31>
1212 %5 = sitofp <8 x i16> %strided.vec to <8 x half>
1213 %6 = fmul fast <8 x half> %5, splat (half 0xH0200)
1214 %7 = sitofp <8 x i16> %strided.vec49 to <8 x half>
1215 %8 = fmul fast <8 x half> %7, splat (half 0xH0200)
1216 %9 = sitofp <8 x i16> %strided.vec50 to <8 x half>
1217 %10 = fmul fast <8 x half> %9, splat (half 0xH0200)
1218 %11 = sitofp <8 x i16> %strided.vec51 to <8 x half>
1219 %12 = fmul fast <8 x half> %11, splat (half 0xH0200)
1220 %13 = shufflevector <8 x half> %6, <8 x half> %8, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
1221 %14 = shufflevector <8 x half> %10, <8 x half> %12, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
1222 %interleaved.vec = shufflevector <16 x half> %13, <16 x half> %14, <32 x i32> <i32 0, i32 8, i32 16, i32 24, i32 1, i32 9, i32 17, i32 25, i32 2, i32 10, i32 18, i32 26, i32 3, i32 11, i32 19, i32 27, i32 4, i32 12, i32 20, i32 28, i32 5, i32 13, i32 21, i32 29, i32 6, i32 14, i32 22, i32 30, i32 7, i32 15, i32 23, i32 31>
1223 ret <32 x half> %interleaved.vec
1224 }
1225
1226 define i32 @shuffle_different_lanes(<2 x i64> %0) {
1227 ; CHECK-LABEL: @shuffle_different_lanes(
1228 ; CHECK-NEXT: entry:
1229 ; CHECK-NEXT: [[TMP1:%.*]] = trunc <2 x i64> [[TMP0:%.*]] to <2 x i16>
1230 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i64> [[TMP0]], <2 x i64> poison, <2 x i32> <i32 1, i32 1>
1231 ; CHECK-NEXT: [[TMP4:%.*]] = trunc <2 x i64> [[TMP2]] to <2 x i16>
1232 ; CHECK-NEXT: [[SHUFFLE_I:%.*]] = sub <2 x i16> [[TMP1]], [[TMP4]]
1233 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast <2 x i16> [[SHUFFLE_I]] to i32
1234 ; CHECK-NEXT: ret i32 [[TMP3]]
1235 ;
1236 entry:
1237 %shuffle = shufflevector <2 x i64> %0, <2 x i64> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
1238 %conv = trunc <4 x i64> %shuffle to <4 x i16>
1239 %vecinit4.i = shufflevector <4 x i16> %conv, <4 x i16> poison, <4 x i32> <i32 2, i32 poison, i32 2, i32 poison>
1240 %sub.i = sub <4 x i16> %conv, %vecinit4.i
1241 %shuffle.i = shufflevector <4 x i16> %sub.i, <4 x i16> poison, <2 x i32> <i32 0, i32 2>
1242 %1 = bitcast <2 x i16> %shuffle.i to i32
1243 ret i32 %1
1244 }
1245
1246 define <48 x i8> @concat_splats(<64 x i8> %wide.vec, <64 x i8> %wide.vec117) {
1247 ; CHECK-LABEL: @concat_splats(
1248 ; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <64 x i8> [[WIDE_VEC:%.*]], <64 x i8> poison, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 32, i32 36, i32 40, i32 44, i32 48, i32 52, i32 56, i32 60>
1249 ; CHECK-NEXT: [[STRIDED_VEC114:%.*]] = shufflevector <64 x i8> [[WIDE_VEC]], <64 x i8> poison, <16 x i32> <i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29, i32 33, i32 37, i32 41, i32 45, i32 49, i32 53, i32 57, i32 61>
1250 ; CHECK-NEXT: [[STRIDED_VEC115:%.*]] = shufflevector <64 x i8> [[WIDE_VEC]], <64 x i8> poison, <16 x i32> <i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30, i32 34, i32 38, i32 42, i32 46, i32 50, i32 54, i32 58, i32 62>
1251 ; CHECK-NEXT: [[STRIDED_VEC116:%.*]] = shufflevector <64 x i8> [[WIDE_VEC]], <64 x i8> poison, <16 x i32> <i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31, i32 35, i32 39, i32 43, i32 47, i32 51, i32 55, i32 59, i32 63>
1252 ; CHECK-NEXT: [[TMP1:%.*]] = zext <16 x i8> [[STRIDED_VEC]] to <16 x i32>
1253 ; CHECK-NEXT: [[TMP2:%.*]] = mul nuw nsw <16 x i32> [[TMP1]], splat (i32 3)
1254 ; CHECK-NEXT: [[TMP3:%.*]] = zext <16 x i8> [[STRIDED_VEC114]] to <16 x i32>
1255 ; CHECK-NEXT: [[TMP4:%.*]] = zext <16 x i8> [[STRIDED_VEC115]] to <16 x i32>
1256 ; CHECK-NEXT: [[TMP5:%.*]] = zext <16 x i8> [[STRIDED_VEC116]] to <16 x i32>
1257 ; CHECK-NEXT: [[TMP6:%.*]] = mul nuw nsw <16 x i32> [[TMP5]], splat (i32 3)
1258 ; CHECK-NEXT: [[TMP7:%.*]] = add nuw nsw <16 x i32> [[TMP4]], splat (i32 2)
1259 ; CHECK-NEXT: [[TMP8:%.*]] = add nuw nsw <16 x i32> [[TMP7]], [[TMP6]]
1260 ; CHECK-NEXT: [[TMP9:%.*]] = lshr <16 x i32> [[TMP8]], splat (i32 2)
1261 ; CHECK-NEXT: [[STRIDED_VEC118:%.*]] = shufflevector <64 x i8> [[WIDE_VEC117:%.*]], <64 x i8> poison, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 32, i32 36, i32 40, i32 44, i32 48, i32 52, i32 56, i32 60>
1262 ; CHECK-NEXT: [[STRIDED_VEC119:%.*]] = shufflevector <64 x i8> [[WIDE_VEC117]], <64 x i8> poison, <16 x i32> <i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29, i32 33, i32 37, i32 41, i32 45, i32 49, i32 53, i32 57, i32 61>
1263 ; CHECK-NEXT: [[STRIDED_VEC120:%.*]] = shufflevector <64 x i8> [[WIDE_VEC117]], <64 x i8> poison, <16 x i32> <i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30, i32 34, i32 38, i32 42, i32 46, i32 50, i32 54, i32 58, i32 62>
1264 ; CHECK-NEXT: [[STRIDED_VEC121:%.*]] = shufflevector <64 x i8> [[WIDE_VEC117]], <64 x i8> poison, <16 x i32> <i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31, i32 35, i32 39, i32 43, i32 47, i32 51, i32 55, i32 59, i32 63>
1265 ; CHECK-NEXT: [[TMP10:%.*]] = zext <16 x i8> [[STRIDED_VEC118]] to <16 x i32>
1266 ; CHECK-NEXT: [[TMP11:%.*]] = mul nuw nsw <16 x i32> [[TMP10]], splat (i32 3)
1267 ; CHECK-NEXT: [[TMP12:%.*]] = zext <16 x i8> [[STRIDED_VEC119]] to <16 x i32>
1268 ; CHECK-NEXT: [[TMP13:%.*]] = zext <16 x i8> [[STRIDED_VEC120]] to <16 x i32>
1269 ; CHECK-NEXT: [[TMP14:%.*]] = zext <16 x i8> [[STRIDED_VEC121]] to <16 x i32>
1270 ; CHECK-NEXT: [[TMP15:%.*]] = mul nuw nsw <16 x i32> [[TMP14]], splat (i32 3)
1271 ; CHECK-NEXT: [[TMP16:%.*]] = add nuw nsw <16 x i32> [[TMP13]], splat (i32 2)
1272 ; CHECK-NEXT: [[TMP17:%.*]] = add nuw nsw <16 x i32> [[TMP16]], [[TMP15]]
1273 ; CHECK-NEXT: [[TMP18:%.*]] = lshr <16 x i32> [[TMP17]], splat (i32 2)
1274 ; CHECK-NEXT: [[TMP19:%.*]] = mul nuw nsw <16 x i32> [[TMP9]], splat (i32 3)
1275 ; CHECK-NEXT: [[TMP20:%.*]] = add nuw nsw <16 x i32> [[TMP19]], splat (i32 2)
1276 ; CHECK-NEXT: [[TMP21:%.*]] = add nuw nsw <16 x i32> [[TMP20]], [[TMP18]]
1277 ; CHECK-NEXT: [[TMP22:%.*]] = lshr <16 x i32> [[TMP21]], splat (i32 2)
1278 ; CHECK-NEXT: [[TMP23:%.*]] = trunc nuw <16 x i32> [[TMP22]] to <16 x i8>
1279 ; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <16 x i32> [[TMP3]], <16 x i32> [[TMP3]], <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1280 ; CHECK-NEXT: [[TMP25:%.*]] = add nuw nsw <32 x i32> [[TMP24]], <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1281 ; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <16 x i32> [[TMP2]], <16 x i32> [[TMP4]], <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1282 ; CHECK-NEXT: [[TMP27:%.*]] = add nuw nsw <32 x i32> [[TMP25]], [[TMP26]]
1283 ; CHECK-NEXT: [[TMP28:%.*]] = lshr <32 x i32> [[TMP27]], <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1284 ; CHECK-NEXT: [[TMP29:%.*]] = mul nuw nsw <32 x i32> [[TMP28]], splat (i32 3)
1285 ; CHECK-NEXT: [[TMP30:%.*]] = add nuw nsw <32 x i32> [[TMP29]], splat (i32 2)
1286 ; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <16 x i32> [[TMP12]], <16 x i32> [[TMP12]], <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1287 ; CHECK-NEXT: [[TMP32:%.*]] = add nuw nsw <32 x i32> [[TMP31]], <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1288 ; CHECK-NEXT: [[TMP33:%.*]] = shufflevector <16 x i32> [[TMP11]], <16 x i32> [[TMP13]], <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1289 ; CHECK-NEXT: [[TMP34:%.*]] = add nuw nsw <32 x i32> [[TMP32]], [[TMP33]]
1290 ; CHECK-NEXT: [[TMP35:%.*]] = lshr <32 x i32> [[TMP34]], <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1291 ; CHECK-NEXT: [[TMP36:%.*]] = add nuw nsw <32 x i32> [[TMP30]], [[TMP35]]
1292 ; CHECK-NEXT: [[TMP37:%.*]] = lshr <32 x i32> [[TMP36]], splat (i32 2)
1293 ; CHECK-NEXT: [[TMP38:%.*]] = trunc nuw <32 x i32> [[TMP37]] to <32 x i8>
1294 ; CHECK-NEXT: [[TMP39:%.*]] = shufflevector <16 x i8> [[TMP23]], <16 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
1295 ; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <32 x i8> [[TMP38]], <32 x i8> [[TMP39]], <48 x i32> <i32 0, i32 16, i32 32, i32 1, i32 17, i32 33, i32 2, i32 18, i32 34, i32 3, i32 19, i32 35, i32 4, i32 20, i32 36, i32 5, i32 21, i32 37, i32 6, i32 22, i32 38, i32 7, i32 23, i32 39, i32 8, i32 24, i32 40, i32 9, i32 25, i32 41, i32 10, i32 26, i32 42, i32 11, i32 27, i32 43, i32 12, i32 28, i32 44, i32 13, i32 29, i32 45, i32 14, i32 30, i32 46, i32 15, i32 31, i32 47>
1296 ; CHECK-NEXT: ret <48 x i8> [[INTERLEAVED_VEC]]
1297 ;
1298 %strided.vec = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 32, i32 36, i32 40, i32 44, i32 48, i32 52, i32 56, i32 60>
1299 %strided.vec114 = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <16 x i32> <i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29, i32 33, i32 37, i32 41, i32 45, i32 49, i32 53, i32 57, i32 61>
1300 %strided.vec115 = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <16 x i32> <i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30, i32 34, i32 38, i32 42, i32 46, i32 50, i32 54, i32 58, i32 62>
1301 %strided.vec116 = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <16 x i32> <i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31, i32 35, i32 39, i32 43, i32 47, i32 51, i32 55, i32 59, i32 63>
1302 %22 = zext <16 x i8> %strided.vec to <16 x i32>
1303 %23 = mul nuw nsw <16 x i32> %22, splat (i32 3)
1304 %24 = zext <16 x i8> %strided.vec114 to <16 x i32>
1305 %25 = add nuw nsw <16 x i32> %24, splat (i32 2)
1306 %26 = add nuw nsw <16 x i32> %25, %23
1307 %27 = lshr <16 x i32> %26, splat (i32 2)
1308 %28 = zext <16 x i8> %strided.vec115 to <16 x i32>
1309 %29 = add nuw nsw <16 x i32> %24, splat (i32 1)
1310 %30 = add nuw nsw <16 x i32> %29, %28
1311 %31 = lshr <16 x i32> %30, splat (i32 1)
1312 %32 = zext <16 x i8> %strided.vec116 to <16 x i32>
1313 %33 = mul nuw nsw <16 x i32> %32, splat (i32 3)
1314 %34 = add nuw nsw <16 x i32> %28, splat (i32 2)
1315 %35 = add nuw nsw <16 x i32> %34, %33
1316 %36 = lshr <16 x i32> %35, splat (i32 2)
1317 %strided.vec118 = shufflevector <64 x i8> %wide.vec117, <64 x i8> poison, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 32, i32 36, i32 40, i32 44, i32 48, i32 52, i32 56, i32 60>
1318 %strided.vec119 = shufflevector <64 x i8> %wide.vec117, <64 x i8> poison, <16 x i32> <i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29, i32 33, i32 37, i32 41, i32 45, i32 49, i32 53, i32 57, i32 61>
1319 %strided.vec120 = shufflevector <64 x i8> %wide.vec117, <64 x i8> poison, <16 x i32> <i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30, i32 34, i32 38, i32 42, i32 46, i32 50, i32 54, i32 58, i32 62>
1320 %strided.vec121 = shufflevector <64 x i8> %wide.vec117, <64 x i8> poison, <16 x i32> <i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31, i32 35, i32 39, i32 43, i32 47, i32 51, i32 55, i32 59, i32 63>
1321 %37 = zext <16 x i8> %strided.vec118 to <16 x i32>
1322 %38 = mul nuw nsw <16 x i32> %37, splat (i32 3)
1323 %39 = zext <16 x i8> %strided.vec119 to <16 x i32>
1324 %40 = add nuw nsw <16 x i32> %39, splat (i32 2)
1325 %41 = add nuw nsw <16 x i32> %40, %38
1326 %42 = lshr <16 x i32> %41, splat (i32 2)
1327 %43 = zext <16 x i8> %strided.vec120 to <16 x i32>
1328 %44 = add nuw nsw <16 x i32> %39, splat (i32 1)
1329 %45 = add nuw nsw <16 x i32> %44, %43
1330 %46 = lshr <16 x i32> %45, splat (i32 1)
1331 %47 = zext <16 x i8> %strided.vec121 to <16 x i32>
1332 %48 = mul nuw nsw <16 x i32> %47, splat (i32 3)
1333 %49 = add nuw nsw <16 x i32> %43, splat (i32 2)
1334 %50 = add nuw nsw <16 x i32> %49, %48
1335 %51 = lshr <16 x i32> %50, splat (i32 2)
1336 %52 = mul nuw nsw <16 x i32> %27, splat (i32 3)
1337 %53 = add nuw nsw <16 x i32> %52, splat (i32 2)
1338 %54 = add nuw nsw <16 x i32> %53, %42
1339 %55 = lshr <16 x i32> %54, splat (i32 2)
1340 %56 = trunc nuw <16 x i32> %55 to <16 x i8>
1341 %57 = mul nuw nsw <16 x i32> %31, splat (i32 3)
1342 %58 = add nuw nsw <16 x i32> %57, splat (i32 2)
1343 %59 = add nuw nsw <16 x i32> %58, %46
1344 %60 = lshr <16 x i32> %59, splat (i32 2)
1345 %61 = trunc nuw <16 x i32> %60 to <16 x i8>
1346 %62 = mul nuw nsw <16 x i32> %36, splat (i32 3)
1347 %63 = add nuw nsw <16 x i32> %62, splat (i32 2)
1348 %64 = add nuw nsw <16 x i32> %63, %51
1349 %65 = lshr <16 x i32> %64, splat (i32 2)
1350 %66 = trunc nuw <16 x i32> %65 to <16 x i8>
1351 %67 = shufflevector <16 x i8> %56, <16 x i8> %61, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
1352 %68 = shufflevector <16 x i8> %66, <16 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
1353 %interleaved.vec = shufflevector <32 x i8> %67, <32 x i8> %68, <48 x i32> <i32 0, i32 16, i32 32, i32 1, i32 17, i32 33, i32 2, i32 18, i32 34, i32 3, i32 19, i32 35, i32 4, i32 20, i32 36, i32 5, i32 21, i32 37, i32 6, i32 22, i32 38, i32 7, i32 23, i32 39, i32 8, i32 24, i32 40, i32 9, i32 25, i32 41, i32 10, i32 26, i32 42, i32 11, i32 27, i32 43, i32 12, i32 28, i32 44, i32 13, i32 29, i32 45, i32 14, i32 30, i32 46, i32 15, i32 31, i32 47>
1354 ret <48 x i8> %interleaved.vec
1355 }
1356
1357 declare <4 x i64> @llvm.fshl.v4i64(<4 x i64>, <4 x i64>, <4 x i64>)
1358 declare void @use(<4 x i8>)