[PATCH, i386]: Fix float_extend load of x87 constants

Uros Bizjak ubizjak@gmail.com
Sun Nov 26 19:39:00 GMT 2006


Hello!

There were problems w.r.t. to float_extend of x87 constants, where no 
fldz, fld1 & co. constants were produced. This problem was somehow fixed 
by my rtx_cost patch from August:

        * config/i386/i386.c (ix86_rtx_costs) [FLOAT_EXTEND]: For
        standard 80387 constants, raise the cost to prevent
        compress_float_constant() to generate load from memory.

that raised the cost of float extend. However, the "collateral damage" 
from this patch can be seen in FP operators (fadd{s,l} and fsub{s,l} ) 
with memory operators. For following testcase:

double test(double a)
{
        return sqrt(a) + 1.0;
}

we produced:

        fsqrt
        faddl   .LC0

sequence, but "fadds    .LCO" would be better. Please note, that operand 
with memory operator is always faster than "fld1, faddp" sequence.

Attached patch reverts the above patch (barking at wrong tree, 
apparently) and fixes the problem in its core. The problem is simply 
forgotten splitter pattern, that would split float_extend patterns into 
valid x87 (and SSE FWIW) constant loads. The infrastructure for the 
transformation is already in place.

2006-11-26  Uros Bizjak  <ubizjak@gmail.com>

        Revert:
        2006-05-08  Uros Bizjak  <uros@kss-loka.si>
        * config/i386/i386.c (ix86_rtx_costs) [FLOAT_EXTEND]: For
        standard 80387 constants, raise the cost to prevent
        compress_float_constant() to generate load from memory.

        * config/i386/i386.md: Add new splitter pattern to split
        float_extended load of constant from constant pool into
        pure constant load.

Patch was bootstrapped on x86_64-pc-linux-gnu and regression tested for 
c, c++ and fortran.

OK for mainline?

Uros.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i386-floatex.diff
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061126/e75dc1ec/attachment.bin>


More information about the Gcc-patches mailing list