This is an archive of the discontinued LLVM Phabricator instance.

DAG: Handle lowering unordered compare with inf
Needs ReviewPublic

Authored by arsenm on Feb 17 2023, 6:52 AM.

Details

Summary

Try to take advantage of the nan check behavior of fcmp.

Diff Detail

Event Timeline

arsenm created this revision.Feb 17 2023, 6:52 AM
arsenm requested review of this revision.Feb 17 2023, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2023, 6:52 AM
Herald added a subscriber: wdng. · View Herald Transcript
RKSimon added inline comments.Feb 26 2023, 6:06 AM
llvm/include/llvm/CodeGen/CodeGenCommonISel.h
224

compare instructions which can test for nan?

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8200–8201

Maybe drop the const - I expect the OrigTestMask rename will have caught any changes in the function

llvm/test/CodeGen/X86/is_fpclass.ll
250

Do you know if we have any legality/TLI callbacks that we could use to fallback to UseFP = false to avoid these regressions?

arsenm updated this revision to Diff 528214.Jun 4 2023, 7:08 AM
arsenm marked an inline comment as done.

Rebase

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
8200–8201

And the const will keep it that way

llvm/test/CodeGen/X86/is_fpclass.ll
250

Is this a regression? I was thinking it might be beneficial to leave all the FP in the f registers rather than copying to integer.

I don't know what I would check for here, the excess instructions seems to just be from the weird stackiness of x87.