Skip to content

Commit e907baa

Browse files
committed
fixup! [RISCV] Fold (slli (srli (slli X, C1), C1), C2) -> (srli (slli X, C1), C1-C2)
1 parent 9bc1c75 commit e907baa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,10 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
10481048
// where C2 has C4 leading zeros and no trailing zeros.
10491049
// This is profitable if the "and" was to be lowered to
10501050
// (srli (slli X, C4), C4) and not (andi X, C2).
1051-
// For "LeadingZeros == 32" we prefer Zba (slli.uw X, C).
1051+
// For "LeadingZeros == 32":
1052+
// - with Zba it's just (slli.uw X, C)
1053+
// - without Zba a tablegen pattern applies the very same
1054+
// transform as we would have done here
10521055
SDNode *SLLI = CurDAG->getMachineNode(
10531056
RISCV::SLLI, DL, VT, N0->getOperand(0),
10541057
CurDAG->getTargetConstant(LeadingZeros, DL, VT));

0 commit comments

Comments
 (0)