Skip to content

Commit f3b4c26

Browse files
committed
[RISCV] Adjust the Zfhmin handling in RISCVInstrInfo::copyPhysReg.
Instead of checking '!Zfh && Zhfmin' first, handle Zfh. Then assert that the other case is F+Zfhmin. The F+Zfhmin check will need to be relaxed for bfloat16 support. As it was written before there would be now error to catch that. Instead it would just silently create fsgnj.h instructions.
1 parent 199034e commit f3b4c26

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,17 @@ void RISCVInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
327327
RISCVII::VLMUL LMul = RISCVII::LMUL_1;
328328
unsigned SubRegIdx = RISCV::sub_vrm1_0;
329329
if (RISCV::FPR16RegClass.contains(DstReg, SrcReg)) {
330-
if (!STI.hasStdExtZfh() && STI.hasStdExtZfhmin()) {
330+
if (STI.hasStdExtZfh()) {
331+
Opc = RISCV::FSGNJ_H;
332+
} else {
333+
assert(STI.hasStdExtF() && STI.hasStdExtZfhmin() &&
334+
"Unexpected extensions");
331335
// Zfhmin subset doesn't have FSGNJ_H, replaces FSGNJ_H with FSGNJ_S.
332336
DstReg = TRI->getMatchingSuperReg(DstReg, RISCV::sub_16,
333337
&RISCV::FPR32RegClass);
334338
SrcReg = TRI->getMatchingSuperReg(SrcReg, RISCV::sub_16,
335339
&RISCV::FPR32RegClass);
336340
Opc = RISCV::FSGNJ_S;
337-
} else {
338-
Opc = RISCV::FSGNJ_H;
339341
}
340342
IsScalableVector = false;
341343
} else if (RISCV::FPR32RegClass.contains(DstReg, SrcReg)) {

0 commit comments

Comments
 (0)