public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/11825] New: [ARM] Redundant move in some cases (dead code before return)
@ 2003-08-06  9:00 alga at rgai dot hu
  2003-08-06 12:37 ` [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets pinskia at physics dot uc dot edu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: alga at rgai dot hu @ 2003-08-06  9:00 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=11825

           Summary: [ARM] Redundant move in some cases (dead code before
                    return)
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
        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

In some cases before the function return GCC generates a redundant mov defining
r0 just before another instruction defines r0 again. The first (dead) mov is
unnecessary (see the example).

--- c example ---
int foo (int a, int x)
{
  long long b,c;
  b = a << 16;
  c = x << 8;
  b += c;
  return (int)(b >> 32);
}

--- arm code ---
foo:
  mov	r1, r1, asl #8
  mov	r2, r1, asr #31
  mov	r0, r0, asl #16
  stmfd	sp!, {r4, lr}
  adds	r3, r1, r0
  adc	r4, r2, r0, asr #31
  mov	r1, r4
  mov	r0, r3  <- OLD
  mov	r0, r1
  ldmfd	sp!, {r4, pc}

--- possible solution ---
foo:
  mov	r1, r1, asl #8
  mov	r2, r1, asr #31
  mov	r0, r0, asl #16
  stmfd	sp!, {r4, lr}
  adds	r3, r1, r0
  adc	r4, r2, r0, asr #31
  mov	r1, r4
  mov	r0, r1
  ldmfd	sp!, {r4, pc}


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

* [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets
  2003-08-06  9:00 [Bug target/11825] New: [ARM] Redundant move in some cases (dead code before return) alga at rgai dot hu
@ 2003-08-06 12:37 ` pinskia at physics dot uc dot edu
  2003-08-06 15:11 ` pinskia at physics dot uc dot edu
  2003-08-23  1:57 ` dhazeghi at yahoo dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 12:37 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=11825


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement
             Status|UNCONFIRMED                 |NEW
          Component|target                      |optimization
     Ever Confirmed|                            |1
 GCC target triplet|arm-unknown-elf             |arm-*-elf, powerpc-*-*
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-06 12:37:31
               date|                            |
            Summary|[ARM] Redundant move in some|Redundant move in some cases
                   |cases (dead code before     |(dead code before return)
                   |return)                     |for long long on 32bit
                   |                            |targets


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-06 12:37 -------
A fix might to add to combine:
(set b (ashiftrt:DI a (const_int 32))
(set c (subreg:SI b 4))
To (set c (subreg:SI a 8))

(Aka b = a >> 32; c = (int)b; To c = (upper part of long long)b;  where b and a are long 
long's).
This also happens on powerpc-*-*.  I can confirm this on the mainline (20030806).


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

* [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets
  2003-08-06  9:00 [Bug target/11825] New: [ARM] Redundant move in some cases (dead code before return) alga at rgai dot hu
  2003-08-06 12:37 ` [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets pinskia at physics dot uc dot edu
@ 2003-08-06 15:11 ` pinskia at physics dot uc dot edu
  2003-08-23  1:57 ` dhazeghi at yahoo dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 15: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=11825


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|arm-*-elf, powerpc-*-*      |arm-*


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-06 15:11 -------
I looked at powerpc's rtl and it does not match arm's rtl.  Arm's problem is that ashifrt is a 
libcall and that is where the problem is.


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

* [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets
  2003-08-06  9:00 [Bug target/11825] New: [ARM] Redundant move in some cases (dead code before return) alga at rgai dot hu
  2003-08-06 12:37 ` [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets pinskia at physics dot uc dot edu
  2003-08-06 15:11 ` pinskia at physics dot uc dot edu
@ 2003-08-23  1:57 ` dhazeghi at yahoo dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:57 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=11825


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
   Target Milestone|3.4                         |---


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

end of thread, other threads:[~2003-08-23  1:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06  9:00 [Bug target/11825] New: [ARM] Redundant move in some cases (dead code before return) alga at rgai dot hu
2003-08-06 12:37 ` [Bug optimization/11825] Redundant move in some cases (dead code before return) for long long on 32bit targets pinskia at physics dot uc dot edu
2003-08-06 15:11 ` pinskia at physics dot uc dot edu
2003-08-23  1:57 ` 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).