]> granicus.if.org Git - llvm/commit
[ARM] Use VCMP, not VCMPE, for floating point equality comparisons
authorJames Molloy <james.molloy@arm.com>
Mon, 13 Feb 2017 12:32:47 +0000 (12:32 +0000)
committerJames Molloy <james.molloy@arm.com>
Mon, 13 Feb 2017 12:32:47 +0000 (12:32 +0000)
commit9b264f7915075aee21b4f57d80ce72ab29865144
tree50e6aa934c2024a5a31a5b7108aabf14d8bd433d
parentd9480271fe4af7388f3d0ed7fd56cb06d9326737
[ARM] Use VCMP, not VCMPE, for floating point equality comparisons

When generating a floating point comparison we currently unconditionally
generate VCMPE. This has the sideeffect of setting the cumulative Invalid
bit in FPSCR if any of the operands are QNaN.

It is expected that use of a relational predicate on a QNaN value should
raise Invalid. Quoting from the C standard:

  The relational and equality operators support the usual mathematical
  relationships between numeric values. For any ordered pair of numeric
  values exactly one of relationships the less, greater, equal and is true.
  Relational operators may raise the floating-point exception when argument
  values are NaNs.

The standard doesn't explicitly state the expectation for equality operators,
but the implication and obvious expectation is that equality operators
should not raise Invalid on a QNaN input, as those predicates are wholly
defined on unordered inputs (to return not equal).

Therefore, add a new operand to ARMISD::FPCMP and FPCMPZ indicating if
QNaN should raise Invalid, and pipe that through to TableGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294945 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
lib/Target/ARM/ARMFastISel.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h
lib/Target/ARM/ARMInstrInfo.td
lib/Target/ARM/ARMInstrVFP.td
test/CodeGen/ARM/fast-isel-align.ll
test/CodeGen/ARM/fast-isel-cmp-imm.ll
test/CodeGen/ARM/fp16-promote.ll
test/CodeGen/ARM/fpcmp-opt.ll
test/CodeGen/ARM/fpcmp.ll
test/CodeGen/ARM/fpcmp_ueq.ll
test/CodeGen/ARM/vsel.ll
test/CodeGen/Thumb2/float-cmp.ll