153
153
ret <8 x i8> %tmp3
156
; We should form a shuffle out of a select with constant condition.
157
define <4 x i16> @test13a(<4 x i16> %lhs, <4 x i16> %rhs) {
159
; CHECK-NEXT: shufflevector <4 x i16> %lhs, <4 x i16> %rhs, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
161
%A = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>,
162
<4 x i16> %lhs, <4 x i16> %rhs
166
define <4 x i16> @test13b(<4 x i16> %lhs, <4 x i16> %rhs) {
168
; CHECK-NEXT: ret <4 x i16> %lhs
169
%A = select <4 x i1> <i1 true, i1 undef, i1 true, i1 true>,
170
<4 x i16> %lhs, <4 x i16> %rhs
174
define <4 x i16> @test13c(<4 x i16> %lhs, <4 x i16> %rhs) {
176
; CHECK-NEXT: shufflevector <4 x i16> %lhs, <4 x i16> %rhs, <4 x i32> <i32 0, i32 undef, i32 2, i32 7>
178
%A = select <4 x i1> <i1 true, i1 undef, i1 true, i1 false>,
179
<4 x i16> %lhs, <4 x i16> %rhs
183
define <4 x i16> @test13d(<4 x i16> %lhs, <4 x i16> %rhs) {
187
%A = select <4 x i1> <i1 true, i1 icmp ugt (<4 x i16>(<4 x i16>, <4 x i16>)* @test13a, <4 x i16>(<4 x i16>, <4 x i16>)* @test13b), i1 true, i1 false>,
188
<4 x i16> %lhs, <4 x i16> %rhs
192
define <4 x i16> @test13e(<4 x i16> %lhs, <4 x i16> %rhs) {
194
; CHECK-NEXT: ret <4 x i16> %rhs
195
%A = select <4 x i1> <i1 false, i1 false, i1 false, i1 false>,
196
<4 x i16> %lhs, <4 x i16> %rhs
200
; Check that sequences of insert/extract element are
201
; collapsed into shuffle instruction with correct shuffle indexes.
203
define <4 x float> @test14a(<4 x float> %LHS, <4 x float> %RHS) {
205
; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 0, i32 6, i32 6>
206
; CHECK-NEXT: ret <4 x float> %tmp4
207
%tmp1 = extractelement <4 x float> %LHS, i32 0
208
%tmp2 = insertelement <4 x float> %RHS, float %tmp1, i32 1
209
%tmp3 = extractelement <4 x float> %RHS, i32 2
210
%tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 3
211
ret <4 x float> %tmp4
214
define <4 x float> @test14b(<4 x float> %LHS, <4 x float> %RHS) {
216
; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 3, i32 6, i32 6>
217
; CHECK-NEXT: ret <4 x float> %tmp5
218
%tmp0 = extractelement <4 x float> %LHS, i32 3
219
%tmp1 = insertelement <4 x float> %RHS, float %tmp0, i32 0
220
%tmp2 = extractelement <4 x float> %tmp1, i32 0
221
%tmp3 = insertelement <4 x float> %RHS, float %tmp2, i32 1
222
%tmp4 = extractelement <4 x float> %RHS, i32 2
223
%tmp5 = insertelement <4 x float> %tmp3, float %tmp4, i32 3
224
ret <4 x float> %tmp5