Skip to content

Commit e3021bd

Browse files
committed
[RISCV] Add RISCVISD::SLLW to computeKnownBitsForTargetNode.
Found while investigating whether we still need to stop DAG combiner from turning (i64 (sext (i32 X))) into zext when i32 is known non negative. No test case because I still need to find fixes for some other issues before I can remove the code from DAGCombiner.
1 parent 2e7f47d commit e3021bd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15812,6 +15812,15 @@ void RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
1581215812
Known = Known.sext(BitWidth);
1581315813
break;
1581415814
}
15815+
case RISCVISD::SLLW: {
15816+
KnownBits Known2;
15817+
Known = DAG.computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
15818+
Known2 = DAG.computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
15819+
Known = KnownBits::shl(Known.trunc(32), Known2.trunc(5).zext(32));
15820+
// Restore the original width by sign extending.
15821+
Known = Known.sext(BitWidth);
15822+
break;
15823+
}
1581515824
case RISCVISD::CTZW: {
1581615825
KnownBits Known2 = DAG.computeKnownBits(Op.getOperand(0), Depth + 1);
1581715826
unsigned PossibleTZ = Known2.trunc(32).countMaxTrailingZeros();

0 commit comments

Comments
 (0)