http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52107

             Bug #: 52107
           Summary: IBM 128bit long double constant loaded inefficiently
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: amo...@gmail.com


/* -m64 -O2 -mcmodel=small */

typedef float TFtype __attribute__ ((mode (TF)));

TFtype f2 (TFtype x)
{
  return x * 0x1p-64f;
}

gives

[snip]
.LC2:
        .tc ID_0_0[TC],0x000000000
.LC3:
        .tc ID_0_3bf00000[TC],0x03bf00000
[snip]
.L.f2:
        mflr 0
        lfd 3,.LC3@toc(2)
        std 0,16(1)
        stdu 1,-128(1)
        lfd 4,.LC2@toc(2)
        stfd 3,112(1)
        ld 9,112(1)
        sldi 9,9,32
        std 9,112(1)
        lfd 3,112(1)
        bl __gcc_qmul
[snip]

Horrible!  How come the bit pattern is stored right-shifted, and so needs
shifting back into place?  By comparison, gcc-4.4.1 generated

[snip]
.LC1:
        .tc ID_3bf00000_0[TC],0x3bf0000000000000
.LC2:
        .tc ID_0_0[TC],0x000000000
[snip]
.L.f2:
        mflr 0
        lfd 4,.LC2@toc(2)
        lfd 3,.LC1@toc(2)
        std 0,16(1)
        stdu 1,-112(1)
        bl __gcc_qmul
[snip]

Reply via email to