From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8962 invoked by alias); 25 Jan 2015 13:12:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8806 invoked by uid 48); 25 Jan 2015 13:11:32 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/64785] New: [5 Regression][SH] and|or|xor #imm not used Date: Sun, 25 Jan 2015 13:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg02769.txt.bz2 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