From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70835 invoked by alias); 30 Jan 2018 06:07:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70816 invoked by uid 89); 30 Jan 2018 06:07:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=occasionally 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; Tue, 30 Jan 2018 06:07:15 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97580C047B65; Tue, 30 Jan 2018 06:07:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-50.rdu2.redhat.com [10.10.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D95E5C266; Tue, 30 Jan 2018 06:07:13 +0000 (UTC) Subject: Re: Fix LRA subreg calculation for big-endian targets To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org References: <87inbopx9c.fsf@linaro.org> From: Jeff Law Message-ID: <0d800dcc-9a9d-88d2-6760-85f62679d126@redhat.com> Date: Tue, 30 Jan 2018 07:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <87inbopx9c.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg02317.txt.bz2 On 01/26/2018 06:25 AM, Richard Sandiford wrote: > LRA was using a subreg offset of 0 whenever constraints matched > two operands with different modes. That leads to an invalid offset > (and ICE) on big-endian targets if one of the modes is narrower > than a word. E.g. if a (reg:SI X) is matched to a (reg:QI Y), > the big-endian subreg should be (subreg:QI (reg:SI X) 3) rather > than (subreg:QI (reg:SI X) 0). Yup. That can't be right on big endian. > > But this raises the issue of what the behaviour should be when the > matched operands occupy different numbers of registers. Should the > register numbers match, or should the locations of the lsbs match? > Although the documentation isn't clear, reload went for the second > interpretation (which seems the most natural to me): I can even recall seeing that interpretation in local-alloc.c and/or global.c from eons ago in the context of register tying. Both essentially punted doing anything smart in that case anyway leading to occasionally dreadful code for simple extensions. > > /* On a REG_WORDS_BIG_ENDIAN machine, point to the last register of a > multiple hard register group of scalar integer registers, so that > for example (reg:DI 0) and (reg:SI 1) will be considered the same > register. */ > > So I think this means that we can/must use the lowpart offset > unconditionally, rather than trying to separate out the multi-register > case. This also matches the LRA handling of constant integers, which > already uses lowpart subregs. > > The patch fixes gcc.target/aarch64/sve/extract_[34].c for aarch64_be. > > Tested on aarch64_be-none-elf, aarch64-linux-gnu and x86_64-linux-gnu. > OK to install? > > > 2018-01-26 Richard Sandiford > > gcc/ > * lra-constraints.c (match_reload): Use subreg_lowpart_offset > rather than 0 when creating partial subregs. OK. Makes me wonder how many big endian LRA targets are getting significant use. jeff