r107852 is only safe with -enable-unsafe-fp-math to account for +0.0 == -0.0.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 8 Jul 2010 06:01:49 +0000 (06:01 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 8 Jul 2010 06:01:49 +0000 (06:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107856 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/fpcmp-opt.ll

index e3db58329802132c345b42f766f5ea27522de9b9..8ca69cd6122a6fea0b817ccb13fb756e7a38805a 100644 (file)
@@ -2295,11 +2295,13 @@ SDValue
 ARMTargetLowering::getVFPCmp(SDValue &LHS, SDValue &RHS, ISD::CondCode CC,
                              SDValue &ARMCC, SelectionDAG &DAG,
                              DebugLoc dl) const {
-  if ((CC == ISD::SETEQ || CC == ISD::SETOEQ ||
+  if (UnsafeFPMath &&
+      (CC == ISD::SETEQ || CC == ISD::SETOEQ ||
        CC == ISD::SETNE || CC == ISD::SETUNE) &&
       canBitcastToInt(LHS.getNode()) && canBitcastToInt(RHS.getNode())) {
-    // If there are no othter uses of the CMP operands, and the condition
-    // code is EQ oe NE, we can optimize it to an integer comparison.
+    // If unsafe fp math optimization is enabled and there are no othter uses of
+    // the CMP operands, and the condition code is EQ oe NE, we can optimize it
+    // to an integer comparison.
     if (CC == ISD::SETOEQ)
       CC = ISD::SETEQ;
     else if (CC == ISD::SETUNE)
index ed515cc1e7cf6e52ae772c70bda62eca10153e23..f651c167cc71d2431745a976edf4577272d89f33 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=arm -mattr=+vfp2 | FileCheck %s
+; RUN: llc < %s -march=arm -mattr=+vfp2 -enable-unsafe-fp-math | FileCheck %s
 ; rdar://7461510
 
 define arm_apcscc i32 @t1(float* %a, float* %b) nounwind {