This is an archive of the discontinued LLVM Phabricator instance.

InstCombine: Fold logic of fp_classes together
ClosedPublic

Authored by arsenm on Dec 12 2022, 6:50 PM.

Details

Summary

Move logical operators on pairs of llvm.is.fpclass on the same value
into the test mask of a single is_fpclass.

or (class x, mask0), (class x, mask1) -> class x, (mask0 | mask1)
and (class x, mask0), (class x, mask1) -> class x, (mask0 & mask1)
xor (class x, mask0), (class x, mask1) -> class x, (mask0 ^ mask1)

The and/or cases should appear frequently in the builtin math
libraries; haven't seen the xor case but handle it for completeness.

Diff Detail

Event Timeline

arsenm created this revision.Dec 12 2022, 6:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 6:50 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
arsenm requested review of this revision.Dec 12 2022, 6:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 6:50 PM
Herald added a subscriber: wdng. · View Herald Transcript
qiucf added a subscriber: qiucf.Dec 12 2022, 11:57 PM
foad accepted this revision.Dec 13 2022, 6:21 AM

LGTM.

This revision is now accepted and ready to land.Dec 13 2022, 6:21 AM
arsenm closed this revision.Dec 13 2022, 7:52 AM

8fc25caae5305b9e4113b9dd5332e7375a5657a6

Sunk the call site further down in the function since this is probably colder than anything else here

llvm/test/Transforms/InstCombine/is_fpclass.ll
1154

Test bug, should be xor