[TargetLowering][ARM][X86] Change softenSetCCOperands handling of ONE to avoid spurio...
authorCraig Topper <craig.topper@intel.com>
Fri, 10 Jan 2020 18:31:25 +0000 (10:31 -0800)
committerCraig Topper <craig.topper@intel.com>
Fri, 10 Jan 2020 19:00:17 +0000 (11:00 -0800)
commitb590e0fd810e4caf59ab83b04654d42e18faaafb
tree9f65192876a6560c5725bee78348ff635a31fe95
parent13ec473b9d4bd4f7a558272932b7c0806171c666
[TargetLowering][ARM][X86] Change softenSetCCOperands handling of ONE to avoid spurious exceptions for QNANs with strict FP quiet compares

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.

Differential Revision: https://reviews.llvm.org/D72477
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/Thumb2/float-cmp.ll
llvm/test/CodeGen/X86/fp128-compare.ll
llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
llvm/test/CodeGen/X86/fpcmp-soft-fp.ll