This is an archive of the discontinued LLVM Phabricator instance.

[X86] Covert unsigned int 0 to float-point with FILD instruction.
ClosedPublic

Authored by LiuChen3 on Apr 13 2022, 12:34 AM.

Details

Summary

Unsigned int 0 will be converted to float/double -0.0 when the rounding
mode is set to 'FE_DOWNWARD'. Use FILD instruction instead of SSE
instructions on 32-bit target if the strictfp is enabled.

Diff Detail

Event Timeline

LiuChen3 created this revision.Apr 13 2022, 12:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 12:34 AM
LiuChen3 requested review of this revision.Apr 13 2022, 12:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 12:34 AM
pengfei edited the summary of this revision. (Show Details)Apr 13 2022, 12:55 AM
pengfei added inline comments.Apr 13 2022, 1:00 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21245

Why we need 32Bit check? Above code doesn't do that.

LiuChen3 added inline comments.Apr 13 2022, 1:29 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21245

In 64bit, cvtsi2ss will be emitted. There is no intermediate subtraction operation, which avoid such error.

LiuChen3 added inline comments.Apr 13 2022, 1:36 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21223

Here, i32 will be promoted to i64 for 64-bit target.

pengfei added inline comments.Apr 13 2022, 1:50 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21245

I see. So we still don't need to check it because we can't go here on 64 bit. The check may imply we can't do it on 64 bit for some reason.

LiuChen3 updated this revision to Diff 422452.Apr 13 2022, 3:11 AM

Address Phoebe's comments: remove 32-bit target check.

pengfei accepted this revision.Apr 13 2022, 3:48 AM

LGTM.

This revision is now accepted and ready to land.Apr 13 2022, 3:48 AM
This revision was landed with ongoing or failed builds.Apr 13 2022, 5:06 AM
This revision was automatically updated to reflect the committed changes.