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

            Bug ID: 108018
           Summary: Wide immediate sequences not scheduled for POWER10
                    fusion
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npiggin at gmail dot com
  Target Milestone: ---

POWER10 has "wideimmediate" fusion sequences that include addi rx,ra,si ; addis
rx,rx,SI and addis rx,ra,si ; addi rx,rx,SI

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

unsigned long test(void)
{
        return (unsigned long)&foo + (unsigned long)&bar;
}
---

This test case when compiled with -O2 -mcpu=power10 -mno-pcrel results in

        addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        addis 3,2,.LANCHOR0@toc@ha
        addis 9,2,.LANCHOR0+4@toc@ha
        addi 3,3,.LANCHOR0@toc@l
        addi 9,9,.LANCHOR0+4@toc@l
        add 3,3,9
        blr

The TOC pointer generation is scheduled properly because it is the global entry
prologue, but the variable address generation is scheduled to favour
dependencies rather than the static fusion sequences that P10 has, which should
be preferable.

Reply via email to