[PATCH] [X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Fri Dec 5 15:15:52 PST 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6555.17003.patch
Type: text/x-patch
Size: 6296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141205/1c3bb1b8/attachment.bin>
More information about the llvm-commits
mailing list