[llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Chris Lattner clattner at apple.com
Fri Sep 25 10:31:32 PDT 2009


On Sep 25, 2009, at 10:23 AM, Dale Johannesen wrote:

> Author: johannes
> Date: Fri Sep 25 12:23:22 2009
> New Revision: 82778
>
> URL: http://llvm.org/viewvc/llvm-project?rev=82778&view=rev
> Log:
> Generate FSQRT from calls to the sqrt function, which
> allows appropriate backends to generate a sqrt instruction.
>
> On x86, this isn't done at -O0 because we go through
> FastISel instead.  This is a behavior change from before
> this series of sqrt patches started.  I think this is OK
> considering that compile speed is most important at -O0, but
> could be convinced otherwise.

I'm fine with fastisel not doing this, but it should only happen if  
the sqrt function is readonly, otherwise the errno update is lost.

-Chris

>
>
> Modified:
>    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=82778&r1=82777&r2=82778&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp  
> (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri  
> Sep 25 12:23:22 2009
> @@ -4576,6 +4576,15 @@
>                                    Tmp.getValueType(), Tmp));
>           return;
>         }
> +      } else if (Name == "sqrt" || Name == "sqrtf" || Name ==  
> "sqrtl") {
> +        if (I.getNumOperands() == 2 &&   // Basic sanity checks.
> +            I.getOperand(1)->getType()->isFloatingPoint() &&
> +            I.getType() == I.getOperand(1)->getType()) {
> +          SDValue Tmp = getValue(I.getOperand(1));
> +          setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(),
> +                                   Tmp.getValueType(), Tmp));
> +          return;
> +        }
>       }
>     }
>   } else if (isa<InlineAsm>(I.getOperand(0))) {
>
>
> _______________________________________________
> 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