public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/40361] Conditional return not always profitable with -Os
       [not found] <bug-40361-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-26  6:42 ` pinskia at gcc dot gnu.org
  2022-04-26 19:19 ` roger at nextmovesoftware dot com
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26  6:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the cross jumping opportunity since at least 5.4 even with a conditional
return.

        ldr     r3, .L8
        stmfd   sp!, {r4, lr}
        ldr     r3, [r3]
        ldr     r4, .L8+4
        cmp     r3, #0
        bge     .L2
        bl      bar1
        ldr     r3, [r4]
        cmp     r3, #0
        ldmgefd sp!, {r4, pc}
.L3:
        mov     r3, #0
        str     r3, [r4]
        ldmfd   sp!, {r4, pc}
.L2:
        bl      bar2
        ldr     r3, [r4]
        cmp     r3, #0
        blt     .L3
        ldmfd   sp!, {r4, pc}

The trunk produces this:
        push    {r4, lr}
        ldr     r4, .L9
        ldr     r3, [r4]
        cmp     r3, #0
        bge     .L2
        bl      bar1
.L8:
        ldr     r3, [r4, #4]
        cmp     r3, #0
        movlt   r3, #0
        strlt   r3, [r4, #4]
        pop     {r4, pc}
.L2:
        bl      bar2
        b       .L8

Which is even more cross jumped and note push and stmfd are the same here just
written differently.

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

* [Bug rtl-optimization/40361] Conditional return not always profitable with -Os
       [not found] <bug-40361-4@http.gcc.gnu.org/bugzilla/>
  2021-07-26  6:42 ` [Bug rtl-optimization/40361] Conditional return not always profitable with -Os pinskia at gcc dot gnu.org
@ 2022-04-26 19:19 ` roger at nextmovesoftware dot com
  1 sibling, 0 replies; 4+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-04-26 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 CC|                            |roger at nextmovesoftware dot com
   Target Milestone|---                         |4.5.4

--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
I agree with Andrew Pinski that the issue with this test case (conditional
return vs. cross-jumping on ARM code size) appears to have been fixed years
ago, according to godbolt.org prior to GCC 4.5.4.

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

* [Bug rtl-optimization/40361] Conditional return not always profitable with -Os
  2009-06-06 14:43 [Bug rtl-optimization/40361] New: " steven at gcc dot gnu dot org
  2009-06-06 17:56 ` [Bug rtl-optimization/40361] " steven at gcc dot gnu dot org
@ 2009-06-08 15:36 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-08 15:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40361


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

* [Bug rtl-optimization/40361] Conditional return not always profitable with -Os
  2009-06-06 14:43 [Bug rtl-optimization/40361] New: " steven at gcc dot gnu dot org
@ 2009-06-06 17:56 ` steven at gcc dot gnu dot org
  2009-06-08 15:36 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-06-06 17:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from steven at gcc dot gnu dot org  2009-06-06 17:56 -------
I tested the patch on arm-elf ("-march=armv7-r" and "-march=armv7 -mthumb"),
trunk revision 148235, -Os, unpatched and patched, with CSiBE:

armv7-r:
unpatched : 3557127 bytes
patched   : 3554655 bytes
win: 2472 bytes (0.0006%)

armv7 thumb2:
unpatched : 2663575 bytes
patched   : 2663575 bytes
(identical)


For ARM some functions win, a few function lose, but the patch is an overall
win.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-06 17:56:29
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40361


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

end of thread, other threads:[~2022-04-26 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-40361-4@http.gcc.gnu.org/bugzilla/>
2021-07-26  6:42 ` [Bug rtl-optimization/40361] Conditional return not always profitable with -Os pinskia at gcc dot gnu.org
2022-04-26 19:19 ` roger at nextmovesoftware dot com
2009-06-06 14:43 [Bug rtl-optimization/40361] New: " steven at gcc dot gnu dot org
2009-06-06 17:56 ` [Bug rtl-optimization/40361] " steven at gcc dot gnu dot org
2009-06-08 15:36 ` rguenth at gcc dot gnu dot 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).