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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-29
     Ever confirmed|0                           |1

--- Comment #1 from Michael Meissner <meissner at gcc dot gnu.org> ---
This shows up if we allow PRE_{INC,DEC,MODIFY} of DFmode and SFmode values if
those values can go in Altivec registers.

To reproduce this, compile the following code with either -O2 -mcpu=power6 or
-O2 -mcpu=power7 -mno-vsx:

void f(double *a, double *b, double *c, int n) {
  int i;
  for (i=0; i < n; i++)
    a[i] = b[i] + c[i];
}

The code generated is:

f:
        cmpwi 7,6,0
        blelr 7
        addi 6,6,-1
        addi 9,4,-8
        rldic 6,6,3,29
        addi 5,5,-8
        add 4,4,6
        addi 3,3,-8
        .p2align 4,,15
.L3:
        lfdu 0,8(9)
        lfdu 12,8(5)
        cmpld 7,9,4
        fadd 0,0,12
        stfdu 0,8(3)
        beqlr 7
        lfdu 0,8(9)
        lfdu 12,8(5)
        cmpld 7,9,4
        fadd 0,0,12
        stfdu 0,8(3)
        bne 7,.L3
        blr

Subversion id 257166 disallowed PRE_{INC,DEC,MODIFY} for the floating point
scalars could go in Altivec registers and -O2 -mcpu=power7 generates:

f:
        cmpwi 7,6,0
        blelr 7
        addi 6,6,-1
        li 9,0
        rldicl 6,6,0,32
        addi 10,6,1
        mtctr 10
        .p2align 5,,31
.L3:
        lfdx 0,4,9
        lfdx 12,5,9
        fadd 0,0,12
        stfdx 0,3,9
        addi 9,9,8
        bdnz .L3
        blr


Or alternatively compile the following code with -O2 -mcpu=power7:

void f(float *a, float *b, float *c, int n) {
  int i;
  for (i=0; i < n; i++)
    a[i] = b[i] + c[i];
}

Reply via email to