From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19193 invoked by alias); 7 Feb 2013 19:25:59 -0000 Received: (qmail 18307 invoked by uid 48); 7 Feb 2013 19:25:00 -0000 From: "vmakarov at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/56195] [4.8 Regression] Error: incorrect register `%rdi' used with `l' suffix (at -O2) Date: Thu, 07 Feb 2013 19:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: ra, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vmakarov at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-02/txt/msg00712.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56195 Vladimir Makarov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vmakarov at redhat dot com --- Comment #4 from Vladimir Makarov 2013-02-07 19:24:58 UTC --- (In reply to comment #3) > I'd say the bug is in get_reload_reg. > Changing pseudo 118 in operand 0 of insn 90 on equiv 0 > Changing address in insn 90 r59:DI -- no change > Changing pseudo 59 in address of insn 90 on equiv 0 > Creating newreg=137, assigning class GENERAL_REGS to address r137 > Choosing alt 1 in insn 90: (0) r (1) rm > Reuse r137 for reload 0, change to class INDEX_REGS for r137 > 90: flags:CCGC=cmp(r137:DI,[r137:DI]) > Inserting insn reload before: > 256: r137:DI=0 > > > 3065 if (get_reload_reg (type, mode, old, goal_alt[i], "", &new_reg) > 3066 && type != OP_OUT) > > calls it with > type=OP_IN, mode=SImode, original=const0_rtx, rclass=GENERAL_REGS > but returns new_reg = (reg:DI 137). > That is because: > if (rtx_equal_p (curr_insn_input_reloads[i].input, original) > && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class)) > doesn't check any mode if original (and curr_insn_input_reloads[i].input) are > VOIDmode as in this case. So, either this can be fixed by doing: > if (rtx_equal_p (curr_insn_input_reloads[i].input, original) > - && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class)) > + && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class) > + && GET_MODE (curr_insn_input_reloads[i].reg) == mode) > , or we could try better, if the GET_MODE (curr_insn_input_reloads[i].reg) > is wider than mode, see if we can create a lowpart subreg thereof and return > that, and only give up (i.e. continue looping) if creation of the lowpart > subreg for some reason failed. > > Vlad, what do you think? I think, the second solution with lowpart is better. Would you like to make a patch or may be you prefer that I work on it?