From patchwork Thu Jun 13 07:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 92039 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B5A7F3882AF5 for ; Thu, 13 Jun 2024 07:37:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 19ABA388217C for ; Thu, 13 Jun 2024 07:37:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 19ABA388217C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 19ABA388217C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718264221; cv=none; b=HKG7Uvzmr4mgy/i+xa2ELCAlCWPpgynFfr89h3aoWem1Q1jjwX0PUKNoYI0p8vGrJQzHvOA4nigtQyzeK106hXtiIbwoLYWzxinRbfvUhb1LXIV7BWSv7c52fIz3T+2Gy51e8H9J3rIr7lrvUuEZ7XAVZrvQ4y3ZcqAlr3OGJMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718264221; c=relaxed/simple; bh=vfiuwfhUfXwxM9TT3bkLDCcY5aN0P7vJGzS7gH97uxI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=F/oj8sBVHULhl+eu2pxNZnoXCl/nWUUxOl551JjsFwfZ59W/+rYk0J0faGJyk8ph5ssHSmhSm+2lnfodXuQu53ww9hNAUlsF+0AJw5pvI84ftZ6hBwdOsbum+oQdGjr/GUlDSURkcN6PQtg4fjeb3iSAhV1X8nn9T1JatIAwins= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2c315b569c8so551105a91.0 for ; Thu, 13 Jun 2024 00:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718264218; x=1718869018; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:organization :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=HkPzmIthdfYqK+NZJ91VvfQjNed1KBWdy2i9g9pJsRc=; b=efpiU1zP8BlS1ITlZzLDtcYTdpmFQpnqbHE/q8Zvkjnto8cctKuga5bIUIMi4c09Al MY7iMx6Q3rL5RnKouaRpsIIr/eW3PtasSdxKFwpIGoi6Ik/X2dfPuHDg6hld7Ij6cDcQ NGpzr35QYzB38zSdDCAcygq+NMs74tah2SRaahImC6rQ5FyNrejf+0VS5KBOnhwBXzBY ObSLefA4GEw5W9cB34i3PnSTFdNibQVZ+VbvZOdFNH0s0xVvNurReGsy1PDvOnGjCCma PdvY1bddLSnkU7Zts4AwQwtVuknE3NA4hIiVpVYp2f1eMudzsiJl6g8scSW4O8NF8p2M qpvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718264218; x=1718869018; h=mime-version:message-id:date:user-agent:references:organization :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HkPzmIthdfYqK+NZJ91VvfQjNed1KBWdy2i9g9pJsRc=; b=Fu5JMqSUx6LwZ1VIGhuIbZw8lDp2gCVOBCM0RdOK0jkKxGqfZm8/IOtBhphJyeSe+9 Y2rjEs1EuvQJ2swsx3KSmYhdSlEy7h7ggr9xAZKRrwHuk1gu8ftr5MH8Lc7icaRDAZ2n KbdBDOi6BEFE7yjZWCEz4Y+bAsbq6SIBphjSioMo5Z/VK9f2KSdXfMjRrrFUkouq9Tqm FpOOzDwgZf/fnlP6g3dQ6X4bxXmCs9XlMm3qku9Z97Qmb3Z7XuQ/YQ5oN7U3j/NBz7rE zQGVU6WiDytRaRycE6ooHHXQO8DIR7Wt2bNM8VGBTp7q9qDDZGTFykFWKSalMN5CR546 vnwg== X-Forwarded-Encrypted: i=1; AJvYcCWQwEPcY+ujELOJFVL3ZnnWBT+g8BMnNuY6Wng0QqpOXrjEiyDAMlsxHTXh4D4cWZ6ai/EugKHqBPva8Bh275EjBT4qPLXKJA== X-Gm-Message-State: AOJu0YzJ2U2HIiZD4UBupqL81ik3xioseHS734PrDqG7ZbrauQCopl+2 7Q92BBduPtFdu5r0+9VIY59GGKVItrVXldi1U3H1yZTAZ002/CjyHNDMeCFs6g== X-Google-Smtp-Source: AGHT+IEPTR6RTKf9d3hy3ahJaEQj+UcahOoV+WVyqOTyvS/xR6bd3OIDSYsPcMkjy0TtUfiGijjSSw== X-Received: by 2002:a17:90b:2316:b0:2c2:db07:f814 with SMTP id 98e67ed59e1d1-2c4a764bb7fmr4261373a91.26.1718264217925; Thu, 13 Jun 2024 00:36:57 -0700 (PDT) Received: from free.home ([2804:7f1:218b:1961:ef8:d680:5399:8b1a]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4a7504541sm3213947a91.0.2024.06.13.00.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 00:36:57 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 45D7aiSo1173742 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 04:36:44 -0300 From: Alexandre Oliva To: "Maciej W. Rozycki" Cc: Richard Henderson , gcc-patches@gcc.gnu.org Subject: [PATCH] [alpha] adjust MEM alignment for block move [PR115459] (was: Re: [PATCH v2] [PR100106] Reject unaligned subregs when strict alignment is required) In-Reply-To: (Maciej W. Rozycki's message of "Wed, 12 Jun 2024 13:39:52 +0100 (BST)") Organization: Free thinker, does not speak for AdaCore References: <20220505143308.GC25951@gate.crashing.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Date: Thu, 13 Jun 2024 04:36:44 -0300 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK, WEIRD_QUOTING 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Hello, Maciej, On Jun 12, 2024, "Maciej W. Rozycki" wrote: > This has regressed building the `alpha-linux-gnu' target, in libada, as > from commit d6b756447cd5 including GCC 14 and up to current GCC 15 trunk: > | Error detected around g-debpoo.adb:1896:8 | > I have filed PR #115459. Thanks! This was tricky to duplicate without access to an alpha-linux-gnu machine. I ended up building an uberbaum tree with --disable-shared --disable-threads --enable-languages=ada up to all-target-libgcc, then I replaced gcc/collect2 with a wrapper script that dropped crt[1in].o and -lc, so that link tests in libada/configure would succeed without glibc for the target. libada still wouldn't build, because of the missing glibc headers, but I could compile g-depboo.adb with -I pointing at a x86_64-linux-gnu's gcc/ada/rts build tree, and with that, at -O2, I could trigger the problem and investigate it. And with the following patch, the problem seems to be gone. Maciej, would you be so kind as to give it a spin with a native regstrap? TIA, Richard, is this ok to install if regstrapping succeeds? Before issuing loads or stores for a block move, adjust the MEM alignments if analysis of the addresses enabled the inference of stricter alignment. This ensures that the MEMs are sufficiently aligned for the corresponding insns, which avoids trouble in case of e.g. substitutions into SUBREGs. for gcc/ChangeLog PR target/115459 * config/alpha/alpha.cc (alpha_expand_block_move): Adjust MEMs to match inferred alignment. --- gcc/config/alpha/alpha.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc index 1126cea1f7ba2..e090e74b9d073 100644 --- a/gcc/config/alpha/alpha.cc +++ b/gcc/config/alpha/alpha.cc @@ -3820,6 +3820,12 @@ alpha_expand_block_move (rtx operands[]) else if (a >= 16 && c % 2 == 0) src_align = 16; } + + if (MEM_P (orig_src) && MEM_ALIGN (orig_src) < src_align) + { + orig_src = shallow_copy_rtx (orig_src); + set_mem_align (orig_src, src_align); + } } tmp = XEXP (orig_dst, 0); @@ -3841,6 +3847,12 @@ alpha_expand_block_move (rtx operands[]) else if (a >= 16 && c % 2 == 0) dst_align = 16; } + + if (MEM_P (orig_dst) && MEM_ALIGN (orig_dst) < dst_align) + { + orig_dst = shallow_copy_rtx (orig_dst); + set_mem_align (orig_dst, dst_align); + } } ofs = 0;