public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102076] New: powerpc: mflr called twice when using __builtin_return_address(0)
@ 2021-08-26 11:38 christophe.leroy at csgroup dot eu
  2021-08-26 18:21 ` [Bug target/102076] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: christophe.leroy at csgroup dot eu @ 2021-08-26 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102076
           Summary: powerpc: mflr called twice when using
                    __builtin_return_address(0)
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christophe.leroy at csgroup dot eu
  Target Milestone: ---

Fonction:

long f(void *);

long g(void)
{
        return 3 + f(__builtin_return_address(0));
}


Builds into:

00000000 <g>:
   0:   7c 08 02 a6     mflr    r0
   4:   7c 68 02 a6     mflr    r3
   8:   94 21 ff f0     stwu    r1,-16(r1)
   c:   90 01 00 14     stw     r0,20(r1)
  10:   48 00 00 01     bl      10 <g+0x10>
  14:   80 01 00 14     lwz     r0,20(r1)
  18:   38 63 00 03     addi    r3,r3,3
  1c:   7c 08 03 a6     mtlr    r0
  20:   38 21 00 10     addi    r1,r1,16
  24:   4e 80 00 20     blr



The 'mflr r0' should be avoided by using the value in r3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug target/102076] powerpc: mflr called twice when using __builtin_return_address(0)
  2021-08-26 11:38 [Bug target/102076] New: powerpc: mflr called twice when using __builtin_return_address(0) christophe.leroy at csgroup dot eu
@ 2021-08-26 18:21 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-26 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-26 18:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 11:38 [Bug target/102076] New: powerpc: mflr called twice when using __builtin_return_address(0) christophe.leroy at csgroup dot eu
2021-08-26 18:21 ` [Bug target/102076] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).