[llvm] ed1f45b - [X86][AVX] SimplifyDemandedBitsForTargetNode - add basic X86ISD::VBROADCAST handling.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 08:16:14 PST 2021
Author: Simon Pilgrim
Date: 2021-02-26T16:13:14Z
New Revision: ed1f45bce9fb4688a4ab06862b25c6d55b5dc415
URL: https://github.com/llvm/llvm-project/commit/ed1f45bce9fb4688a4ab06862b25c6d55b5dc415
DIFF: https://github.com/llvm/llvm-project/commit/ed1f45bce9fb4688a4ab06862b25c6d55b5dc415.diff
LOG: [X86][AVX] SimplifyDemandedBitsForTargetNode - add basic X86ISD::VBROADCAST handling.
Simplify through to the scalar/vector source operand.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 86a4190aa617..dd0ce226050e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -38908,6 +38908,16 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
}
// TODO - add general PACKSS/PACKUS SimplifyDemandedBits support.
break;
+ case X86ISD::VBROADCAST: {
+ SDValue Src = Op.getOperand(0);
+ MVT SrcVT = Src.getSimpleValueType();
+ APInt DemandedElts = APInt::getOneBitSet(
+ SrcVT.isVector() ? SrcVT.getVectorNumElements() : 1, 0);
+ if (SimplifyDemandedBits(Src, OriginalDemandedBits, DemandedElts, Known,
+ TLO, Depth + 1))
+ return true;
+ break;
+ }
case X86ISD::PCMPGT:
// icmp sgt(0, R) == ashr(R, BitWidth-1).
// iff we only need the sign bit then we can use R directly.
diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
index da169b6dff3c..7187425aee0f 100644
--- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
+++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
@@ -781,10 +781,9 @@ define <32 x i8> @constant_fold_pshufb_256() {
define i32 @broadcast_v2i64_multiuse(i64* %p0) {
; X86-LABEL: broadcast_v2i64_multiuse:
; X86: # %bb.0: # %entry
-; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
-; X86-NEXT: vmovd %xmm0, %eax
-; X86-NEXT: addl (%ecx), %eax
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movl (%eax), %eax
+; X86-NEXT: addl %eax, %eax
; X86-NEXT: retl
;
; X64-LABEL: broadcast_v2i64_multiuse:
More information about the llvm-commits
mailing list