From patchwork Thu Oct 20 09:40:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1692321 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uAmnFRR4; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MtN1K6nGlz23jk for ; Thu, 20 Oct 2022 20:42:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B564D382EA23 for ; Thu, 20 Oct 2022 09:42:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B564D382EA23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666258947; bh=5ZlnzJoV7isC93AqDZ0Tz9XIL4r8j7ay+AJniVEAVKM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uAmnFRR4N94qLjLrbBdCZRU77gOwHKPIyWWhOo9Y+WL7adr3LWuu9+OGxnyxBFfjt 3kss3EkIVv8XHXRB1fIoEGUyUPZD/LTs2zK5CGzEOX8EqHdQE8qhB4e8UyFtmleXi6 hwhTH+UYEFN1N8mhD2ZB0ERgFCAdGfPnp9n9ENJE= 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 1F55D383AF49 for ; Thu, 20 Oct 2022 09:40:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F55D383AF49 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 D73DFED1 for ; Thu, 20 Oct 2022 02:40:58 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 479693F792 for ; Thu, 20 Oct 2022 02:40:52 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [pushed] aarch64: Prevent generation of /M BRKAS and BRKBS Date: Thu, 20 Oct 2022 10:40:51 +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=-43.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Bit of a brown-paper-bag bug, but: GCC was generating non-existent merging forms of BRKAS and BRKBS. Those instructions only support zero predication (although BRKA and BRKB support both). Tested on aarch64-linux-gnu & pushed to trunk so far. I'll backport to release branches soon. Richard gcc/ * config/aarch64/aarch64-sve.md (*aarch64_brk_cc): Remove merging alternative. (*aarch64_brk_ptest): Likewise. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/brka_1.c: Expect a separate PTEST instruction. * gcc.target/aarch64/sve/acle/general/brkb_1.c: Likewise. --- gcc/config/aarch64/aarch64-sve.md | 24 ++++++++----------- .../aarch64/sve/acle/general/brka_1.c | 5 ++-- .../aarch64/sve/acle/general/brkb_1.c | 5 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index e2bb80268e5..b8cc47ef5fc 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -9612,45 +9612,41 @@ (define_insn "@aarch64_brk" (define_insn "*aarch64_brk_cc" [(set (reg:CC_NZC CC_REGNUM) (unspec:CC_NZC - [(match_operand:VNx16BI 1 "register_operand" "Upa, Upa") + [(match_operand:VNx16BI 1 "register_operand" "Upa") (match_dup 1) (match_operand:SI 4 "aarch64_sve_ptrue_flag") (unspec:VNx16BI [(match_dup 1) - (match_operand:VNx16BI 2 "register_operand" "Upa, Upa") - (match_operand:VNx16BI 3 "aarch64_simd_reg_or_zero" "Dz, 0")] + (match_operand:VNx16BI 2 "register_operand" "Upa") + (match_operand:VNx16BI 3 "aarch64_simd_imm_zero")] SVE_BRK_UNARY)] UNSPEC_PTEST)) - (set (match_operand:VNx16BI 0 "register_operand" "=Upa, Upa") + (set (match_operand:VNx16BI 0 "register_operand" "=Upa") (unspec:VNx16BI [(match_dup 1) (match_dup 2) (match_dup 3)] SVE_BRK_UNARY))] "TARGET_SVE" - "@ - brks\t%0.b, %1/z, %2.b - brks\t%0.b, %1/m, %2.b" + "brks\t%0.b, %1/z, %2.b" ) ;; Same, but with only the flags result being interesting. (define_insn "*aarch64_brk_ptest" [(set (reg:CC_NZC CC_REGNUM) (unspec:CC_NZC - [(match_operand:VNx16BI 1 "register_operand" "Upa, Upa") + [(match_operand:VNx16BI 1 "register_operand" "Upa") (match_dup 1) (match_operand:SI 4 "aarch64_sve_ptrue_flag") (unspec:VNx16BI [(match_dup 1) - (match_operand:VNx16BI 2 "register_operand" "Upa, Upa") - (match_operand:VNx16BI 3 "aarch64_simd_reg_or_zero" "Dz, 0")] + (match_operand:VNx16BI 2 "register_operand" "Upa") + (match_operand:VNx16BI 3 "aarch64_simd_imm_zero")] SVE_BRK_UNARY)] UNSPEC_PTEST)) - (clobber (match_scratch:VNx16BI 0 "=Upa, Upa"))] + (clobber (match_scratch:VNx16BI 0 "=Upa"))] "TARGET_SVE" - "@ - brks\t%0.b, %1/z, %2.b - brks\t%0.b, %1/m, %2.b" + "brks\t%0.b, %1/z, %2.b" ) ;; ------------------------------------------------------------------------- diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brka_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brka_1.c index 24aa8f317c4..6146ef82849 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brka_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brka_1.c @@ -18,5 +18,6 @@ test2 (svbool_t pg, svbool_t x, svbool_t y, int *any) return svptest_any (pg, res); } -/* { dg-final { scan-assembler-times {\tbrkas\tp[0-9]+\.b, p[0-9]+/m,} 2 } } */ -/* { dg-final { scan-assembler-not {\tbrka\t} } } */ +/* { dg-final { scan-assembler-times {\tbrka\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tptest\t} 2 } } */ +/* { dg-final { scan-assembler-not {\tbrkas\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brkb_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brkb_1.c index 07e3622ed6a..7f1c75837de 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brkb_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/brkb_1.c @@ -18,5 +18,6 @@ test2 (svbool_t pg, svbool_t x, svbool_t y, int *any) return svptest_any (pg, res); } -/* { dg-final { scan-assembler-times {\tbrkbs\tp[0-9]+\.b, p[0-9]+/m,} 2 } } */ -/* { dg-final { scan-assembler-not {\tbrkb\t} } } */ +/* { dg-final { scan-assembler-times {\tbrkb\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tptest\t} 2 } } */ +/* { dg-final { scan-assembler-not {\tbrkbs\t} } } */