[llvm] 02e5c25 - [X86] SimplifyDemandedBitsForTargetNode - cleanup SSE shift-by-immediate handlers. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 10:24:29 PST 2024
Author: Simon Pilgrim
Date: 2024-11-05T18:24:13Z
New Revision: 02e5c25f62d33202be6cca2650d3ae60c896775f
URL: https://github.com/llvm/llvm-project/commit/02e5c25f62d33202be6cca2650d3ae60c896775f
DIFF: https://github.com/llvm/llvm-project/commit/02e5c25f62d33202be6cca2650d3ae60c896775f.diff
LOG: [X86] SimplifyDemandedBitsForTargetNode - cleanup SSE shift-by-immediate handlers. NFC.
Cleanup the SHLI/SRLI/SRAI handlers to be more consistent - prep for a future patch.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1fd6b240bef671..3c0c1d7f56869e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -43375,8 +43375,9 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
}
case X86ISD::VSHLI: {
SDValue Op0 = Op.getOperand(0);
+ SDValue Op1 = Op.getOperand(1);
- unsigned ShAmt = Op.getConstantOperandVal(1);
+ unsigned ShAmt = Op1->getAsZExtVal();
if (ShAmt >= BitWidth)
break;
@@ -43420,14 +43421,17 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
return false;
}
case X86ISD::VSRLI: {
- unsigned ShAmt = Op.getConstantOperandVal(1);
+ SDValue Op0 = Op.getOperand(0);
+ SDValue Op1 = Op.getOperand(1);
+
+ unsigned ShAmt = Op1->getAsZExtVal();
if (ShAmt >= BitWidth)
break;
APInt DemandedMask = OriginalDemandedBits << ShAmt;
- if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask,
- OriginalDemandedElts, Known, TLO, Depth + 1))
+ if (SimplifyDemandedBits(Op0, DemandedMask, OriginalDemandedElts, Known,
+ TLO, Depth + 1))
return true;
Known.Zero.lshrInPlace(ShAmt);
@@ -43452,8 +43456,7 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
return TLO.CombineTo(Op, Op0);
// fold (VSRAI (VSHLI X, C1), C1) --> X iff NumSignBits(X) > C1
- if (Op0.getOpcode() == X86ISD::VSHLI &&
- Op.getOperand(1) == Op0.getOperand(1)) {
+ if (Op0.getOpcode() == X86ISD::VSHLI && Op1 == Op0.getOperand(1)) {
SDValue Op00 = Op0.getOperand(0);
unsigned NumSignBits =
TLO.DAG.ComputeNumSignBits(Op00, OriginalDemandedElts);
More information about the llvm-commits
mailing list