public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/53976] New: [SH] Unnecessary clrt after bt
@ 2012-07-15 20:43 olegendo at gcc dot gnu.org
  2012-09-23 20:50 ` [Bug target/53976] " olegendo at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-07-15 20:43 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53976
           Summary: [SH] Unnecessary clrt after bt
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: olegendo@gcc.gnu.org
            Target: sh*-*-*


The following function 

long long test (long long a, long long b, int c, int d)
{
  if (c != d)
    return a + b;

  return 0;
}

compiled with -O2 -m4-single -ml:

        mov.l   @(4,r15),r1    ! 47    movsi_ie/7    [length = 2]
        mov.l   @r15,r2         ! 48    movsi_ie/7    [length = 2]
        cmp/eq  r1,r2           ! 10    cmpeqsi_t/3    [length = 2]
        bt/s    .L3             ! 11    branch_true    [length = 2]
        clrt                    ! 53    clrt    [length = 2]
        addc    r4,r6           ! 54    addc    [length = 2]
        addc    r5,r7           ! 55    addc1    [length = 2]
        mov     r6,r0           ! 32    movsi_ie/2    [length = 2]
        rts                     ! 59    *return_i    [length = 2]
        mov     r7,r1           ! 33    movsi_ie/2    [length = 2]
        .align 1
.L3:
        mov     #0,r6           ! 51    movsi_ie/3    [length = 2]
        mov     #0,r7           ! 52    movsi_ie/3    [length = 2]
        mov     r6,r0           ! 63    movsi_ie/2    [length = 2]
        rts                     ! 66    *return_i    [length = 2]
        mov     r7,r1           ! 64    movsi_ie/2    [length = 2]

The clrt insn is not needed since T = 0 if the conditional branch is not taken.
The same applies for DImode subtraction.


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

end of thread, other threads:[~2014-11-23 21:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-15 20:43 [Bug target/53976] New: [SH] Unnecessary clrt after bt olegendo at gcc dot gnu.org
2012-09-23 20:50 ` [Bug target/53976] " olegendo at gcc dot gnu.org
2012-09-23 21:27 ` olegendo at gcc dot gnu.org
2013-08-03  8:08 ` olegendo at gcc dot gnu.org
2013-11-21  8:19 ` olegendo at gcc dot gnu.org
2013-11-21  9:03 ` olegendo at gcc dot gnu.org
2013-11-25 16:47 ` olegendo at gcc dot gnu.org
2014-08-13 22:02 ` [Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf olegendo at gcc dot gnu.org
2014-11-23 17:37 ` olegendo at gcc dot gnu.org
2014-11-23 21:17 ` olegendo at gcc dot gnu.org
2014-11-23 21:45 ` olegendo at gcc dot gnu.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).