From patchwork Tue Oct 24 09:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1854267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SF6xT47YNz23jV for ; Tue, 24 Oct 2023 21:00:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E94D3858C2B for ; Tue, 24 Oct 2023 10:00:11 +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 C3B533858C50 for ; Tue, 24 Oct 2023 09:59:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3B533858C50 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 C3B533858C50 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=1698141594; cv=none; b=QU0pjhCczXUiUTIYQu+p3L71kkC4L27bY2hDWH7cZrT2e8kQFnNsgj7yREAVmbjPV1spZqoLoEFQCrqKIKWiMp32w+o5EzZx+kbSjsN4im0tV2ZhTQlrL0dOojYBAXZGCRGkKOwRRLzhy51cFf6Ie4XphavVnGyyqKxHVtwVDkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698141594; c=relaxed/simple; bh=qlg3ZvU5zbl2/n+sHls83yoGnCIJfM7oN1DqkNT/Cg0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=TdeA2ccdNDbCM6lbntwd06KJV+ikUPsvm0yEIsiOWzSxFG08KzdANVuumlqOYJpN8EJg/BAUM0+IuCf1aLT3r7H0i1/m+P0p0CWC6/CMSi2sk0x0vHX0H5CT1Z1a/5tSXPAJ8xVZoUDDEUEYlETCzVH8dQyXrBrzVA0fYyExSmg= 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 20C0C2F4 for ; Tue, 24 Oct 2023 03:00:33 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF54F3F64C for ; Tue, 24 Oct 2023 02:59:51 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] aarch64: Avoid bogus atomics match Date: Tue, 24 Oct 2023 10:59:23 +0100 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.8 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 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+incoming=patchwork.ozlabs.org@gcc.gnu.org The non-LSE pattern aarch64_atomic_exchange comes before the LSE pattern aarch64_atomic_exchange_lse. From a recog perspective, the only difference between the patterns is that the non-LSE one clobbers CC and needs a scratch. However, combine and RTL-SSA can both add clobbers to make a pattern match. This means that if they try to rerecognise an LSE pattern, they could end up turning it into a non-LSE pattern. This patch adds a !TARGET_LSE test to avoid that. This is needed to avoid a regression with later patches. Tested on aarch64-linux-gnu & pushed. Richard gcc/ * config/aarch64/atomics.md (aarch64_atomic_exchange): Require !TARGET_LSE. --- gcc/config/aarch64/atomics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md index 2b6f04efa6c..055a87320ca 100644 --- a/gcc/config/aarch64/atomics.md +++ b/gcc/config/aarch64/atomics.md @@ -224,7 +224,7 @@ (define_insn_and_split "aarch64_atomic_exchange" UNSPECV_ATOMIC_EXCHG)) (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:SI 4 "=&r"))] - "" + "!TARGET_LSE" "#" "&& epilogue_completed" [(const_int 0)]