This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Merge getLoadFP*Imm into a single function.
ClosedPublic

Authored by craig.topper on Mar 12 2023, 11:11 PM.

Details

Summary

We currently have 3 functions and 3 lookup tables. This was the
most expediant and obvious way to fix several bugs.

This patch uses a single function and single lookup
table. It uses APFloat::convert to convert from the half or double
to single precision. If the conversion doesn't have any errors or
lose any information we use the f32 table to finish the lookup.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 12 2023, 11:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 11:11 PM
craig.topper requested review of this revision.Mar 12 2023, 11:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 11:11 PM
craig.topper retitled this revision from [RISCV] Merge getLoadFP*Imm into a single function. to [RISCV][WIP] Merge getLoadFP*Imm into a single function..Mar 13 2023, 9:20 AM
asb added a comment.Mar 13 2023, 9:31 AM

Posting for early feedback as to whether this makes sense to do.

I think it makes sense to do it.

Add more tests for half and double.
Code cleanup

craig.topper retitled this revision from [RISCV][WIP] Merge getLoadFP*Imm into a single function. to [RISCV] Merge getLoadFP*Imm into a single function..Mar 13 2023, 3:32 PM
craig.topper added inline comments.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1547

I used if/else because switch on EVT requires VT.isSimple() first.

craig.topper edited the summary of this revision. (Show Details)Mar 13 2023, 3:34 PM
craig.topper edited the summary of this revision. (Show Details)
asb accepted this revision.Mar 14 2023, 12:51 PM

LGTM. Could you precommit the tests though, as it's a bit confusing to add new tests when I think these pass even without the change.

This revision is now accepted and ready to land.Mar 14 2023, 12:51 PM
This revision was landed with ongoing or failed builds.Mar 14 2023, 1:11 PM
This revision was automatically updated to reflect the committed changes.