From patchwork Fri Feb 7 22:36:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 318337 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 7FC8C2C007A for ; Sat, 8 Feb 2014 09:36:14 +1100 (EST) 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:subject:content-type; q= dns; s=default; b=ryVqB9ZlXV0eiD45kwXsjyO0+CwDoqFWfgNERhmnp1yAMZ Xrb2OrEUItRxpEKPR2ijKxHXtyho6WchJVrHvJUlzhwMMphktZQ1daVyaP5VqtX3 WO9NhDf2LRNprhmczsRsyS2v6qkaFd2srZ0nBOYa71e1yAGxMDGMx7sl03mWU= 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:subject:content-type; s= default; bh=Tn1eEtTZZEkBilcbzsUXXd4UDfA=; b=u9sshU+Xsk/M/ui3eV58 NBgCHyV4NTtohwi5j7+DhtGayO4sxPxLLQIyKqgj/zklAO9RRkPLRfOJcbYvJM7U QQ1iGmc5683BUwO1HGj/H42L0ans20Bq2QjeT+RBbbQAqUzxZrsM7Jg2K4PheAwJ s5EXrabwIHXGdv3C92cJZes= Received: (qmail 5320 invoked by alias); 7 Feb 2014 22:36:07 -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 5310 invoked by uid 89); 7 Feb 2014 22:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2014 22:36:05 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s17Ma3VP011243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Feb 2014 17:36:04 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-146.phx2.redhat.com [10.3.113.146]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s17Ma3i0021999 for ; Fri, 7 Feb 2014 17:36:03 -0500 Message-ID: <52F55FD3.9000600@redhat.com> Date: Fri, 07 Feb 2014 15:36:03 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: gcc-patches Subject: [PR target/40977] Split ashldi_extsi X-IsSubscribed: yes As outlined in the PR, we end up generating poor code because of the existence of the ashldi_extsi insn in the m68k backend. The pattern recognizes that left shifting a DImode value by 32 deposits the low part of the input into the high part of the output and clears the low part of the output. That's a fine thing to recognize, except that it's a two instruction insn. If (for example) the next insn happens to overwrite those low bits then the clearing done by the 2nd instruction generated by ashldi_extsi is dead. The obvious way to fix this is to turn the pattern into a define_insn_and_split. One could certainly make an argument that to the extent possible every insn that generates multiple instructions like this ought to turn into a define_insn_and_split. However, I don't think there's enough interest in the m68k port to warrant the time spent. Tested by building m68k cross and verifying correct output for the testcase. Installed on the trunk. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce9c066..1237904 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2014-02-07 Jeff Law + PR target/40977 + * config/m68k/m68k.md (ashldi_extsi): Turn into a + define_insn_and_split. + * ipa-inline.c (inline_small_functions): Fix typos. 2014-02-07 Richard Sandiford diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 7bf9abd..e61048b 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -4338,25 +4338,18 @@ ;; arithmetic shift instructions ;; We don't need the shift memory by 1 bit instruction - -(define_insn "ashldi_extsi" +(define_insn_and_split "ashldi_extsi" [(set (match_operand:DI 0 "nonimmediate_operand" "=ro") (ashift:DI (match_operator:DI 2 "extend_operator" [(match_operand:SI 1 "general_operand" "rm")]) (const_int 32)))] "" -{ - CC_STATUS_INIT; - if (GET_CODE (operands[0]) == REG) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); - else - operands[2] = adjust_address (operands[0], SImode, 4); - if (ADDRESS_REG_P (operands[0])) - return "move%.l %1,%0\;sub%.l %2,%2"; - else - return "move%.l %1,%0\;clr%.l %2"; -}) + "#" + "&& reload_completed" + [(set (match_dup 3) (match_dup 1)) + (set (match_dup 2) (const_int 0))] + "split_di(operands, 1, operands + 2, operands + 3);") (define_insn "ashldi_sexthi" [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")