This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Disable use of i128 shift libcalls on RV32.
ClosedPublic

Authored by craig.topper on Sep 7 2021, 12:16 PM.

Details

Summary

Since i128 isn't a legal C type on RV32, I don't believe
libgcc implements these functions for RV32. compiler-rt
does implement them because i128 support is enabled
in order to handle long double.

This is consistent with 32-bit X86 and ARM.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 7 2021, 12:16 PM
craig.topper requested review of this revision.Sep 7 2021, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 7 2021, 12:16 PM
Herald added a subscriber: MaskRay. · View Herald Transcript

On rv32, we pass the clang flag to enable i128 support when we build compiler-rt, so __ashlti3 is available. Not sure about libgcc.

craig.topper edited the summary of this revision. (Show Details)Sep 7 2021, 4:28 PM
craig.topper edited the summary of this revision. (Show Details)
craig.topper added a comment.EditedSep 7 2021, 4:44 PM

I asked one of our gcc experts and __ashlti3 is not implemented in libgcc for RV32

On rv32, we pass the clang flag to enable i128 support when we build compiler-rt, so __ashlti3 is available. Not sure about libgcc.

IIRC, RV32 require to enable i128 since the f128 routines need that, and f128 is necessary for RISC-V because long double is 128 bit floating point, however the libgcc part has technical issue on support soft i128 for 32 bits target, which is not only for RV32 but also for all other 32 bits target in GCC.

But compiler-rt didn't have such technical issue, so in theory __int128 could be used for RV32 on clang, but we didn't turn it on by default is because we want to make sure the compatiblitiy between GCC, or in another word compatible with libgcc.

efriedma accepted this revision.Sep 8 2021, 2:08 PM

Then this is probably the right fix. LGTM

This revision is now accepted and ready to land.Sep 8 2021, 2:08 PM
This revision was landed with ongoing or failed builds.Sep 8 2021, 2:42 PM
This revision was automatically updated to reflect the committed changes.