From patchwork Sun Nov 5 18:33:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 161753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2256511vqu; Sun, 5 Nov 2023 10:33:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwvmMHXiEhqUCpGZN+Wg2Ks32kwDfILgig/JUaesl7GPww0/3Y977su2LCOv7w0xb85G/N X-Received: by 2002:a1f:9cd8:0:b0:48f:8533:3cda with SMTP id f207-20020a1f9cd8000000b0048f85333cdamr22397934vke.11.1699209216758; Sun, 05 Nov 2023 10:33:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699209216; cv=pass; d=google.com; s=arc-20160816; b=UrxztbkGGmLL+bnAOD0ZWbmQvYzYj+aF0UPh/fTF4mk/7t0o0ft8z1phhnHoZ/EcbT SVuUohVxlg+ngkfnvKaGEjfrAHNhgL1Ivpay9VLa4YkvGW/zLdYpxqeY+r5ED/qEfXQH ofAX/iQB8TbzOe45kcrx5ZjhX13FTMb6Y/P3G1sv6z884KWAgLd3rV/ubnIw26nzdN87 66+o6SipkkS5OUUWWmxR8tYVxUYXmi9YM+Wq3Hua44I0QMbLqBly4jgbynQtcGol6mfD /eJb98yAePPbbE8MqMeMPTm/5huYgULgkTXRAA6xK/4RYPaZ2/CUacMOIVX6l4lnjvGR GaFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:subject:mail-followup-to:to:from:arc-filter :dmarc-filter:delivered-to; bh=D/4Dpc6JSKtfEvpYF7w8XTWvG3zobeeu4CebBam50ss=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=YKTqiKamXj04z/NUP4Zf8PtNE8w3k5PWPGUNR4fGecAObqobnLDVkTMbX3FTavZrC4 HiMyaZRS/VleLadTodpBj/vYcanBKs4eLiWl1dfrnZqEI0D95X95sc1WuRkPOMoUcxFF x/mL3eJGrleoW9poL6Px0mNJiiQgJZxkkbop7QksQunraXYnv9gqQCrNz0EOmvKrcKVf wFjAKNsjs8PNjquY5fO16AuHAJLDPY352aWeDYSFRt62fMNKSY+qF+Kdq0lksfUGd8Ki Qaj3LEHi3HFWs+kZAZ3fLlIsGsIJyndt0n6QNITHYxPE62mkRUR6dsMetCKvDolpbFoX mavQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g6-20020a05620a278600b0077091864d1esi4610044qkp.687.2023.11.05.10.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 10:33:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86D9C385701B for ; Sun, 5 Nov 2023 18:33:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 76F433858CDB for ; Sun, 5 Nov 2023 18:33:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76F433858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76F433858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699209195; cv=none; b=Y9aESErVNzNqZRs34XUICTS+bPs4tiPQIX/g5LFyzWQPH/7opas00YaV2wntQde2IlfZiNxBqTu8oBx3hLk7DeLvbD2QNt9O//xCbOO4IiFNC/9X1EJrIh3qZEVmO0Ggt2SfGZmWjnywq21SwxGu4V20Hekyq72gQrhoVSLFL5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699209195; c=relaxed/simple; bh=v/LzsEy6KgKsoz5VRewbLgylTqNWjXUkbyYQzIAxwwQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=jRfqMoUkjXAHLX3QUzICbigqiuFJpAXclBRl1upiYK+8v1ZyJrITFcoot3OGzaapjhFmjj+xhzGM5OO/mx3T4jZn393Dwq1avOFmpwIWpy+/mRp3c/aXM39zTQ3fjKCRWcSpEQMroSnUfCGDP5vOeSVOcHRAtpkVXa2GIlO5M1U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D092C15 for ; Sun, 5 Nov 2023 10:33:58 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DA34E3F703 for ; Sun, 5 Nov 2023 10:33:13 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] explow: Avoid unnecessary alignment operations Date: Sun, 05 Nov 2023 18:33:12 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-23.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781750003879186693 X-GMAIL-MSGID: 1781750003879186693 align_dynamic_address would output alignment operations even for a required alignment of 1 byte. Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install? Richard gcc/ * explow.cc (align_dynamic_address): Do nothing if the required alignment is a byte. --- gcc/explow.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/explow.cc b/gcc/explow.cc index aa64d5e906c..0be6d2629c9 100644 --- a/gcc/explow.cc +++ b/gcc/explow.cc @@ -1201,6 +1201,9 @@ record_new_stack_level (void) rtx align_dynamic_address (rtx target, unsigned required_align) { + if (required_align == BITS_PER_UNIT) + return target; + /* CEIL_DIV_EXPR needs to worry about the addition overflowing, but we know it can't. So add ourselves and then do TRUNC_DIV_EXPR. */