Skip to content

Commit f9f69e7

Browse files
committed
fixup! Add to the earlier SRL for the power 2 case too.
1 parent 82a2700 commit f9f69e7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7360,12 +7360,15 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
73607360
uint64_t Val = Op.getConstantOperandVal(0);
73617361
if (isPowerOf2_64(Val)) {
73627362
uint64_t Log2 = Log2_64(Val);
7363-
if (Log2 < 3)
7363+
if (Log2 < 3) {
7364+
SDNodeFlags Flags;
7365+
Flags.setExact(true);
73647366
Res = DAG.getNode(ISD::SRL, DL, XLenVT, Res,
73657367
DAG.getConstant(3 - Log2, DL, VT));
7366-
else if (Log2 > 3)
7368+
} else if (Log2 > 3) {
73677369
Res = DAG.getNode(ISD::SHL, DL, XLenVT, Res,
73687370
DAG.getConstant(Log2 - 3, DL, XLenVT));
7371+
}
73697372
} else if ((Val % 8) == 0) {
73707373
// If the multiplier is a multiple of 8, scale it down to avoid needing
73717374
// to shift the VLENB value.

0 commit comments

Comments
 (0)