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

            Bug ID: 84627
           Summary: powerpc excess padding generated for POWER9 target
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npiggin at gmail dot com
  Target Milestone: ---

gcc version 8.0.1 20180207 (experimental) [trunk revision 257435] (Debian
8-20180207-2):

Test case:

void test(void (*fn)(void), unsigned long i)
{ 
        while (i--)
                fn();
}

Generates code with -O2 -mcpu=power9:

  2c:   18 00 41 f8     std     r2,24(r1)
  30:   00 00 00 60     nop
  34:   00 00 00 60     nop
  38:   00 00 00 60     nop
  3c:   00 00 42 60     ori     r2,r2,0
  40:   78 f3 cc 7f     mr      r12,r30
  44:   a6 03 c9 7f     mtctr   r30
  48:   ff ff ff 3b     addi    r31,r31,-1
  4c:   21 04 80 4e     bctrl
  50:   18 00 41 e8     ld      r2,24(r1)
  54:   ff ff bf 2f     cmpdi   cr7,r31,-1
  58:   e8 ff 9e 40     bne     cr7,40 <test+0x40>

On power9, I wonder if nops and ori should be avoided? Aligning to quad word
boundary is reasonable for fetch, but is there any advantage for dispatch to
add the extra padding?

Reply via email to