This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Codegen support for Zfhmin.
ClosedPublic

Authored by monkchiang on Dec 5 2022, 9:49 PM.

Details

Summary

The Zfhmin subset only has FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S.
If the D extension is present, the FCVT.D.H and FCVT.H.D instructions are also included.
Since most instructions are not included for Zfhmin, so most operations are promoted.
The patch primarily about making f16 a legal type.

RISC-V ISA info:
https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions

Diff Detail

Event Timeline

monkchiang created this revision.Dec 5 2022, 9:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 9:49 PM
monkchiang requested review of this revision.Dec 5 2022, 9:49 PM
craig.topper added inline comments.Dec 5 2022, 10:17 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
303

Can we use FSGNJ_S by changing the registers to their FR32 equivalent?

llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td
429

Do we need to check NotZfh too to give priority if Zfh is also enabled?

craig.topper added inline comments.Dec 5 2022, 10:29 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
352

What's the issue with visitFP_ROUND?

monkchiang updated this revision to Diff 480374.Dec 6 2022, 1:06 AM

Address Craig's comment

craig.topper added inline comments.Dec 6 2022, 3:14 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
299

I think you can use const TargetRegisterInfo *TRI = STI.getRegisterInfo()

300

If we assigned over DstReg and SrcReg here and did Opc = FSGNJ_S and IsScalableVector = false, would the common code at the end still work?

monkchiang updated this revision to Diff 480716.Dec 6 2022, 5:22 PM

Address comment:

Assgin over DstReg and SrcReg to generate FSJGN_S in RISCVInstrInfo::copyPhysReg()
craig.topper accepted this revision.Dec 6 2022, 5:45 PM

LGTM

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
286

FFSGNJ_S -> FSGNJ_S

This revision is now accepted and ready to land.Dec 6 2022, 5:45 PM
monkchiang updated this revision to Diff 480722.Dec 6 2022, 5:49 PM

Fix typo, FFSGNJ_S -> FSGNJ_S.

This revision was landed with ongoing or failed builds.Dec 6 2022, 10:14 PM
This revision was automatically updated to reflect the committed changes.