Skip to content

Commit 9c31964

Browse files
committed
fixup! [RISCV][SDAG] Prefer ShortForwardBranch to lower sdiv by pow2
Update comments.
1 parent af82de7 commit 9c31964

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19501,6 +19501,8 @@ RISCVTargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
1950119501
EVT VT = N->getValueType(0);
1950219502
if (!(VT == MVT::i32 || (VT == MVT::i64 && Subtarget.is64Bit())))
1950319503
return SDValue();
19504+
19505+
// Ensure 2**k-1 < 2048 so that we can just emit a single addi/addiw.
1950419506
if (Divisor.sgt(2048) || Divisor.slt(-2048))
1950519507
return SDValue();
1950619508
return TargetLowering::buildSDIVPow2WithCMov(N, Divisor, DAG, Created);

0 commit comments

Comments
 (0)