From patchwork Tue Feb 17 11:12:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 440558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 068CF14017E for ; Tue, 17 Feb 2015 22:13:31 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=MMQXsmvSmG/mM6OYtg1KtIWQ2HDxQsyvdWDJ9MjOE5e PDTWsQ/QlcPMuhwiOvQBY5FE2T1GQlM/pfeRcMbl0THQbRG98BztMYZ0YuC/4vaI DtXbzhYMc5NacybuN9f2hYURyu/eAe9leoRYyDX0BAiQAeD5kc0Ia8S/fLs8qHkU = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=zcSvmdqhSIfbh8c7DuCW06xcoN8=; b=NlAacurBHeScuQp+V N9mza55zT4E5dc7iXINHXDyIIRM0cR/gyVTpDVBMc4KDr1SPOKlt9TPCJezqvpPn OvxyYbHbSwEeK/+W2Wl7iafJIrqaF5KUqRja/RiDvcEu1AtiKtax3qwIqPPT0rY8 r4RDQlLosZZFvpSfNxFciC7Fxc= Received: (qmail 5204 invoked by alias); 17 Feb 2015 11:13:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5194 invoked by uid 89); 17 Feb 2015 11:13:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Feb 2015 11:13:14 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwTPbBBR62PQx1xqvTHw== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (ip5b43a95f.dynamic.kabel-deutschland.de [91.67.169.95]) by smtp.strato.de (RZmta 37.3 DYNA|AUTH) with ESMTPSA id Y030acr1HBDBkGZ (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate); Tue, 17 Feb 2015 12:13:11 +0100 (CET) Message-ID: <54E3223B.2070504@gjlay.de> Date: Tue, 17 Feb 2015 12:12:59 +0100 From: Georg-Johann Lay User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: GCC Patches CC: Denis Chertykov Subject: [patch, avr] Fix ICE PR64452 pushing eliminated rtxes X-IsSubscribed: yes Byte-wise pushing virtual regs like arg pointer migth result in patterns like (set (mem:QI (post_dec:HI (reg:HI 32 SP))) (subreg:QI (plus:HI (reg:HI 28) (const_int 17)) 0)) after elimination. Attached patch uses new pushhi1_insn to push virtuals in HImode so that expressions like in subreg_reg from above can be reloaded. Ok to commit ? Johann PR target/64452 * config/avr/avr.md (pushhi_insn): New insn. (push1): Push virtual regs in one chunk using pushhi1_insn. Index: config/avr/avr.md =================================================================== --- config/avr/avr.md (revision 220738) +++ config/avr/avr.md (working copy) @@ -371,6 +371,13 @@ (define_insn "push1" push __zero_reg__" [(set_attr "length" "1,1")]) +(define_insn "pushhi1_insn" + [(set (mem:HI (post_dec:HI (reg:HI REG_SP))) + (match_operand:HI 0 "register_operand" "r"))] + "" + "push %B0\;push %A0" + [(set_attr "length" "2")]) + ;; All modes for a multi-byte push. We must include complex modes here too, ;; lest emit_single_push_insn "helpfully" create the auto-inc itself. (define_mode_iterator MPUSH @@ -386,17 +393,42 @@ (define_expand "push1" [(match_operand:MPUSH 0 "" "")] "" { - int i; - - // Avoid (subreg (mem)) for non-generic address spaces below. Because - // of the poor addressing capabilities of these spaces it's better to - // load them in one chunk. And it avoids PR61443. - if (MEM_P (operands[0]) && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0]))) - operands[0] = copy_to_mode_reg (mode, operands[0]); + { + // Avoid (subreg (mem)) for non-generic address spaces. Because + // of the poor addressing capabilities of these spaces it's better to + // load them in one chunk. And it avoids PR61443. + + operands[0] = copy_to_mode_reg (mode, operands[0]); + } + else if (REG_P (operands[0]) + && IN_RANGE (REGNO (operands[0]), FIRST_VIRTUAL_REGISTER, + LAST_VIRTUAL_REGISTER)) + { + // Byte-wise pushing of virtual regs might result in something like + // + // (set (mem:QI (post_dec:HI (reg:HI 32 SP))) + // (subreg:QI (plus:HI (reg:HI 28) + // (const_int 17)) 0)) + // + // after elimination. This cannot be handled by reload, cf. PR64452. + // Reload virtuals in one chunk. That way it's possible to reload + // above situation and finally + // + // (set (reg:HI **) + // (const_int 17)) + // (set (reg:HI **) + // (plus:HI (reg:HI **) + // (reg:HI 28))) + // (set (mem:HI (post_dec:HI (reg:HI 32 SP)) + // (reg:HI **))) + + emit_insn (gen_pushhi1_insn (operands[0])); + DONE; + } - for (i = GET_MODE_SIZE (mode) - 1; i >= 0; --i) + for (int i = GET_MODE_SIZE (mode) - 1; i >= 0; --i) { rtx part = simplify_gen_subreg (QImode, operands[0], mode, i); if (part != const0_rtx)