[PATCH, i386]: Improve rsqrt scehduling a bit
Uros Bizjak
ubizjak@gmail.com
Sun Jan 6 20:09:00 GMT 2008
Hello!
This patch changes NR fixup of rsqrt from:
rsqrt(a) = 0.5 * rsqrtss(a) * (3.0 - a * rsqrtss(a) * rsqrtss(a))
to:
rsqrt(a) = -0.5 * rsqrtss(a) * (a * rsqrtss(a) * rsqrtss(a) + (-3.0))
The benefit of this change is, that we can use commutative addss instead
of subss, improving the sequence from:
movaps %xmm0, %xmm1
movss .LC0(%rip), %xmm0
rsqrtss %xmm1, %xmm2
mulss %xmm2, %xmm1
mulss %xmm2, %xmm1
mulss .LC1(%rip), %xmm2
subss %xmm1, %xmm0
mulss %xmm2, %xmm0
to:
rsqrtss %xmm0, %xmm1
mulss %xmm1, %xmm0
mulss %xmm1, %xmm0
mulss .LC1(%rip), %xmm1
addss .LC0(%rip), %xmm0
mulss %xmm1, %xmm0
Patch was bootstrapped and regression tested on x86_64-linux {,-m32},
committed to SVN.
2008-01-06 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_emit_swsqrtsf): Use negative constants in
order to use commutative addition instead of subtraction.
Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rsqrt.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080106/2b7973e1/attachment.txt>
More information about the Gcc-patches
mailing list