From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id EA76B3858D3C for ; Sat, 9 Jul 2022 17:14:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA76B3858D3C Received: by mail-pj1-x1033.google.com with SMTP id o31-20020a17090a0a2200b001ef7bd037bbso1392976pjo.0 for ; Sat, 09 Jul 2022 10:14:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=KzVkNUiLR4iYhJ9tjdieYq7jh/F12F1U61gVAc98iGY=; b=tsrklMoFcPye/nfFym5ugsqoDft5cbZGZUOG8c/U2I0Y9xHx8pgjd3ztaPesR2Xltt 4b5jtZWodasL/kopmymkGb8BT9GK7N432/LShkrZ+wtF++Ih1JAm85cTZFc+hC5OTSuN V+tb9VDPyFjGVwVnUw1womFtkH7gu+fUJrWwDJlzjDuIpqtkMFuW1+hVCT/LPbkm5tl7 opz+gFnxuT9ep2xZofLtifFw78cBMvf2SKAA3rICp65GFZEiHf8k1mKyW7LE/HFndsq+ 74thH85FlLFLj93TI+3ZreykhZu6ZtxwCGcxh9jzNCzAAftRkttJ3dNZGM1lMZtT+wgb M1WA== X-Gm-Message-State: AJIora+1tFSGi/QTuTbdZBYIpcjzgnCXvSxeJdbdKX7OwyeH+0780K58 rIhoncdbfBd8WJ82g7qP9T8UcEAWdqQ= X-Google-Smtp-Source: AGRyM1tOxw9AO1xQlBvkMV/XytcX/0/58y0XD6BTj1nUarog548FiZrNIfU9nSb6vQcmRQL+DmP1Ng== X-Received: by 2002:a17:90b:1c02:b0:1ed:4bfb:7772 with SMTP id oc2-20020a17090b1c0200b001ed4bfb7772mr7252808pjb.139.1657386897637; Sat, 09 Jul 2022 10:14:57 -0700 (PDT) Received: from [172.31.0.204] (c-73-63-24-84.hsd1.ut.comcast.net. [73.63.24.84]) by smtp.gmail.com with ESMTPSA id i2-20020a63e902000000b00408b89e4282sm1386394pgh.47.2022.07.09.10.14.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Jul 2022 10:14:57 -0700 (PDT) Message-ID: <851ff0bb-4f4a-26da-36da-8276f728415e@gmail.com> Date: Sat, 9 Jul 2022 11:14:56 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] [PR100106] Reject unaligned subregs when strict alignment is required Content-Language: en-US To: gcc-patches@gcc.gnu.org References: <20220505143308.GC25951@gate.crashing.org> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sat, 09 Jul 2022 17:15:03 -0000 On 5/5/2022 8:41 PM, Alexandre Oliva via Gcc-patches wrote: > On May 5, 2022, Segher Boessenkool wrote: > >> On Thu, May 05, 2022 at 03:52:01AM -0300, Alexandre Oliva wrote: >>> + else if (reg && MEM_P (reg) >>> + && STRICT_ALIGNMENT && MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (omode)) >>> + return false; >> Please fix the line breaks? Either do a break before every &&, or put >> as many things as possible on one line? > I was going for conceptual grouping of alignment-related subexprs, > but I don't care enough to fight for it. > >> Note that you should never have paradoxical subregs of mem on rs6000 or >> any other target with INSN_SCHEDULING. > Great, that alleviates some of my concerns about overreaching in this patch. > >>> +#include "../../gcc.c-torture/compile/pr100106.c" >> It is better to copy the 11 lines of code. > 'k > >> Please comment what the ilp32 is for (namely, the -mcpu= will barf >> without it).. > Ack > >> The testcase is okay with those changes, thanks! > Thanks. Here's the revised patch. > > I'm now testing on several platforms a follow-up patch that introduces > TARGET_ALLOW_SUBREG_OF_MEM. > > > [PR100106] Reject unaligned subregs when strict alignment is required > > From: Alexandre Oliva > > The testcase for pr100106, compiled with optimization for 32-bit > powerpc -mcpu=604 with -mstrict-align expands the initialization of a > union from a float _Complex value into a load from an SCmode > constant pool entry, aligned to 4 bytes, into a DImode pseudo, > requiring 8-byte alignment. > > The patch that introduced the testcase modified simplify_subreg to > avoid changing the MEM to outermode, but simplify_gen_subreg still > creates a SUBREG or a MEM that would require stricter alignment than > MEM's, and lra_constraints appears to get confused by that, repeatedly > creating unsatisfiable reloads for the SUBREG until it exceeds the > insn count. > > Avoiding the unaligned SUBREG, expand splits the DImode dest into > SUBREGs and loads each SImode word of the constant pool with the > proper alignment. > > > for gcc/ChangeLog > > PR target/100106 > * emit-rtl.cc (validate_subreg): Reject a SUBREG of a MEM that > requires stricter alignment than MEM's. > > for gcc/testsuite/ChangeLog > > PR target/100106 > * gcc.target/powerpc/pr100106-sa.c: New. OK. jeff