[llvm-commits] [llvm] r107904 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp test/CodeGen/ARM/fpcmp-opt.ll

Evan Cheng evan.cheng at apple.com
Thu Jul 8 22:27:34 PDT 2010


On Jul 8, 2010, at 1:15 PM, Chris Lattner wrote:

> 
> On Jul 8, 2010, at 1:12 PM, Evan Cheng wrote:
> 
>> Author: evancheng
>> Date: Thu Jul  8 15:12:24 2010
>> New Revision: 107904
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=107904&view=rev
>> Log:
>> Check for FiniteOnlyFPMath as well.
> 
> Evan, this xform is not target specific.  Is there any reason not to implement it in dag combine?

It's profitable on ARM because it requires a vmrs which is expensive. I am not sure if other targets can benefit from it. I am also extending it to support f64 case which may have huge benefit for certain flavors of ARM.

> 
> It also seems really dangerous to me, even for -ffast-math.

That's why it's only one with -funsafe-math-optimizations. Are there other issues apart from the -0.0 and Nan?

Evan

> 
> -Chris
> 
>> 
>> Modified:
>>   llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
>>   llvm/trunk/test/CodeGen/ARM/fpcmp-opt.ll
>> 
>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=107904&r1=107903&r2=107904&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Jul  8 15:12:24 2010
>> @@ -2295,7 +2295,7 @@
>> ARMTargetLowering::getVFPCmp(SDValue &LHS, SDValue &RHS, ISD::CondCode CC,
>>                             SDValue &ARMCC, SelectionDAG &DAG,
>>                             DebugLoc dl) const {
>> -  if (UnsafeFPMath &&
>> +  if (UnsafeFPMath && FiniteOnlyFPMath() &&
>>      (CC == ISD::SETEQ || CC == ISD::SETOEQ ||
>>       CC == ISD::SETNE || CC == ISD::SETUNE) &&
>>      canBitcastToInt(LHS.getNode()) && canBitcastToInt(RHS.getNode())) {
>> 
>> Modified: llvm/trunk/test/CodeGen/ARM/fpcmp-opt.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fpcmp-opt.ll?rev=107904&r1=107903&r2=107904&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/ARM/fpcmp-opt.ll (original)
>> +++ llvm/trunk/test/CodeGen/ARM/fpcmp-opt.ll Thu Jul  8 15:12:24 2010
>> @@ -1,4 +1,4 @@
>> -; RUN: llc < %s -march=arm -mattr=+vfp2 -enable-unsafe-fp-math | FileCheck %s
>> +; RUN: llc < %s -march=arm -mattr=+vfp2 -enable-unsafe-fp-math -enable-finite-only-fp-math | FileCheck %s
>> ; rdar://7461510
>> 
>> define arm_apcscc i32 @t1(float* %a, float* %b) nounwind {
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list