public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43137]  New: redundant register move for sign extending
@ 2010-02-22  9:39 carrot at google dot com
  2010-02-22 14:33 ` [Bug target/43137] " ramana at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: carrot at google dot com @ 2010-02-22  9:39 UTC (permalink / raw)
  To: gcc-bugs

Compile following code with options -march=armv7-a -mthumb -Os

int foo();
long long bar22()
{
  int result = foo();
  return result;
}

GCC generates:

bar22:
        push    {r3, lr}
        bl      foo
        asrs    r3, r0, #31    // A
        mov     r1, r3         // B
        pop     {r3, pc}

Instruction A,B can be simplified to "asrs r1, r0, #31".

In rtl expand, result was first extended to a DI register and then the DI
register was moved to return register. In later passs the low half of the
return value and variable result were recognized as in the same register, so
the low part move was removed. After register allocation I get:

(call_insn 5 2 7 2 src/t5.c:5 (parallel [
            (set (reg:SI 0 r0)
                (call (mem:SI (symbol_ref:SI ("foo") [flags 0x41] 
<function_decl 0x7f6e60fe0600 foo>) [0 S4 A32])
                    (const_int 0 [0x0])))
            (use (const_int 0 [0x0]))
            (clobber (reg:SI 14 lr))
        ]) 255 {*call_value_insn} (nil)
    (nil))

(insn 7 5 22 2 src/t5.c:5 (set (reg:DI 2 r2 [orig:136 result ] [136])
        (sign_extend:DI (reg/v:SI 0 r0 [orig:133 result ] [133]))) 691
{*thumb2_extendsidi2} (nil))

(insn 22 7 15 2 src/t5.c:7 (set (reg:SI 1 r1 [+4 ])
        (reg:SI 3 r3 [ result+4 ])) 658 {*thumb2_movsi_insn} (nil))

The high part register move didn't get any chance to be removed until the end
of compilation.


-- 
           Summary: redundant register move for sign extending
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carrot at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


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


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

* [Bug target/43137] redundant register move for sign extending
  2010-02-22  9:39 [Bug target/43137] New: redundant register move for sign extending carrot at google dot com
@ 2010-02-22 14:33 ` ramana at gcc dot gnu dot org
  2010-09-06 22:32 ` bernds at gcc dot gnu dot org
  2010-09-07 11:17 ` bernds at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-02-22 14:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ramana at gcc dot gnu dot org  2010-02-22 14:32 -------
Confirmed.


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-22 14:32:54
               date|                            |


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


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

* [Bug target/43137] redundant register move for sign extending
  2010-02-22  9:39 [Bug target/43137] New: redundant register move for sign extending carrot at google dot com
  2010-02-22 14:33 ` [Bug target/43137] " ramana at gcc dot gnu dot org
@ 2010-09-06 22:32 ` bernds at gcc dot gnu dot org
  2010-09-07 11:17 ` bernds at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-09-06 22:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bernds at gcc dot gnu dot org  2010-09-06 22:32 -------
Subject: Bug 43137

Author: bernds
Date: Mon Sep  6 22:32:26 2010
New Revision: 163935

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163935
Log:
        PR target/43137
        * config/arm/iterators.md (qhs_zextenddi_cond, qhs_sextenddi_cond):
        New define_mode_attrs.
        * config/arm/arm.md (zero_extendsidi2, arm_zero_extendsidi2,
        arm_exxtendsidi2, arm_extendsidi2): Delete patterns.
        (zero_extend<mode>di2, extend<mode>di2 and related splits): New.
        (thumb1_zero_extendhisi2): Remove code to handle LABEL_REFs.
        Remove pool_range attribute.
        (arm_zero_extendhisi2, arm_zero_extendhisi2_v6, arm_zero_extendqisi2,
        arm_zero_extendqisi2_v6, thumb1_zero_extendqisi2_v6): Remove
        pool_range and neg_pool_range attributes.
        * config/arm/thumb2.md (thumb2_zero_extendsidi2,
        thumb2_zero_extendhidi2, thumb2_zero_extendqidi2, thumb2_extendsidi2,
        thumb2_extendhidi2, thumb2_extendqidi2): Delete.

        PR target/43137
        * gcc.target/arm/pr43137.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/arm/pr43137.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.md
    trunk/gcc/config/arm/iterators.md
    trunk/gcc/config/arm/thumb2.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/43137] redundant register move for sign extending
  2010-02-22  9:39 [Bug target/43137] New: redundant register move for sign extending carrot at google dot com
  2010-02-22 14:33 ` [Bug target/43137] " ramana at gcc dot gnu dot org
  2010-09-06 22:32 ` bernds at gcc dot gnu dot org
@ 2010-09-07 11:17 ` bernds at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-09-07 11:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bernds at gcc dot gnu dot org  2010-09-07 11:16 -------
Fixed.


-- 

bernds at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-09-07 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22  9:39 [Bug target/43137] New: redundant register move for sign extending carrot at google dot com
2010-02-22 14:33 ` [Bug target/43137] " ramana at gcc dot gnu dot org
2010-09-06 22:32 ` bernds at gcc dot gnu dot org
2010-09-07 11:17 ` bernds 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).