This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes][X86] Improve ExpandIntRes_FP_TO_SINT/ExpandIntRes_FP_TO_UINT when input is SoftPromoteHalf.
ClosedPublic

Authored by craig.topper on Aug 30 2021, 11:58 AM.

Details

Summary

Instead of splitting off the fp16 to float conversion and generating
a libcall, we should split the operation into fp16 to float and float
to integer operations. This will allow the float to integer conversion
to go through any custom handling the target has. If the target doesn't
have custom handling then we should come back to ExpandIntRes_FP_TO_SINT/
ExpandIntRes_FP_TO_UINT automatically to create the libcall.

This avoids generating libcalls on 32-bit X86. These library functions may
not exist in 32-bit libgcc. At least for LLVM, we never generate them when
hardware floating point instructions are available.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 30 2021, 11:58 AM
craig.topper requested review of this revision.Aug 30 2021, 11:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2021, 11:58 AM
compnerd accepted this revision.Aug 30 2021, 12:57 PM

Thanks! I verified that this definitely fixes the codegen on Windows with FP16.

This revision is now accepted and ready to land.Aug 30 2021, 12:57 PM