This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering][ARM][X86] Change softenSetCCOperands handling of ONE to avoid spurious exceptions for QNANs with strict FP quiet compares
ClosedPublic

Authored by craig.topper on Jan 9 2020, 12:52 PM.

Details

Summary

ONE is currently softened to OGT | OLT. But the libcalls for OGT and OLT libcalls will trigger an exception for QNAN. At least for X86 with libgcc. UEQ on the other hand uses UO | OEQ the UO and OEQ libcalls will not trigger an exception for QNAN.

This patch changes ONE to use the inverse of the UEQ lowering. So we now produce O & UNE. Technically the existing behavior was correct for a signalling ONE, but since I don't know how to generate one of those from clang that seemed like something we can deal with later as we would need to fix other predicates as well. Also removing spurious exceptions seemed better than missing an exception.

There are also problems with quiet OGT/OLT/OLE/OGE, but those are harder to fix.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 9 2020, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2020, 12:52 PM
pengfei accepted this revision.Jan 9 2020, 4:48 PM

LGTM.

This revision is now accepted and ready to land.Jan 9 2020, 4:48 PM
This revision was automatically updated to reflect the committed changes.