[llvm] 4a2673d - [X86][AVX] Add SimplifyMultipleUseDemandedBits VBROADCAST handling to SimplifyDemandedVectorElts.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun May 31 06:26:11 PDT 2020
Author: Simon Pilgrim
Date: 2020-05-31T14:20:15+01:00
New Revision: 4a2673d79fdbae57a800ec578ee3d58a6890a4f9
URL: https://github.com/llvm/llvm-project/commit/4a2673d79fdbae57a800ec578ee3d58a6890a4f9
DIFF: https://github.com/llvm/llvm-project/commit/4a2673d79fdbae57a800ec578ee3d58a6890a4f9.diff
LOG: [X86][AVX] Add SimplifyMultipleUseDemandedBits VBROADCAST handling to SimplifyDemandedVectorElts.
As suggested on D79987.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/oddshuffles.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 89559ad9acbd..7edce2129033 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -36830,6 +36830,12 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
if (SimplifyDemandedVectorElts(Src, SrcElts, SrcUndef, SrcZero, TLO,
Depth + 1))
return true;
+ // Aggressively peek through src to get at the demanded elt.
+ // TODO - we should do this for all target/faux shuffles ops.
+ APInt SrcBits = APInt::getAllOnesValue(SrcVT.getScalarSizeInBits());
+ if (SDValue NewSrc = SimplifyMultipleUseDemandedBits(Src, SrcBits, SrcElts,
+ TLO.DAG, Depth + 1))
+ return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, SDLoc(Op), VT, NewSrc));
break;
}
case X86ISD::VPERMV: {
diff --git a/llvm/test/CodeGen/X86/oddshuffles.ll b/llvm/test/CodeGen/X86/oddshuffles.ll
index e182008eadc9..910c40d67383 100644
--- a/llvm/test/CodeGen/X86/oddshuffles.ll
+++ b/llvm/test/CodeGen/X86/oddshuffles.ll
@@ -2014,18 +2014,16 @@ define <16 x i32> @splat_v3i32(<3 x i32>* %ptr) {
;
; AVX2-SLOW-LABEL: splat_v3i32:
; AVX2-SLOW: # %bb.0:
-; AVX2-SLOW-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
-; AVX2-SLOW-NEXT: vpinsrd $2, 8(%rdi), %xmm0, %xmm1
-; AVX2-SLOW-NEXT: vpxor %xmm2, %xmm2, %xmm2
-; AVX2-SLOW-NEXT: vpblendd {{.*#+}} ymm0 = ymm2[0],ymm0[1],ymm2[2,3,4,5,6,7]
-; AVX2-SLOW-NEXT: vpbroadcastd %xmm1, %ymm1
-; AVX2-SLOW-NEXT: vpblendd {{.*#+}} ymm1 = ymm2[0,1],ymm1[2],ymm2[3,4,5,6,7]
+; AVX2-SLOW-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
+; AVX2-SLOW-NEXT: vxorps %xmm2, %xmm2, %xmm2
+; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm2[0],ymm1[1],ymm2[2,3,4,5,6,7]
+; AVX2-SLOW-NEXT: vbroadcastss %xmm1, %ymm1
+; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm1 = ymm2[0,1],ymm1[2],ymm2[3,4,5,6,7]
; AVX2-SLOW-NEXT: retq
;
; AVX2-FAST-LABEL: splat_v3i32:
; AVX2-FAST: # %bb.0:
-; AVX2-FAST-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
-; AVX2-FAST-NEXT: vpinsrd $2, 8(%rdi), %xmm0, %xmm1
+; AVX2-FAST-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
; AVX2-FAST-NEXT: vpxor %xmm0, %xmm0, %xmm0
; AVX2-FAST-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2,3,4,5,6,7]
; AVX2-FAST-NEXT: vpshufb {{.*#+}} ymm1 = zero,zero,zero,zero,zero,zero,zero,zero,ymm1[0,1,2,3],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
More information about the llvm-commits
mailing list