This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] remove FP-to-int cast attribute check in fold to FTRUNC
ClosedPublic

Authored by spatel on Dec 16 2021, 9:04 AM.

Details

Summary

We were using a function attribute to indicate a non-standard FP mode, but now we can use intrinsics for that job as shown in the new tests.
Presumably the x86 asm could be improved for that IR with intrinsics, but I have not worked out exactly how to do that. Note that the transform to FTRUNC still requires a hacky check for "nsz" (because FMF are not applied to FP casts).

This is a cleanup based on the clang change in D115804 / 8c7f2a4f87192 .
This is effectively a revert of 5a90285bd98d2 + D46237 .

Diff Detail

Event Timeline

spatel created this revision.Dec 16 2021, 9:04 AM
spatel requested review of this revision.Dec 16 2021, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2021, 9:04 AM
RKSimon added inline comments.Dec 16 2021, 9:57 AM
llvm/test/CodeGen/X86/ftrunc.ll
2–5

Should we have i686 test coverage here ?

spatel added inline comments.Dec 16 2021, 11:27 AM
llvm/test/CodeGen/X86/ftrunc.ll
2–5

Sure - are we looking for something particular or just add one i686 + avx RUN as a sanity check?

pengfei added inline comments.Dec 16 2021, 7:09 PM
llvm/test/CodeGen/X86/ftrunc.ll
831

So we can remove the attributes and all tests used it?

spatel added inline comments.Dec 17 2021, 5:12 AM
llvm/test/CodeGen/X86/ftrunc.ll
831

Yes, there's no need to test an attribute that does not exist. :)
That should make the diffs a little easier to follow. I could also pre-commit new tests with intrinsics and then delete the old tests if that seems better.

spatel updated this revision to Diff 395098.Dec 17 2021, 5:15 AM

Adjusted tests - we do not need tests for a function attribute that does not exist anymore.

spatel marked an inline comment as done.Dec 17 2021, 5:15 AM
pengfei accepted this revision.Dec 17 2021, 5:29 AM

LGTM.

This revision is now accepted and ready to land.Dec 17 2021, 5:29 AM
RKSimon added inline comments.Dec 17 2021, 5:44 AM
llvm/test/CodeGen/X86/ftrunc.ll
2–5

i686 + AVX would be fine

spatel updated this revision to Diff 395132.Dec 17 2021, 7:46 AM
spatel marked 2 inline comments as done.

Updated test diffs after including a RUN for 32-bit AVX target.

RKSimon accepted this revision.Dec 17 2021, 8:51 AM

LGTM - cheers

This revision was landed with ongoing or failed builds.Dec 17 2021, 1:01 PM
This revision was automatically updated to reflect the committed changes.