[Bug target/50329] [PowerPC] Unnecessary stack frame set up

2024-03-04 Thread bergner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50329

Peter Bergner  changed:

   What|Removed |Added

 CC||bergner at gcc dot gnu.org
 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Peter Bergner  ---
(In reply to Segher Boessenkool from comment #2)
> Current trunk (to be GCC 6) optimises "c" perfectly.  Not the other
> two, alas.

Current trunk (to be GCC 14) optimizes all of them now.  Marking as FIXED.

a:
li 9,-1
rldicr 9,9,0,0
std 9,0(3)
blr
b:
li 9,-1
rldicr 9,9,0,0
std 9,0(3)
blr
c:
li 9,0
li 10,-1
rldimi 9,10,63,0
std 9,0(3)
blr

[Bug target/50329] [PowerPC] Unnecessary stack frame set up

2015-11-21 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50329

Segher Boessenkool  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org

--- Comment #2 from Segher Boessenkool  ---
Current trunk (to be GCC 6) optimises "c" perfectly.  Not the other
two, alas.

[Bug target/50329] [PowerPC] Unnecessary stack frame set up

2012-07-19 Thread sebastian.hu...@embedded-brains.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50329

Sebastian Huber sebastian.hu...@embedded-brains.de changed:

   What|Removed |Added

  Attachment #25229|0   |1
is obsolete||

--- Comment #1 from Sebastian Huber sebastian.hu...@embedded-brains.de 
2012-07-19 08:11:15 UTC ---
Created attachment 27830
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27830
Sample code

On GCC 4.7.1 20120614 the situation is even more worse:

.file   test.c
.section.text
.align 2
.globl a
.type   a, @function
a:
stwu 1,-536(1)
li 9,0
stw 9,8(1)
li 9,-128
stb 9,8(1)
lwz 9,8(1)
addi 1,1,536
stw 9,0(3)
blr
.size   a, .-a
.align 2
.globl b
.type   b, @function
b:
stwu 1,-544(1)
mflr 0
li 4,0
li 5,516
stw 31,540(1)
mr 31,3
addi 3,1,8
stw 0,548(1)
bl memset
li 9,-128
stb 9,8(1)
lwz 9,8(1)
stw 9,0(31)
lwz 0,548(1)
lwz 31,540(1)
mtlr 0
addi 1,1,544
blr
.size   b, .-b
.align 2
.globl c
.type   c, @function
c:
li 9,0
li 10,1
rlwimi 9,10,31,0,0
stw 9,0(3)
blr
.size   c, .-c
.ident  GCC: (GNU) 4.7.1 20120614 (RTEMS
gcc-4.7.1-3.suse12.1/newlib-1.20.0-10.suse12.1)

Here we see additional store and load operations to assemble the structure
value.

The test case (c) is also sub-optimal since two instructions are sufficient to
load a 32-bit constant.