public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11826] New: [ARM] Minor register allocation problem before function return
@ 2003-08-06  9:13 alga at rgai dot hu
  2003-08-11 12:45 ` [Bug optimization/11826] " pinskia at gcc dot gnu dot org
  2003-08-25  0:11 ` dhazeghi at yahoo dot com
  0 siblings, 2 replies; 3+ messages in thread
From: alga at rgai dot hu @ 2003-08-06  9:13 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=11826

           Summary: [ARM] Minor register allocation problem before function
                    return
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alga at rgai dot hu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-elf

For C functions with a return value GCC should store the result of the last
instruction just before returning it in r0 (in order to avoid using unnecessary
register moves).
The new register allocation algorithm doesn't solve this problem either.

--- c example ---
int foo (int a, int b)
{
  if(a+b == 0) return a-b;
  return b-a;
}

--- arm code ---
--- arm-elf-gcc -S -g0 -Os -o reg-alloc.s reg-alloc.c ---
foo:
 cmn r0, r1
 rsb r3, r1, r0
 rsbne r3, r0, r1
 mov r0, r3
 mov pc, lr

--- arm code with new-ra ---
--- arm-elf-gcc -S -g0 -Os -fnew-ra -o reg-alloc.s reg-alloc.c ---
foo:
 mov r3, r0
 cmn r3, r1
 rsb r0, r1, r0
 rsbne r0, r3, r1
 mov pc, lr

--- possible solution ---
foo:
   cmn r0, r1
   rsbeq r0, r1, r0
   rsbne r0, r0, r1
   mov pc, lr


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

* [Bug optimization/11826] [ARM] Minor register allocation problem before function return
  2003-08-06  9:13 [Bug optimization/11826] New: [ARM] Minor register allocation problem before function return alga at rgai dot hu
@ 2003-08-11 12:45 ` pinskia at gcc dot gnu dot org
  2003-08-25  0:11 ` dhazeghi at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-11 12: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=11826


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement
   Target Milestone|3.4                         |---


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

* [Bug optimization/11826] [ARM] Minor register allocation problem before function return
  2003-08-06  9:13 [Bug optimization/11826] New: [ARM] Minor register allocation problem before function return alga at rgai dot hu
  2003-08-11 12:45 ` [Bug optimization/11826] " pinskia at gcc dot gnu dot org
@ 2003-08-25  0:11 ` dhazeghi at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-25  0:11 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=11826


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-25 00:11:10
               date|                            |


------- Additional Comments From dhazeghi at yahoo dot com  2003-08-25 00:11 -------
Confirmed with gcc mainline (20030824).


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

end of thread, other threads:[~2003-08-25  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06  9:13 [Bug optimization/11826] New: [ARM] Minor register allocation problem before function return alga at rgai dot hu
2003-08-11 12:45 ` [Bug optimization/11826] " pinskia at gcc dot gnu dot org
2003-08-25  0:11 ` dhazeghi at yahoo dot com

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).