public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function
@ 2003-09-17  0:45 tm at kloo dot net
  2003-09-17  5:25 ` [Bug optimization/12305] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tm at kloo dot net @ 2003-09-17  0:45 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: processor return register saved/restore unnecessarily in
                    leaf function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tm at kloo dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-linux
  GCC host triplet: i386-linux
GCC target triplet: sh-elf

When this function is compiled:

int a, b; int foo(void) { return a + b; }

using -O2 -m4 -fPIC -S, the following code is created:

_foo:
        mov.l   r12,@-r15
        mova    .L3,r0
        mov.l   .L3,r12
        mov.l   r14,@-r15
        add     r0,r12
        mov.l   .L4,r0
        sts.l   pr,@-r15		<- PR saved unnecessarily
        mov.l   @(r0,r12),r1
        mov     r12,r0
        mov     r15,r14
        mov.l   @r1,r2
        mov.l   .L5,r1
        mov.l   @(r0,r1),r1
        mov.l   @r1,r1
        add     r1,r2
        mov     r2,r0
        mov     r14,r15
        lds.l   @r15+,pr		<- PR restored unnecessarily
        mov.l   @r15+,r14
        rts
        mov.l   @r15+,r12


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

* [Bug optimization/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
@ 2003-09-17  5:25 ` pinskia at gcc dot gnu dot org
  2003-11-08 21:17 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-17  5:25 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
  GCC build triplet|i386-linux                  |
   GCC host triplet|i386-linux                  |
           Keywords|                            |pessimizes-code


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

* [Bug optimization/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
  2003-09-17  5:25 ` [Bug optimization/12305] " pinskia at gcc dot gnu dot org
@ 2003-11-08 21:17 ` pinskia at gcc dot gnu dot org
  2003-11-08 21:46 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-08 21:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-08 21:17 -------
This version did not have the store/restore of the return register:
./cc1 --version
GNU C version 3.4 20030718 (experimental) (sh4-hardhat-linux)
        compiled by GNU C version 3.4 20030718 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

-- 


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


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

* [Bug optimization/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
  2003-09-17  5:25 ` [Bug optimization/12305] " pinskia at gcc dot gnu dot org
  2003-11-08 21:17 ` pinskia at gcc dot gnu dot org
@ 2003-11-08 21:46 ` pinskia at gcc dot gnu dot org
  2004-04-28  9:29 ` [Bug target/12305] " anilp1 at kpitcummins dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-08 21:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-08 21:46 -------
I can confirm this on the mainline (20031108), looks like sh-linux does do the saving or 
restoring of the return register for some reason.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-08 21:46:12
               date|                            |


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


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

* [Bug target/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
                   ` (2 preceding siblings ...)
  2003-11-08 21:46 ` pinskia at gcc dot gnu dot org
@ 2004-04-28  9:29 ` anilp1 at kpitcummins dot com
  2004-04-28 10:50 ` dhananjayd at kpitcummins dot com
  2004-04-28 11:41 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: anilp1 at kpitcummins dot com @ 2004-04-28  9:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From anilp1 at kpitcummins dot com  2004-04-28 07:26 -------
(In reply to comment #2)
> I can confirm this on the mainline (20031108), looks like sh-linux does do 
the saving or 
> restoring of the return register for some reason.

Hi,

Above mentioned bug is solved in gcc 3.5 mainline (snapshot dated 27-03-2004). 
But this bug is still there in released gcc 3.4.

Can anybody tell me which patch will fix this bug in gcc 3.4 ?

Regards,
Anil Paranjpe


-- 


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


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

* [Bug target/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
                   ` (3 preceding siblings ...)
  2004-04-28  9:29 ` [Bug target/12305] " anilp1 at kpitcummins dot com
@ 2004-04-28 10:50 ` dhananjayd at kpitcummins dot com
  2004-04-28 11:41 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dhananjayd at kpitcummins dot com @ 2004-04-28 10:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dhananjayd at kpitcummins dot com  2004-04-28 09:29 -------
Fixed with - 

http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02248.html

http://gcc.gnu.org/ml/gcc-cvs/2004-02/msg01310.html

This PR can be closed.

-Dhananjay

-- 


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


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

* [Bug target/12305] processor return register saved/restore unnecessarily in leaf function
  2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
                   ` (4 preceding siblings ...)
  2004-04-28 10:50 ` dhananjayd at kpitcummins dot com
@ 2004-04-28 11:41 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-28 11:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-28 11:24 -------
Fixed for 3.5.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


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


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

end of thread, other threads:[~2004-04-28 11:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17  0:45 [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function tm at kloo dot net
2003-09-17  5:25 ` [Bug optimization/12305] " pinskia at gcc dot gnu dot org
2003-11-08 21:17 ` pinskia at gcc dot gnu dot org
2003-11-08 21:46 ` pinskia at gcc dot gnu dot org
2004-04-28  9:29 ` [Bug target/12305] " anilp1 at kpitcummins dot com
2004-04-28 10:50 ` dhananjayd at kpitcummins dot com
2004-04-28 11:41 ` pinskia 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).