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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
                 CC|                            |linkw at gcc dot gnu.org
   Last reconfirmed|                            |2022-08-03
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org

--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
cat test.c 

extern int a;
int foo (int b){
  return a + b;
}

on ppc64le, with option "-mcpu=power9 -fpatchable-function-entry=5,3", the
generated assembly looks like:

.LPFE1:
        nop
        nop
        nop
        .type   foo, @function
foo:
        nop
        nop
.LFB0:
        .cfi_startproc
.LCF0:
0:      addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        .localentry     foo,.-foo
        std 31,-8(1)

Jakub's #c0 noted that the "after" nops should be placed after local entry, but
there seem two choices to put the "before" nops, such as:

1)

0:      addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        nop
        nop
        nop
        .localentry     foo,.-foo
        nop
        nop
        std 31,-8(1)

2)

0:      nop
        nop
        nop
        addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        .localentry     foo,.-foo
        nop
        nop
        std 31,-8(1)

For either of them, the "before" nops only take effects when it's entered from
global entry, both are counted as five insns in global entry area, there is no
differences from these two perspectives. I'd like to go with 1) if no
objections.

Reply via email to