This is an archive of the discontinued LLVM Phabricator instance.

InstCombine: Try to turn is.fpclass sign checks to fcmp with 0
ClosedPublic

Authored by arsenm on Apr 24 2023, 5:10 PM.

Details

Summary

Try to use gt/lt compares with 0 instead of class.

Diff Detail

Event Timeline

arsenm created this revision.Apr 24 2023, 5:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 5:10 PM
arsenm requested review of this revision.Apr 24 2023, 5:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 5:10 PM
Herald added a subscriber: wdng. · View Herald Transcript
foad added inline comments.Apr 24 2023, 11:00 PM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
826

"returns true" needs updating.

848–851

Any reason not to add the DAZ counterpart of this case, i.e. fcPosNormal | fcPosInf? And the same for OLT.

arsenm added inline comments.Apr 26 2023, 11:49 AM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
848–851

It is already handled, this is called twice. The second time with the inverted mask (so actually we have some redundant cases here). I could either expand all the cases here and stop doing the invert trick, or trim the redundant cases

arsenm updated this revision to Diff 517256.Apr 26 2023, 11:55 AM

Round out a few more combinations, although technically redundant. Could further expand these and stop calling this with the inverse mask

foad added inline comments.May 16 2023, 8:36 AM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
826

ping

848–851

Yeah, now it looks odd that the two FMP_ONE cases are missing.

arsenm updated this revision to Diff 522654.May 16 2023, 9:08 AM

Make switch exhaustive instead of calling with inverted mask

foad accepted this revision.May 16 2023, 9:14 AM
This revision is now accepted and ready to land.May 16 2023, 9:14 AM