This is an archive of the discontinued LLVM Phabricator instance.

[RISCV64] emit correct lib call for fp(double) to ui/si
ClosedPublic

Authored by kamleshbhalui on May 25 2020, 9:34 AM.

Details

Summary

since i32 is not legal in riscv64.
It always promoted to i64 before emitting lib call and
for conversions like double to int and double to unsigned int.
wrong lib call is emitted.

Example which libcall difference between gcc and clang.
https://godbolt.org/z/CCkJmq

This patch corrects that.

Diff Detail

Event Timeline

kamleshbhalui created this revision.May 25 2020, 9:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2020, 9:34 AM
efriedma added inline comments.
llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
178

This looks suspicious; do we really need the slli/srli pair here?

kamleshbhalui edited the summary of this revision. (Show Details)May 28 2020, 7:47 AM

Addressed @efriedma comments.
added test for strictfp.

asb accepted this revision.EditedJun 18 2020, 5:39 AM

Thanks, this looks good to me. I wasn't aware of MakeLibCallOptions and IsSoften - I think I've wanted something like that before.

This revision is now accepted and ready to land.Jun 18 2020, 5:39 AM
This revision was automatically updated to reflect the committed changes.