From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112937 invoked by alias); 12 Aug 2019 06:47:58 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 112929 invoked by uid 89); 12 Aug 2019 06:47:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=H*F:U*john, feels, H*f:sk:70b9bcc, waste X-HELO: jocasta.intra Received: from de.cellform.com (HELO jocasta.intra) (88.217.224.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Aug 2019 06:47:56 +0000 Received: from jocasta.intra (localhost [127.0.0.1]) by jocasta.intra (8.15.2/8.15.2/Debian-8) with ESMTPS id x7C6ljIV026572 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Aug 2019 08:47:45 +0200 Received: (from john@localhost) by jocasta.intra (8.15.2/8.15.2/Submit) id x7C6lhoU026571; Mon, 12 Aug 2019 08:47:43 +0200 Date: Mon, 12 Aug 2019 06:47:00 -0000 From: John Darrington To: Segher Boessenkool Cc: John Darrington , Vladimir Makarov , Jeff Law , Paul Koning , gcc@gcc.gnu.org Subject: Re: Indirect memory addresses vs. lra Message-ID: <20190812064743.hyxu2lfiat5sb44p@jocasta.intra> References: <2B3A4EAB-D69E-4714-8FC4-C25E36B07BFF@comcast.net> <20190808172102.GH31406@gate.crashing.org> <2EEBCFAE-FF25-4664-AA5F-B3299CEA3CB1@comcast.net> <20190808191914.GK31406@gate.crashing.org> <20190809081439.baoyu3ii5i2qfbzt@jocasta.intra> <70b9bcc9-e12a-78b4-b8cc-a67b7ca3d38d@redhat.com> <20190810060553.m6e42sovw7s4xqoa@jocasta.intra> <20190810161218.GQ31406@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190810161218.GQ31406@gate.crashing.org> User-Agent: NeoMutt/20170113 (1.7.2) X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00090.txt.bz2 On Sat, Aug 10, 2019 at 11:12:18AM -0500, Segher Boessenkool wrote: Hi! On Sat, Aug 10, 2019 at 08:05:53AM +0200, John Darrington wrote: > Choosing alt 5 in insn 14: (0) m (1) m {*movsi} > 14: [r40:PSI+0x20]=[r41:PSI] > Inserting insn reload before: > 48: r40:PSI=r34:PSI > 49: r41:PSI=[y:PSI+0x2f] insn 14 is a mem-to-mem move (another feature not many more modern / more RISCy CPUs have). That requires both of your address registers. So far, so good. The reloads (insn 48 and 49) require address registers themselves; that isn't necessarily a problem either. So far as I can see, insn 48 is completely redundant. It's copying a pseudo reg (74) into another pseudo reg (40). This is pointless and a waste, since insn 14 does not modify 74. I don't understand why lra feels the need to do it. If lra knew about (mem (mem ...)) style addressing, then insn 49 would also be redundant (which is why I raised the topic). In summary, what we have is: (insn 48 84 49 2 (set (reg/f:PSI 40 [34]) (reg/f:PSI 74 [34])) (nil)) (insn 49 48 14 2 (set (reg:PSI 41) (mem/f/c:PSI (plus:PSI (reg/f:PSI 9 y) (const_int 47 [0x2f])) [3 p+0 S4 A8])) (nil)) (insn 14 49 15 2 (set (mem:SI (plus:PSI (reg/f:PSI 40 [34]) (const_int 32 [0x20])) [2 S4 A64]) (mem:SI (reg:PSI 41) [2 *p_5(D)+0 S4 A8])) where, like you say, insns 48 and 49 are reloads. But these two reloads are unnecessary and cause the machine to run out of PSImode registers. The above could be easier and more efficiently done simply as: (insn 14 11 15 2 (set (mem:SI (plus:PSI (reg/f:PSI 74 [34]) (const_int 32 [0x20])) [2 S4 A64]) (mem/f/c:PSI (mem:PSI (plus:PSI (reg/f:PSI 9 y) (const_int 47 [0x2f])) [3 p+0 S4 A8]))) This is exactly what we had before lra messed with things. It can be represented in the ISA with one assembler instruction: mov.p (32, x), [47, y] and if I'm not mistaken, alternative 5 of my "movpsi" pattern should do this just fine. But this requires careful juggling. Maybe you will need some backend code Could you give a hint into which set of hooks/constraints/predicates this backend code should go? -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key.