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

            Bug ID: 102169
           Summary: powerpc64 int memory operations using FP instructions
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npiggin at gmail dot com
                CC: bergner at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc64le-linux-gnu

--- test.c ---
int foo, bar;

void test(void)
{
        foo = bar;
}
---

Using Debian gcc 10.2 with -O2 flag, this compiles to:

     addis   r2,r12,0
     addi    r2,r2,0
     addis   r9,r2,0
     addi    r9,r9,0
     lfiwzx  f0,0,r9
     addis   r9,r2,0
     addi    r9,r9,0
     stfiwx  f0,0,r9
     blr

Peter confirmed it also uses FP registers with trunk (but I don't have the asm
output at hand).

This can be suboptimal on some processors, e.g., on POWER9 lfiwzx is "Tuple
Restricted (R)" which reduces dispatch throughput on the cycle it is
dispatched. And generally just seems like a surprising thing to do with no
shortage of GPRs.

Reply via email to