From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 61D133858414 for ; Mon, 6 Sep 2021 11:14:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61D133858414 Received: by mail-ej1-x632.google.com with SMTP id jg16so12827835ejc.1 for ; Mon, 06 Sep 2021 04:14:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l/qfBNHxuM2xDRS/2FKr2JcmdquqzRJ2HRsp3JD01VQ=; b=bHHklP3Kb+kHuHjXoh46c9pQflp/SxsWYBQq/+ttChvHDG2Zo6gL3hXaZnACG5Re7r OJ/EZk/yEyaxCvpHaEVU80LXaROhTKsiUeT6bXJnuexRlr3i1xxsDvejPlj1L03KJi7h 00+EqkwRTRGVMTg0J+tNB5j+gOWsfe0WwKuPN5gsW98uCwFvGScwSbPzvNFItsRWpEK7 Rp1rMU4qsc+lt0a2k9iJuaZxA1kuDRyQpDsOQ6/Z2fNreAb1httgnOo+OmUoBj58poty w/VWqRXLwyRNZ1+4uK5B7qFjjxUKW7FcjJWcWcOqBUGcP25Xlx/s6NXfLrm0wO5T7mCj WGVw== X-Gm-Message-State: AOAM531mfZdX4VIP7wVog4tFS3tKDd1+WTU6mCAgtX96zaQ78e8YFut4 pqJ6IcPFj7kyZFuempDmQK3+DwU2UmOyL2QnzSo= X-Google-Smtp-Source: ABdhPJw5H1ona8PFBOg3q4Qa0eKzKUiKYzou0qPMdzuB5tJk7LpryWSlqZ2GbZUxU4AjL0ey7oIPhFCD8ZoDfNkeU/g= X-Received: by 2002:a17:907:2677:: with SMTP id ci23mr12819435ejc.429.1630926849323; Mon, 06 Sep 2021 04:14:09 -0700 (PDT) MIME-Version: 1.0 References: <20210906104018.2697413-1-rearnsha@arm.com> <20210906104018.2697413-2-rearnsha@arm.com> In-Reply-To: From: Richard Biener Date: Mon, 6 Sep 2021 13:13:58 +0200 Message-ID: Subject: Re: [PATCH 1/3] rtl: allow forming subregs of already unaligned mems [PR102125] To: Richard Earnshaw Cc: Richard Earnshaw , Bernd Edlinger , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 11:14:15 -0000 On Mon, Sep 6, 2021 at 1:08 PM Richard Earnshaw wrote: > > > > On 06/09/2021 11:58, Richard Biener via Gcc-patches wrote: > > On Mon, Sep 6, 2021 at 12:40 PM Richard Earnshaw wrote: > >> > >> > >> GCC was recently changed to prevent simplify_subreg from simplifying > >> a subreg of a mem when the mode of the new mem would have stricter alignment > >> constraints than the inner mem already has when the target requires > >> STRICT_ALIGNMENT. > >> > >> However, such targets may have specialist patterns that can handle > >> unaligned accesses and this restriction turns out to be unduly restrictive. > >> So limit this restriction to only apply when the inner mem is naturally > >> aligned to the inner mode. > > > > Hmm, I think this can end up either generating wrong code or > > recog fails. The specific combination of alignment and mode of 'op' > > has been validated to be supported, replacing the mode with sth > > else would need re-validation of the combination. I'm not sure > > we can for example just query movmisalign support here and > > hope for LRA to reload the mem with that. > > > > So - where do you run into this? Is it possible to catch the > > situation on a higher level where more context as in the whole insn > > is visible? > > I ran into it with patch 2 of this series when calling gen_highpart on a > misaligned mem. IIRC gen_highpart would end up returning (subreg:SI > (mem:DI (addr [A8])) 4), while gen_lowpart would simplify the operation > to (mem:SI (addr [A8])) as expected. > > (subreg:SI (mem:DI (addr [A8])) 4) is really problematic, because it's > not a memory_operand (from the manual: it will get reloaded into a > register later on). But that's no good here, I don't want this > reloading into a wide register later, I need it to be narrowed to the > component part now. So maybe calling gen_highpart is not what you want then? adjust_address is IIRC what one uses to offset a MEM and change its mode. Richard. > > R. > > > > > Thanks, > > Richard. > > > >> > >> gcc/ChangeLog: > >> > >> PR target/102125 > >> * simplify-rtx.c (simplify_context::simplify_subreg): Allow > >> simplifying (subreg (mem())) when the inner mem is already > >> misaligned for its type. > >> --- > >> gcc/simplify-rtx.c | 6 +++++- > >> 1 file changed, 5 insertions(+), 1 deletion(-) > >>