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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 12:54:12 PST 2020


craig.topper created this revision.
craig.topper added reviewers: efriedma, uweigand, andrew.w.kaylor, pengfei, kpn, cameron.mcinally.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D72477

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72477.237165.patch
Type: text/x-patch
Size: 6188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/d3de68af/attachment.bin>


More information about the llvm-commits mailing list