[PATCH] [X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.

Owen Anderson resistor at mac.com
Fri Dec 5 17:48:28 PST 2014


Should this be target independent?

—Owen

> On Dec 5, 2014, at 3:15 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
> 
> For code like:
>        float foo(float x) { return copysign(1.0, x); }
> 
> We used to generate:
> 	andps	<-0.000000e+00,0,0,0>, %xmm0
> 	movss	<1.000000e+00>, %xmm1
> 	andps	<nan>, %xmm1
> 	orps		%xmm0, %xmm1
> 
> Basically doing an abs(1.0f) in the two middle instructions.
> 
> We now generate:
>        andps   <-0.000000e+00,0,0,0>, %xmm0
>        orps    <1.000000e+00,0,0,0>, %xmm0
> 
> http://reviews.llvm.org/D6555
> 
> Files:
>  lib/Target/X86/X86ISelLowering.cpp
>  test/CodeGen/X86/copysign-constant-magnitude.ll
>  test/CodeGen/X86/copysign-zero.ll
> <D6555.17003.patch>_______________________________________________
> 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