1*9880d681SAndroid Build Coastguard Worker; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mattr=+sse4.2 | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-unknown" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; widening shuffle v3float and then a add 7*9880d681SAndroid Build Coastguard Workerdefine void @shuf(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind { 8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: shuf: 9*9880d681SAndroid Build Coastguard Worker; CHECK: # BB#0: # %entry 10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: addps %xmm1, %xmm0 12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: extractps $2, %xmm0, 8(%eax) 13*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: extractps $1, %xmm0, 4(%eax) 14*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movss %xmm0, (%eax) 15*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: retl 16*9880d681SAndroid Build Coastguard Workerentry: 17*9880d681SAndroid Build Coastguard Worker %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 1, i32 2> 18*9880d681SAndroid Build Coastguard Worker %val = fadd <3 x float> %x, %src2 19*9880d681SAndroid Build Coastguard Worker store <3 x float> %val, <3 x float>* %dst.addr 20*9880d681SAndroid Build Coastguard Worker ret void 21*9880d681SAndroid Build Coastguard Worker} 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; widening shuffle v3float with a different mask and then a add 25*9880d681SAndroid Build Coastguard Workerdefine void @shuf2(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind { 26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: shuf2: 27*9880d681SAndroid Build Coastguard Worker; CHECK: # BB#0: # %entry 28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 29*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3] 30*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: addps %xmm1, %xmm0 31*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: extractps $2, %xmm0, 8(%eax) 32*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: extractps $1, %xmm0, 4(%eax) 33*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movss %xmm0, (%eax) 34*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: retl 35*9880d681SAndroid Build Coastguard Workerentry: 36*9880d681SAndroid Build Coastguard Worker %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 4, i32 2> 37*9880d681SAndroid Build Coastguard Worker %val = fadd <3 x float> %x, %src2 38*9880d681SAndroid Build Coastguard Worker store <3 x float> %val, <3 x float>* %dst.addr 39*9880d681SAndroid Build Coastguard Worker ret void 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker; Example of when widening a v3float operation causes the DAG to replace a node 43*9880d681SAndroid Build Coastguard Worker; with the operation that we are currently widening, i.e. when replacing 44*9880d681SAndroid Build Coastguard Worker; opA with opB, the DAG will produce new operations with opA. 45*9880d681SAndroid Build Coastguard Workerdefine void @shuf3(<4 x float> %tmp10, <4 x float> %vecinit15, <4 x float>* %dst) nounwind { 46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: shuf3: 47*9880d681SAndroid Build Coastguard Worker; CHECK: # BB#0: # %entry 48*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 49*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0,0,0] 50*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movaps %xmm1, (%eax) 51*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: retl 52*9880d681SAndroid Build Coastguard Workerentry: 53*9880d681SAndroid Build Coastguard Worker %shuffle.i.i.i12 = shufflevector <4 x float> %tmp10, <4 x float> %vecinit15, <4 x i32> <i32 0, i32 1, i32 4, i32 5> 54*9880d681SAndroid Build Coastguard Worker %tmp25.i.i = shufflevector <4 x float> %shuffle.i.i.i12, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> 55*9880d681SAndroid Build Coastguard Worker %tmp1.i.i = shufflevector <3 x float> %tmp25.i.i, <3 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 56*9880d681SAndroid Build Coastguard Worker %tmp3.i13 = shufflevector <4 x float> %tmp1.i.i, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> ; <<3 x float>> 57*9880d681SAndroid Build Coastguard Worker %tmp6.i14 = shufflevector <3 x float> %tmp3.i13, <3 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 58*9880d681SAndroid Build Coastguard Worker %tmp97.i = shufflevector <4 x float> %tmp6.i14, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> 59*9880d681SAndroid Build Coastguard Worker %tmp2.i18 = shufflevector <3 x float> %tmp97.i, <3 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 2> 60*9880d681SAndroid Build Coastguard Worker %t5 = bitcast <4 x float> %tmp2.i18 to <4 x i32> 61*9880d681SAndroid Build Coastguard Worker %shr.i.i19 = lshr <4 x i32> %t5, <i32 19, i32 19, i32 19, i32 19> 62*9880d681SAndroid Build Coastguard Worker %and.i.i20 = and <4 x i32> %shr.i.i19, <i32 4080, i32 4080, i32 4080, i32 4080> 63*9880d681SAndroid Build Coastguard Worker %shuffle.i.i.i21 = shufflevector <4 x float> %tmp2.i18, <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3> 64*9880d681SAndroid Build Coastguard Worker store <4 x float> %shuffle.i.i.i21, <4 x float>* %dst 65*9880d681SAndroid Build Coastguard Worker ret void 66*9880d681SAndroid Build Coastguard Worker} 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker; PR10421: make sure we correctly handle extreme widening with CONCAT_VECTORS 69*9880d681SAndroid Build Coastguard Workerdefine <8 x i8> @shuf4(<4 x i8> %a, <4 x i8> %b) nounwind readnone { 70*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: shuf4: 71*9880d681SAndroid Build Coastguard Worker; CHECK: # BB#0: 72*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15] 73*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: pshufb %xmm2, %xmm1 74*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: pshufb %xmm2, %xmm0 75*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0] 76*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: retl 77*9880d681SAndroid Build Coastguard Worker %vshuf = shufflevector <4 x i8> %a, <4 x i8> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> 78*9880d681SAndroid Build Coastguard Worker ret <8 x i8> %vshuf 79*9880d681SAndroid Build Coastguard Worker} 80*9880d681SAndroid Build Coastguard Worker 81*9880d681SAndroid Build Coastguard Worker; PR11389: another CONCAT_VECTORS case 82*9880d681SAndroid Build Coastguard Workerdefine void @shuf5(<8 x i8>* %p) nounwind { 83*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: shuf5: 84*9880d681SAndroid Build Coastguard Worker; CHECK: # BB#0: 85*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 86*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movdqa {{.*#+}} xmm0 = [33,33,33,33,33,33,33,33] 87*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0,2,4,6,8,10,12,14,u,u,u,u,u,u,u,u] 88*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movq %xmm0, (%eax) 89*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: retl 90*9880d681SAndroid Build Coastguard Worker %v = shufflevector <2 x i8> <i8 4, i8 33>, <2 x i8> undef, <8 x i32> <i32 1, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 91*9880d681SAndroid Build Coastguard Worker store <8 x i8> %v, <8 x i8>* %p, align 8 92*9880d681SAndroid Build Coastguard Worker ret void 93*9880d681SAndroid Build Coastguard Worker} 94