public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/64785] New: [5 Regression][SH] and|or|xor #imm not used
@ 2015-01-25 13:12 olegendo at gcc dot gnu.org
  2015-01-26 11:27 ` [Bug target/64785] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-01-25 13:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64785

            Bug ID: 64785
           Summary: [5 Regression][SH] and|or|xor #imm not used
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

It seems that for some reason loading a constant is now favored instead of
using the #imm,R0 alternative.

void test000 (int* x, int xb)
{
  x[0] = xb & 128;
}

void test001 (int* x, int xb)
{
  x[0] = xb | 128;
}

void test002 (int* x, int xb)
{
  x[0] = xb ^ 128;
}

trunk:
_test000:
    mov.w    .L7,r1    ! 15    *movhi/1    [length = 2]
    and    r1,r5    ! 7    *andsi_compact/4    [length = 2]
    rts        ! 18    *return_i    [length = 2]
    mov.l    r5,@r4    ! 8    movsi_ie/9    [length = 2]

4.9:
    mov    r5,r0    ! 15    movsi_ie/2    [length = 2]
    and    #128,r0    ! 7    *andsi_compact/3    [length = 2]
    rts        ! 18    *return_i    [length = 2]
    mov.l    r0,@r4    ! 8    movsi_ie/9    [length = 2]


The RTL before RA is the same in both cases:

(insn 7 4 8 2 (set (reg:SI 163 [ D.1431 ])
        (and:SI (reg:SI 5 r5 [ xb ])
            (const_int 128 [0x80]))) sh_tmp.cpp:257 124 {*andsi_compact}
     (expr_list:REG_DEAD (reg:SI 5 r5 [ xb ])
        (nil)))
(insn 8 7 0 2 (set (mem:SI (reg:SI 4 r4 [ x ]) [1 *x_4(D)+0 S4 A32])
        (reg:SI 163 [ D.1431 ])) sh_tmp.cpp:257 257 {movsi_ie}
     (expr_list:REG_DEAD (reg:SI 4 r4 [ x ])
        (expr_list:REG_DEAD (reg:SI 163 [ D.1431 ])
            (nil))))

Reload on trunk says:

Reloads for insn # 7
Reload 0: reload_in (SI) = (const_int 128 [0x80])
    GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 2)
    reload_in_reg: (const_int 128 [0x80])
    reload_reg_rtx: (reg:SI 1 r1)


While reload on 4.9 says:

Reloads for insn # 7
Reload 0: reload_in (SI) = (reg:SI 5 r5 [ xb ])
    reload_out (SI) = (reg:SI 0 r0 [orig:163 D.1377 ] [163])
    R0_REGS, RELOAD_OTHER (opnum = 0)
    reload_in_reg: (reg:SI 5 r5 [ xb ])
    reload_out_reg: (reg:SI 0 r0 [orig:163 D.1377 ] [163])
    reload_reg_rtx: (reg:SI 0 r0 [orig:163 D.1377 ] [163])

Maybe this is because the function argument from hardreg r5 is propagated into
the insn.  This propagation is also causing unnecessary sign/zero extensions,
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53987#c9


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

end of thread, other threads:[~2022-02-26 15:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25 13:12 [Bug target/64785] New: [5 Regression][SH] and|or|xor #imm not used olegendo at gcc dot gnu.org
2015-01-26 11:27 ` [Bug target/64785] " rguenth at gcc dot gnu.org
2015-01-27 23:46 ` olegendo at gcc dot gnu.org
2015-01-28 17:07 ` olegendo at gcc dot gnu.org
2015-03-07 12:23 ` olegendo at gcc dot gnu.org
2015-03-07 12:31 ` olegendo at gcc dot gnu.org
2015-03-07 12:34 ` olegendo at gcc dot gnu.org
2015-03-08  0:31 ` kkojima at gcc dot gnu.org
2015-03-08 10:24 ` olegendo at gcc dot gnu.org
2015-04-22 12:02 ` [Bug target/64785] [5/6 " jakub at gcc dot gnu.org
2015-07-16  9:15 ` rguenth at gcc dot gnu.org
2021-05-14  9:47 ` [Bug target/64785] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-02-26 15:47 ` roger at nextmovesoftware 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).