Skip to content

Commit 990764c

Browse files
tclin914mahesh-attarde
authored andcommitted
[RISCV][llvm-exegesis] Add missing operand frm for FCVT_D_W (llvm#149989)
We encountered the index of operand out of bounds crash because FCVT_D_W lacks frm operand.
1 parent dc43907 commit 990764c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: llvm-exegesis -mode=latency -mtriple=riscv32-unknown-linux-gnu --mcpu=generic --dump-object-to-disk=%d --benchmark-phase=assemble-measured-code --opcode-name=FADD_D -mattr="+d" 2>&1
2+
# RUN: llvm-objdump -M numeric -d %d > %t.s
3+
# RUN: FileCheck %s < %t.s
4+
5+
CHECK: <foo>:
6+
CHECK: li x30, 0x0
7+
CHECK-NEXT: fcvt.d.w f{{[0-9]|[12][0-9]|3[01]}}, x30

llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,10 @@ static std::vector<MCInst> loadFP64RegBits32(const MCSubtargetInfo &STI,
651651
}
652652

653653
std::vector<MCInst> Instrs = loadIntReg(STI, ScratchIntReg, Bits);
654-
Instrs.push_back(
655-
MCInstBuilder(RISCV::FCVT_D_W).addReg(Reg).addReg(ScratchIntReg));
654+
Instrs.push_back(MCInstBuilder(RISCV::FCVT_D_W)
655+
.addReg(Reg)
656+
.addReg(ScratchIntReg)
657+
.addImm(RISCVFPRndMode::RNE));
656658
return Instrs;
657659
}
658660

0 commit comments

Comments
 (0)