[PATCH, i386] Disable HImode fild insn for TARGET_PARTIAL_REG_STALL

Uros Bizjak uros@kss-loka.si
Thu Jan 6 07:57:00 GMT 2005


Hello!

This testcase:

double test (short x) {
  return x;
}

gets compiled to unoptimal code for TARGET_PARTIAL_REG_STALL:

test:
        pushl   %ebp
        movl    %esp, %ebp
        movswl  8(%ebp),%eax
        pushw   %ax                <<<
        filds   (%esp)
        addl    $2, %esp
        popl    %ebp
        ret

The short integer operand is first extended into %eax, then pushed as 
partial register to memory and again loaded as short into float reg.

With attached patch, generated code pushes already extended operand into 
memory and loads this extended value into float reg:

test:
        pushl   %ebp
        movl    %esp, %ebp
        movswl  8(%ebp),%eax
        pushl   %eax
        fildl   (%esp)
        addl    $4, %esp
        popl    %ebp
        ret

Patch is bootstrapped on pentium4-pc-linux-gnu, regtested c,c++.

2005-01-05  Uros Bizjak  <uros@kss-loka.si>

    * config/i386/i386.md (floathisf2, *floathisf2_i387, floathidf2,
    *floathidf2_i387, floahixf2): Disable for TARGET_PARTIAL_REG_STALL.

Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fild.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050106/40c2ec40/attachment.ksh>


More information about the Gcc-patches mailing list