100 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2 | FileCheck %s3 4define <8 x i16> @commute_fold_vpblendw_128(<8 x i16> %a, ptr %b) #0 {5; CHECK-LABEL: commute_fold_vpblendw_128:6; CHECK: # %bb.0:7; CHECK-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],mem[1,2,3],xmm0[4],mem[5,6,7]8; CHECK-NEXT: retq9 %1 = load <8 x i16>, ptr %b10 %2 = call <8 x i16> @llvm.x86.sse41.pblendw(<8 x i16> %1, <8 x i16> %a, i8 17)11 ret <8 x i16> %212}13declare <8 x i16> @llvm.x86.sse41.pblendw(<8 x i16>, <8 x i16>, i8) nounwind readnone14 15define <16 x i16> @commute_fold_vpblendw_256(<16 x i16> %a, ptr %b) #0 {16; CHECK-LABEL: commute_fold_vpblendw_256:17; CHECK: # %bb.0:18; CHECK-NEXT: vpblendw {{.*#+}} ymm0 = ymm0[0],mem[1,2,3],ymm0[4],mem[5,6,7],ymm0[8],mem[9,10,11],ymm0[12],mem[13,14,15]19; CHECK-NEXT: retq20 %1 = load <16 x i16>, ptr %b21 %2 = call <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16> %1, <16 x i16> %a, i8 17)22 ret <16 x i16> %223}24declare <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16>, <16 x i16>, i8) nounwind readnone25 26define <4 x i32> @commute_fold_vpblendd_128(<4 x i32> %a, ptr %b) #0 {27; CHECK-LABEL: commute_fold_vpblendd_128:28; CHECK: # %bb.0:29; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],mem[1,2,3]30; CHECK-NEXT: retq31 %1 = load <4 x i32>, ptr %b32 %2 = call <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32> %1, <4 x i32> %a, i8 1)33 ret <4 x i32> %234}35declare <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32>, <4 x i32>, i8) nounwind readnone36 37define <8 x i32> @commute_fold_vpblendd_256(<8 x i32> %a, ptr %b) #0 {38; CHECK-LABEL: commute_fold_vpblendd_256:39; CHECK: # %bb.0:40; CHECK-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0],mem[1,2,3,4,5,6],ymm0[7]41; CHECK-NEXT: retq42 %1 = load <8 x i32>, ptr %b43 %2 = call <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32> %1, <8 x i32> %a, i8 129)44 ret <8 x i32> %245}46declare <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32>, <8 x i32>, i8) nounwind readnone47 48define <4 x float> @commute_fold_vblendps_128(<4 x float> %a, ptr %b) #0 {49; CHECK-LABEL: commute_fold_vblendps_128:50; CHECK: # %bb.0:51; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],mem[1],xmm0[2],mem[3]52; CHECK-NEXT: retq53 %1 = load <4 x float>, ptr %b54 %2 = call <4 x float> @llvm.x86.sse41.blendps(<4 x float> %1, <4 x float> %a, i8 5)55 ret <4 x float> %256}57declare <4 x float> @llvm.x86.sse41.blendps(<4 x float>, <4 x float>, i8) nounwind readnone58 59define <8 x float> @commute_fold_vblendps_256(<8 x float> %a, ptr %b) #0 {60; CHECK-LABEL: commute_fold_vblendps_256:61; CHECK: # %bb.0:62; CHECK-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2],mem[3,4,5,6,7]63; CHECK-NEXT: retq64 %1 = load <8 x float>, ptr %b65 %2 = call <8 x float> @llvm.x86.avx.blend.ps.256(<8 x float> %1, <8 x float> %a, i8 7)66 ret <8 x float> %267}68declare <8 x float> @llvm.x86.avx.blend.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone69 70define <2 x double> @commute_fold_vblendpd_128(<2 x double> %a, ptr %b) #0 {71; CHECK-LABEL: commute_fold_vblendpd_128:72; CHECK: # %bb.0:73; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],mem[2,3]74; CHECK-NEXT: retq75 %1 = load <2 x double>, ptr %b76 %2 = call <2 x double> @llvm.x86.sse41.blendpd(<2 x double> %1, <2 x double> %a, i8 1)77 ret <2 x double> %278}79declare <2 x double> @llvm.x86.sse41.blendpd(<2 x double>, <2 x double>, i8) nounwind readnone80 81define <4 x double> @commute_fold_vblendpd_256(<4 x double> %a, ptr %b) #0 {82; CHECK-LABEL: commute_fold_vblendpd_256:83; CHECK: # %bb.0:84; CHECK-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],mem[6,7]85; CHECK-NEXT: retq86 %1 = load <4 x double>, ptr %b87 %2 = call <4 x double> @llvm.x86.avx.blend.pd.256(<4 x double> %1, <4 x double> %a, i8 7)88 ret <4 x double> %289}90declare <4 x double> @llvm.x86.avx.blend.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone91 92define <4 x float> @commute_vblendpd_128_for_code_size(<4 x float> %a, <4 x float> %b) optsize {93; CHECK-LABEL: commute_vblendpd_128_for_code_size:94; CHECK: # %bb.0:95; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3]96; CHECK-NEXT: retq97 %r = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 0, i32 5, i32 2, i32 3>98 ret <4 x float> %r99}100