From patchwork Tue Dec 5 10:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 173899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3329069vqy; Tue, 5 Dec 2023 02:15:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK6mtIFsfv4m1yDzvhPaz+oWdqnMwLRSXxxjfswHqQFf0TBwQTHbg4+zvgvMh6nSTb9rD+ X-Received: by 2002:a05:6808:1204:b0:3b8:b063:5d79 with SMTP id a4-20020a056808120400b003b8b0635d79mr6556006oil.96.1701771303327; Tue, 05 Dec 2023 02:15:03 -0800 (PST) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x23-20020ac86b57000000b004237835f615si10812926qts.749.2023.12.05.02.15.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:15:03 -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=fail (signature failed); 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 C8728386185C for ; Tue, 5 Dec 2023 10:14:48 +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 F12CE385E00F for ; Tue, 5 Dec 2023 10:13:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F12CE385E00F 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 F12CE385E00F 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=1701771222; cv=none; b=FlFhFvZ3ye78UMSYAGmbsq2uv6Mpp2VjAxJ97vY8vCaQ5SJiih4AcBp6vGBsbn4o47o4jKHaahJ3jUe17P1Wb8cIECiS/0KTnJ6WDGJJKUZrrW48kHTJbmcghMqZj51+n4/90yma87SEdD7XH7A8gqqa7q7+0h5AXUgwBAfU9nw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701771222; c=relaxed/simple; bh=i/8CrIMnOcZyejfIjiLZ31yUehq78800JJRlP+Ys4To=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=RYE9BmPdULvFmSb8LupMHNSCCrLTnTunQf766iTsVqSFF5lEhn8NJbXCPq0CJrX2IcuKas0tu65DsL4TLywYJb3leEUXw/r+5V2V/q9lFKFVC41ty8PenoK6xrGH4DC1AOXgPq6e21SWbV/wI2ggzmZXmo4vAlYuMwN6uxmySkY= 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 658D5FEC; Tue, 5 Dec 2023 02:14:26 -0800 (PST) Received: from e121540-lin.manchester.arm.com (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 574A83F5A1; Tue, 5 Dec 2023 02:13:39 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [pushed v2 09/25] aarch64: Tweak error message for (tuple, vector) pairs Date: Tue, 5 Dec 2023 10:13:07 +0000 Message-Id: <20231205101323.1914247-10-richard.sandiford@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231205101323.1914247-1-richard.sandiford@arm.com> References: <20231205101323.1914247-1-richard.sandiford@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-22.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, 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: 1784436545805744032 X-GMAIL-MSGID: 1784436545805744032 SME2 adds more intrinsics that take a tuple of vectors followed by a single vector, with the two arguments expected to have the same element type. Unlike with the existing svset* intrinsics, the size of the tuple is not fixed by the overloaded function name. This patch adds an error message that (hopefully) copes better with that combination. gcc/ * config/aarch64/aarch64-sve-builtins.cc (function_resolver::require_derived_vector_type): Add a specific error message for the case in which the caller wants a single vector whose element type matches a previous tuyple argument. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/set_1.c: Tweak expected error message. * gcc.target/aarch64/sve/acle/general-c/set_3.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/set_5.c: Likewise. --- gcc/config/aarch64/aarch64-sve-builtins.cc | 13 +++++++++++++ .../gcc.target/aarch64/sve/acle/general-c/set_1.c | 4 ++-- .../gcc.target/aarch64/sve/acle/general-c/set_3.c | 4 ++-- .../gcc.target/aarch64/sve/acle/general-c/set_5.c | 4 ++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index cdae77272ab..55bd2662d1a 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -1707,6 +1707,19 @@ require_derived_vector_type (unsigned int argno, if (!actual_type) return false; + if (orig_expected_tclass == SAME_TYPE_CLASS + && orig_expected_bits == SAME_SIZE) + { + if (actual_type.type == first_type.type) + return true; + + error_at (location, "passing %qT to argument %d of %qE, but" + " argument %d was a tuple of %qT", + get_vector_type (actual_type), argno + 1, fndecl, + first_argno + 1, get_vector_type (first_type.type)); + return false; + } + /* Exit now if we got the right type. */ auto &actual_type_suffix = type_suffixes[actual_type.type]; bool tclass_ok_p = (actual_type_suffix.tclass == expected_tclass); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_1.c index f07c76102ca..f2a6da5360f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_1.c @@ -16,8 +16,8 @@ f1 (svbool_t pg, svuint8_t u8, svuint8x2_t u8x2, svuint8x3_t u8x3, int x) u8x2 = svset2 (u8x3, 0, u8); /* { dg-error {passing 'svuint8x3_t' to argument 1 of 'svset2', which expects a tuple of 2 vectors} } */ u8x2 = svset2 (pg, 0, u8); /* { dg-error {passing 'svbool_t' to argument 1 of 'svset2', which expects a tuple of 2 vectors} } */ u8x2 = svset2 (u8x2, 0, u8x2); /* { dg-error {passing 'svuint8x2_t' to argument 3 of 'svset2', which expects a single SVE vector rather than a tuple} } */ - u8x2 = svset2 (u8x2, 0, f64); /* { dg-error {passing 'svfloat64_t' instead of the expected 'svuint8_t' to argument 3 of 'svset2', after passing 'svuint8x2_t' to argument 1} } */ - u8x2 = svset2 (u8x2, 0, pg); /* { dg-error {passing 'svbool_t' instead of the expected 'svuint8_t' to argument 3 of 'svset2', after passing 'svuint8x2_t' to argument 1} } */ + u8x2 = svset2 (u8x2, 0, f64); /* { dg-error {passing 'svfloat64_t' to argument 3 of 'svset2', but argument 1 was a tuple of 'svuint8_t'} } */ + u8x2 = svset2 (u8x2, 0, pg); /* { dg-error {passing 'svbool_t' to argument 3 of 'svset2', but argument 1 was a tuple of 'svuint8_t'} } */ u8x2 = svset2 (u8x2, x, u8); /* { dg-error {argument 2 of 'svset2' must be an integer constant expression} } */ u8x2 = svset2 (u8x2, 0, u8); f64 = svset2 (u8x2, 0, u8); /* { dg-error {incompatible types when assigning to type 'svfloat64_t' from type 'svuint8x2_t'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_3.c index 543a1bea8f3..92b955f8355 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_3.c @@ -17,8 +17,8 @@ f1 (svbool_t pg, svfloat16_t f16, svfloat16x3_t f16x3, svfloat16x4_t f16x4, f16x3 = svset3 (f16x4, 0, f16); /* { dg-error {passing 'svfloat16x4_t' to argument 1 of 'svset3', which expects a tuple of 3 vectors} } */ f16x3 = svset3 (pg, 0, f16); /* { dg-error {passing 'svbool_t' to argument 1 of 'svset3', which expects a tuple of 3 vectors} } */ f16x3 = svset3 (f16x3, 0, f16x3); /* { dg-error {passing 'svfloat16x3_t' to argument 3 of 'svset3', which expects a single SVE vector rather than a tuple} } */ - f16x3 = svset3 (f16x3, 0, f64); /* { dg-error {passing 'svfloat64_t' instead of the expected 'svfloat16_t' to argument 3 of 'svset3', after passing 'svfloat16x3_t' to argument 1} } */ - f16x3 = svset3 (f16x3, 0, pg); /* { dg-error {passing 'svbool_t' instead of the expected 'svfloat16_t' to argument 3 of 'svset3', after passing 'svfloat16x3_t' to argument 1} } */ + f16x3 = svset3 (f16x3, 0, f64); /* { dg-error {passing 'svfloat64_t' to argument 3 of 'svset3', but argument 1 was a tuple of 'svfloat16_t'} } */ + f16x3 = svset3 (f16x3, 0, pg); /* { dg-error {passing 'svbool_t' to argument 3 of 'svset3', but argument 1 was a tuple of 'svfloat16_t'} } */ f16x3 = svset3 (f16x3, x, f16); /* { dg-error {argument 2 of 'svset3' must be an integer constant expression} } */ f16x3 = svset3 (f16x3, 0, f16); f64 = svset3 (f16x3, 0, f16); /* { dg-error {incompatible types when assigning to type 'svfloat64_t' from type 'svfloat16x3_t'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_5.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_5.c index be911a73176..f0696fb07c7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_5.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/set_5.c @@ -16,8 +16,8 @@ f1 (svbool_t pg, svint32_t s32, svint32x4_t s32x4, svint32x2_t s32x2, int x) s32x4 = svset4 (s32x2, 0, s32); /* { dg-error {passing 'svint32x2_t' to argument 1 of 'svset4', which expects a tuple of 4 vectors} } */ s32x4 = svset4 (pg, 0, s32); /* { dg-error {passing 'svbool_t' to argument 1 of 'svset4', which expects a tuple of 4 vectors} } */ s32x4 = svset4 (s32x4, 0, s32x4); /* { dg-error {passing 'svint32x4_t' to argument 3 of 'svset4', which expects a single SVE vector rather than a tuple} } */ - s32x4 = svset4 (s32x4, 0, f64); /* { dg-error {passing 'svfloat64_t' instead of the expected 'svint32_t' to argument 3 of 'svset4', after passing 'svint32x4_t' to argument 1} } */ - s32x4 = svset4 (s32x4, 0, pg); /* { dg-error {passing 'svbool_t' instead of the expected 'svint32_t' to argument 3 of 'svset4', after passing 'svint32x4_t' to argument 1} } */ + s32x4 = svset4 (s32x4, 0, f64); /* { dg-error {passing 'svfloat64_t' to argument 3 of 'svset4', but argument 1 was a tuple of 'svint32_t'} } */ + s32x4 = svset4 (s32x4, 0, pg); /* { dg-error {passing 'svbool_t' to argument 3 of 'svset4', but argument 1 was a tuple of 'svint32_t'} } */ s32x4 = svset4 (s32x4, x, s32); /* { dg-error {argument 2 of 'svset4' must be an integer constant expression} } */ s32x4 = svset4 (s32x4, 0, s32); f64 = svset4 (s32x4, 0, s32); /* { dg-error {incompatible types when assigning to type 'svfloat64_t' from type 'svint32x4_t'} } */