[Bug target/70131] New: PowerPC ISA 2.07 is inefficient at doint (float)(int)x.

meissner at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 7 22:48:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70131

            Bug ID: 70131
           Summary: PowerPC ISA 2.07 is inefficient at doint
                    (float)(int)x.
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meissner at gcc dot gnu.org
  Target Milestone: ---

The current GCC compiler does not use the vupkhsw instruction that was
introduced in ISA 2.07 (power8) to sign extend the 32-bit integer to 64-bit
integer.  Instead it does a store and then a load to sign extend the value.

The code:

double foo (double x) { return (double)(int)x; }

generates the following code for power8:

        fctiwz 1,1
        addi 9,1,-16
        stfiwx 1,0,9
        ori 2,2,0
        lfiwax 1,0,9
        fcfid 1,1

It does this because 

It should generate something like:

        xscvdpsxws 33,1
        vupkhsw 1,1
        xxpermdi 33,33,33,2
        xscvsxddp 1,33


More information about the Gcc-bugs mailing list