This is an archive of the discontinued LLVM Phabricator instance.

DAG: Expand legalization of is.fpclass to fcmp for DAZ
ClosedPublic

Authored by arsenm on Feb 2 2023, 6:54 AM.

Details

Summary

Try to use a compare with 0 if DAZ is assumed.
FPClassTest really needs to be marked as a bimask enum, but the API
for that is currently broken.

Diff Detail

Event Timeline

arsenm created this revision.Feb 2 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 6:54 AM
arsenm requested review of this revision.Feb 2 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 6:54 AM
Herald added a subscriber: wdng. · View Herald Transcript

Could you please rebase the patch? Some changes for FPClassTest are already committed.

arsenm updated this revision to Diff 505311.Mar 14 2023, 4:11 PM

Rebase with FPClassTest changes

sepavloff added inline comments.Mar 14 2023, 11:35 PM
llvm/include/llvm/ADT/FloatingPointMode.h
148 ↗(On Diff #505311)

The function name is not verb-based. Maybe treatInputAsZero or something like that?

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8055

It looks like this function should return boolean value.

arsenm updated this revision to Diff 506056.Mar 17 2023, 5:56 AM
arsenm marked an inline comment as done.

Return bool

ping

llvm/include/llvm/ADT/FloatingPointMode.h
148 ↗(On Diff #505311)

Are is the verb? I think it reads fine

sepavloff added inline comments.Apr 24 2023, 7:46 AM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8104

What prevents to put the check here?

arsenm added inline comments.Apr 24 2023, 12:03 PM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8104

Expanded logic which I have no way of testing. If I can't write a test I'm not writing the handling for it

sepavloff added inline comments.Apr 24 2023, 8:38 PM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8104

To test isCondCodeLegal here we need a target in which SETOEQ is not legal. It is hard to imagine that a target supports FP numbers natively but comparison of them for equality is absent. Probably this TODO is not useful and could be removed. Alternatively, you could put the call to isCondCodeLegal and leave it untested just because there is no way to test it.

arsenm added inline comments.Jun 4 2023, 3:55 AM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8104

Checking isCondCodeLegal actually results in some x86 codegen diffs, so I'll do that separately

arsenm added a reviewer: foad.Jun 8 2023, 4:55 AM
sepavloff accepted this revision.Jun 21 2023, 9:38 AM

LGTM.

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8107–8108

It looks like this comment is misplaced.

llvm/unittests/ADT/FloatingPointMode.cpp
222–228

This test is not related to the legalization, it could be committed separately.

This revision is now accepted and ready to land.Jun 21 2023, 9:38 AM
arsenm closed this revision.Jun 22 2023, 3:18 AM
arsenm marked an inline comment as done.
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8107–8108

Don't really see what you mean by this