Page MenuHomePhabricator

[RISCV] Use the 'si' lib call for (double (fp_to_sint/uint i32 X)) when F extension is enabled.
ClosedPublic

Authored by craig.topper on Nov 4 2020, 9:20 PM.

Details

Summary

D80526 added custom lowering to pick the si lib call on RV64, but this custom handling is only enabled when the F and D extension are both disabled. This prevents the si library call from being used for double when F is enabled but D is not.

This patch changes the behavior so we always enable the Custom hook on RV64 and decide in ReplaceNodeResults if we should emit a libcall based on whether the FP type should be softened or not.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 4 2020, 9:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2020, 9:20 PM
craig.topper requested review of this revision.Nov 4 2020, 9:20 PM
craig.topper edited the summary of this revision. (Show Details)Nov 4 2020, 9:21 PM
luismarques accepted this revision.Nov 5 2020, 1:54 AM

LGTM. I guess the old libcall was producing the correct result anyway, since the in-register representation is the same?

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
943

Maybe add a comment here describing the new behavior?

This revision is now accepted and ready to land.Nov 5 2020, 1:54 AM

LGTM. I guess the old libcall was producing the correct result anyway, since the in-register representation is the same?

Actually that's not the case when the FP result doesn't fit an i32. Still waiting for the coffee to kick in!