From patchwork Fri Jan 12 12:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 187719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp139147dyc; Fri, 12 Jan 2024 04:32:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGL0oTYbe29Y35q8eTfk8LhDtSX/ILWBqo25mdee+55gSNoKCSdDrKKVJk7i3ZCaztbq+xp X-Received: by 2002:ac8:7d54:0:b0:429:cecc:b2e8 with SMTP id h20-20020ac87d54000000b00429ceccb2e8mr953967qtb.52.1705062729002; Fri, 12 Jan 2024 04:32:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705062728; cv=pass; d=google.com; s=arc-20160816; b=I/ecNUfhfarpZizaIGRV6Zx+dZ79N6vGDBf00sCx15BnxVe23tXA9kvZzqX1gJtlf9 D5aTjsLvfAy+LMOIDa/cDY0nb2qbyUgCXIicEx/dA74PL0goPb3AGI6HJGNakMLG4TJX 72zQYQfYhisyA1pKV8ivoXH9mACEJ2s5WZxo7Js72bQVRyTktXVt7RlQ2U9am+Tbhm+J 03WdSKJXeOoWy45kIuRiT19Q7bdRgkOZw1d8080lHCu5plNAemr9OO5cgsNJB95LrQ55 9cgZjYg/sRk6cHHh/7eY6euznIqmTQ8AvWVEDSzV2ePDYKMXnr/ZACVfBxmcBuA9W7D4 1wZw== 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=1hrMstbDfgSdKbGSfPnl1PYUb260ld+WeT7NviQ0FoI=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=cTU1fpp/npKyokyW+B6/5JZ//iiTXUmrCNh1vwC7F0biHhWKrLRhSg//wPPIElJ0l+ 3f0x2b0h6wRsQQx26Eu0/Z+4AoF2VKH656L7tyNLpskCfYChs7jXsOcTsQ9g8iLEptbu XdzFYhXDQ0hxVEbnTJSw7x4dNWK7RekGk2oMjQ5PmRHHLrdvLuSa6VzvwFS7ewLgRdzP 1n4RyPuDes4EOYgrqJp8iSGiA1UIJf2P0yad69YQCwO3x9TbkcHkhgMzlSFninKPUPzj 1bAY4ojKaGbubnzRKyBIKpJ8t5PxkchMOmuHCFvgOsdSoOnOGKPbS5Uch7O6UztztBFs dreQ== 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 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b16-20020a05622a021000b00429d3444ca3si249447qtx.285.2024.01.12.04.32.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:32:08 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; 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 2620:52:3:1:0:246e:9693:128c 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 B0D0B3858416 for ; Fri, 12 Jan 2024 12:32:08 +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 33AC43858D1E for ; Fri, 12 Jan 2024 12:31:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33AC43858D1E 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 33AC43858D1E 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=1705062674; cv=none; b=ZF90+KAKIpxkO2fQfUoUzLyia+JHHKNxzUuhBflAM5K4WoO2hxL5sd3J/R668y0JankB2j/IKeG3hydVEkodvwhncS/8fTI5Q9tYswdOeA4LJOIW7VJow03WP5L2A641Lb+in7QiYvFqE3zIfO+yWTlW9a5f9FTwTTgORPufCi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705062674; c=relaxed/simple; bh=jzVi5CVTqp0oWJtjW95mOFCJOkKBVrOTCKV8NaKobBI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=t3ns3S2oepDkfxZdQ4TXFcyjFOpVDE/IWojtNb70mCTnegcwsE2y7SwPKulpMXQYYWeYLsgedO8SntCHmj0qTsYkmspj69eGXOiRefhVdCBrhbNV6v/kVNJ1UFuUTVfQhzchoDOOMH8QOTkk888NQ/fiQPfc1uVXBNnzCD2kv1s= 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 2C3D81FB for ; Fri, 12 Jan 2024 04:31:57 -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 868623F73F for ; Fri, 12 Jan 2024 04:31:10 -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 1/2] aarch64: Use a separate group for SME builtins [PR112989] Date: Fri, 12 Jan 2024 12:31:09 +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=-21.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: 1787887855905999490 X-GMAIL-MSGID: 1787887855905999490 The PR shows that we were registering the same overloaded SVE builtins twice. This was supposed to be prevented by function_builder::add_overloaded_function, which uses a map to detect whether a function of the same name has already been registered. add_overloaded_function then had some asserts to check for consistency. However, the map that add_overloaded_function uses was a member of function_builder itself. That made sense when there was just one header file, arm_sve.h, since it meant that the memory could be reclaimed once arm_sve.h had been processed. But now we have three header files, and in principle, it's possible for arm_sme.h to include overloads of things that arm_sve.h also defines. We therefore need to use a global map instead. However, doing that meant that the consistency checks in add_overloaded_function fired as expected, which showed some latent issues. This preliminary patch deals with those by adding AARCH64_FL_SME to things that require AARCH64_FL_SME2. This inconsistency led to another problem: functions were selected for arm_sme.h over arm_sve.h based on whether they had AARCH64_FL_SME. So some SME2-only things were actually defined in arm_sve.h, whereas similar SME things were defined in arm_sme.h. Choosing based on flags was an early get-started crutch that I forgot to clean up later :( This patch goes for the more direct approach of having a separate table of SME builtins, as for arm_neon_sve_bridge.h. aarch64-sve-builtins-sve2.def contains several intrinsics that are currently SME-only but that operate entirely on vector registers. Many of these will be extended to SVE2.1 once SVE2.1 support is added, so the patch front-loads that by keeping the current division between aarch64-sve-builtins-sve2.def (whose functions now go in arm_sve.h) and aarch64-sve-builtins-sme.def (whose functions now go in arm_sme.h). Tested on aarch64-linux-gnu & pushed. Sorry for the breakage and for the long fix time. Richard gcc/ PR target/112989 * config/aarch64/aarch64-sve-builtins.def: Don't include aarch64-sve-builtins-sme.def. (DEF_SME_ZA_FUNCTION_GS, DEF_SME_ZA_FUNCTION): Move to... * config/aarch64/aarch64-sve-builtins-sme.def: ...here. (DEF_SME_FUNCTION): New macro. Use it and DEF_SME_FUNCTION_GS instead of DEF_SVE_*. Add AARCH64_FL_SME to anything that requires AARCH64_FL_SME2. * config/aarch64/aarch64-sve-builtins-sve2.def: Make same AARCH64_FL_SME adjustment here. * config/aarch64/aarch64-sve-builtins.cc (function_groups): Don't include SME intrinsics. (sme_function_groups): New array. (handle_arm_sve_h): Remove check for AARCH64_FL_SME. (handle_arm_sme_h): Use sme_function_groups instead of function_groups. gcc/testsuite/ PR target/112989 * gcc.target/aarch64/sve/acle/general-c/clamp_1.c: Remove bogus error test. --- .../aarch64/aarch64-sve-builtins-sme.def | 53 +++++++++++++------ .../aarch64/aarch64-sve-builtins-sve2.def | 1 + gcc/config/aarch64/aarch64-sve-builtins.cc | 26 +++++---- gcc/config/aarch64/aarch64-sve-builtins.def | 13 ----- .../aarch64/sve/acle/general-c/clamp_1.c | 2 +- 5 files changed, 55 insertions(+), 40 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sme.def b/gcc/config/aarch64/aarch64-sve-builtins-sme.def index 5109c5e5e7d..416df0b3637 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-sme.def +++ b/gcc/config/aarch64/aarch64-sve-builtins-sme.def @@ -17,16 +17,31 @@ along with GCC; see the file COPYING3. If not see . */ +#ifndef DEF_SME_FUNCTION +#define DEF_SME_FUNCTION(NAME, SHAPE, TYPES, PREDS) \ + DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS) +#endif + +#ifndef DEF_SME_ZA_FUNCTION_GS +#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUP, PREDS) \ + DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, GROUP, PREDS) +#endif + +#ifndef DEF_SME_ZA_FUNCTION +#define DEF_SME_ZA_FUNCTION(NAME, SHAPE, TYPES, PREDS) \ + DEF_SME_ZA_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS) +#endif + #define REQUIRED_EXTENSIONS 0 -DEF_SVE_FUNCTION (arm_has_sme, bool_inherent, none, none) -DEF_SVE_FUNCTION (arm_in_streaming_mode, bool_inherent, none, none) +DEF_SME_FUNCTION (arm_has_sme, bool_inherent, none, none) +DEF_SME_FUNCTION (arm_in_streaming_mode, bool_inherent, none, none) #undef REQUIRED_EXTENSIONS #define REQUIRED_EXTENSIONS AARCH64_FL_SME -DEF_SVE_FUNCTION (svcntsb, count_inherent, none, none) -DEF_SVE_FUNCTION (svcntsd, count_inherent, none, none) -DEF_SVE_FUNCTION (svcntsh, count_inherent, none, none) -DEF_SVE_FUNCTION (svcntsw, count_inherent, none, none) +DEF_SME_FUNCTION (svcntsb, count_inherent, none, none) +DEF_SME_FUNCTION (svcntsd, count_inherent, none, none) +DEF_SME_FUNCTION (svcntsh, count_inherent, none, none) +DEF_SME_FUNCTION (svcntsw, count_inherent, none, none) DEF_SME_ZA_FUNCTION (svldr, ldr_za, za, none) DEF_SME_ZA_FUNCTION (svstr, str_za, za, none) DEF_SME_ZA_FUNCTION (svundef, inherent_za, za, none) @@ -75,17 +90,17 @@ DEF_SME_ZA_FUNCTION (svmopa, binary_za_m, za_d_float, za_m) DEF_SME_ZA_FUNCTION (svmops, binary_za_m, za_d_float, za_m) #undef REQUIRED_EXTENSIONS -#define REQUIRED_EXTENSIONS AARCH64_FL_SME2 -DEF_SVE_FUNCTION (svldr_zt, ldr_zt, none, none) -DEF_SVE_FUNCTION (svstr_zt, str_zt, none, none) -DEF_SVE_FUNCTION (svzero_zt, inherent_zt, none, none) +#define REQUIRED_EXTENSIONS AARCH64_FL_SME | AARCH64_FL_SME2 +DEF_SME_FUNCTION (svldr_zt, ldr_zt, none, none) +DEF_SME_FUNCTION (svstr_zt, str_zt, none, none) +DEF_SME_FUNCTION (svzero_zt, inherent_zt, none, none) #undef REQUIRED_EXTENSIONS /* The d_za entries in this section just declare C _za64 overloads, which will then be resolved to either an integer function or a floating-point function. They are needed because the integer and floating-point functions have different architecture requirements. */ -#define REQUIRED_EXTENSIONS AARCH64_FL_SME2 | AARCH64_FL_SM_ON +#define REQUIRED_EXTENSIONS AARCH64_FL_SME | AARCH64_FL_SME2 | AARCH64_FL_SM_ON DEF_SME_ZA_FUNCTION_GS (svadd, unary_za_slice, za_s_data, vg1x24, none) DEF_SME_ZA_FUNCTION_GS (svadd, unary_za_slice, d_za, vg1x24, none) DEF_SME_ZA_FUNCTION_GS (svadd_write, binary_za_slice_opt_single, za_s_integer, @@ -100,9 +115,9 @@ DEF_SME_ZA_FUNCTION_GS (svdot_lane, dot_za_slice_lane, za_s_h_data, vg1x24, none) DEF_SME_ZA_FUNCTION_GS (svdot_lane, dot_za_slice_lane, za_s_b_integer, vg1x24, none) -DEF_SVE_FUNCTION_GS (svluti2_lane_zt, luti2_lane_zt, bhs_data, x124, none) -DEF_SVE_FUNCTION_GS (svluti4_lane_zt, luti4_lane_zt, bhs_data, x12, none) -DEF_SVE_FUNCTION_GS (svluti4_lane_zt, luti4_lane_zt, hs_data, x4, none) +DEF_SME_FUNCTION_GS (svluti2_lane_zt, luti2_lane_zt, bhs_data, x124, none) +DEF_SME_FUNCTION_GS (svluti4_lane_zt, luti4_lane_zt, bhs_data, x12, none) +DEF_SME_FUNCTION_GS (svluti4_lane_zt, luti4_lane_zt, hs_data, x4, none) DEF_SME_ZA_FUNCTION_GS (svmla, binary_za_slice_opt_single, za_s_float, vg1x24, none) DEF_SME_ZA_FUNCTION_GS (svmla, binary_za_slice_opt_single, za_s_h_data, @@ -157,7 +172,8 @@ DEF_SME_ZA_FUNCTION_GS (svwrite_hor, write_za, za_bhsd_data, vg24, none) DEF_SME_ZA_FUNCTION_GS (svwrite_ver, write_za, za_bhsd_data, vg24, none) #undef REQUIRED_EXTENSIONS -#define REQUIRED_EXTENSIONS (AARCH64_FL_SME2 \ +#define REQUIRED_EXTENSIONS (AARCH64_FL_SME \ + | AARCH64_FL_SME2 \ | AARCH64_FL_SME_I16I64 \ | AARCH64_FL_SM_ON) DEF_SME_ZA_FUNCTION_GS (svadd, unary_za_slice, za_d_integer, vg1x24, none) @@ -182,7 +198,8 @@ DEF_SME_ZA_FUNCTION_GS (svvdot_lane, dot_za_slice_lane, za_d_h_integer, vg1x4, none) #undef REQUIRED_EXTENSIONS -#define REQUIRED_EXTENSIONS (AARCH64_FL_SME2 \ +#define REQUIRED_EXTENSIONS (AARCH64_FL_SME \ + | AARCH64_FL_SME2 \ | AARCH64_FL_SME_F64F64 \ | AARCH64_FL_SM_ON) DEF_SME_ZA_FUNCTION_GS (svadd, unary_za_slice, za_d_float, vg1x24, none) @@ -196,3 +213,7 @@ DEF_SME_ZA_FUNCTION_GS (svmls_lane, binary_za_slice_lane, za_d_float, vg1x24, none) DEF_SME_ZA_FUNCTION_GS (svsub, unary_za_slice, za_d_float, vg1x24, none) #undef REQUIRED_EXTENSIONS + +#undef DEF_SME_ZA_FUNCTION +#undef DEF_SME_ZA_FUNCTION_GS +#undef DEF_SME_FUNCTION diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sve2.def b/gcc/config/aarch64/aarch64-sve-builtins-sve2.def index 89bb134cc3f..4366925a971 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-sve2.def +++ b/gcc/config/aarch64/aarch64-sve-builtins-sve2.def @@ -241,6 +241,7 @@ DEF_SVE_FUNCTION (svrevd, unary, all_data, mxz) #define REQUIRED_EXTENSIONS (AARCH64_FL_SVE \ | AARCH64_FL_SVE2 \ + | AARCH64_FL_SME \ | AARCH64_FL_SME2 \ | AARCH64_FL_SM_ON) DEF_SVE_FUNCTION_GS (svadd, binary_single, all_integer, x24, none) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index cd8d3bd7056..3ad2271d51c 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -882,18 +882,15 @@ static const predication_index preds_z[] = { PRED_z, NUM_PREDS }; /* Used by SME instructions that always merge into ZA. */ static const predication_index preds_za_m[] = { PRED_za_m, NUM_PREDS }; -/* A list of all SVE ACLE functions. */ +/* A list of all arm_sve.h functions. */ static CONSTEXPR const function_group_info function_groups[] = { #define DEF_SVE_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \ { #NAME, &functions::NAME, &shapes::SHAPE, types_##TYPES, groups_##GROUPS, \ preds_##PREDS, REQUIRED_EXTENSIONS }, -#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \ - { #NAME, &functions::NAME##_za, &shapes::SHAPE, types_##TYPES, \ - groups_##GROUPS, preds_##PREDS, (REQUIRED_EXTENSIONS | AARCH64_FL_ZA_ON) }, #include "aarch64-sve-builtins.def" }; -/* A list of all NEON-SVE-Bridge ACLE functions. */ +/* A list of all arm_neon_sve_bridge.h ACLE functions. */ static CONSTEXPR const function_group_info neon_sve_function_groups[] = { #define DEF_NEON_SVE_FUNCTION(NAME, SHAPE, TYPES, GROUPS, PREDS) \ { #NAME, &neon_sve_bridge_functions::NAME, &shapes::SHAPE, types_##TYPES, \ @@ -901,6 +898,17 @@ static CONSTEXPR const function_group_info neon_sve_function_groups[] = { #include "aarch64-neon-sve-bridge-builtins.def" }; +/* A list of all arm_sme.h functions. */ +static CONSTEXPR const function_group_info sme_function_groups[] = { +#define DEF_SME_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \ + { #NAME, &functions::NAME, &shapes::SHAPE, types_##TYPES, groups_##GROUPS, \ + preds_##PREDS, REQUIRED_EXTENSIONS }, +#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \ + { #NAME, &functions::NAME##_za, &shapes::SHAPE, types_##TYPES, \ + groups_##GROUPS, preds_##PREDS, (REQUIRED_EXTENSIONS | AARCH64_FL_ZA_ON) }, +#include "aarch64-sve-builtins-sme.def" +}; + /* The scalar type associated with each vector type. */ extern GTY(()) tree scalar_types[NUM_VECTOR_TYPES + 1]; tree scalar_types[NUM_VECTOR_TYPES + 1]; @@ -4629,8 +4637,7 @@ handle_arm_sve_h () function_table = new hash_table (1023); function_builder builder; for (unsigned int i = 0; i < ARRAY_SIZE (function_groups); ++i) - if (!(function_groups[i].required_extensions & AARCH64_FL_SME)) - builder.register_function_group (function_groups[i]); + builder.register_function_group (function_groups[i]); } /* Implement #pragma GCC aarch64 "arm_neon_sve_bridge.h". */ @@ -4675,9 +4682,8 @@ handle_arm_sme_h () sme_switcher sme; function_builder builder; - for (unsigned int i = 0; i < ARRAY_SIZE (function_groups); ++i) - if (function_groups[i].required_extensions & AARCH64_FL_SME) - builder.register_function_group (function_groups[i]); + for (unsigned int i = 0; i < ARRAY_SIZE (sme_function_groups); ++i) + builder.register_function_group (sme_function_groups[i]); } /* If we're implementing manual overloading, check whether the SVE diff --git a/gcc/config/aarch64/aarch64-sve-builtins.def b/gcc/config/aarch64/aarch64-sve-builtins.def index 61593b4cad3..a9243c40a97 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.def +++ b/gcc/config/aarch64/aarch64-sve-builtins.def @@ -51,16 +51,6 @@ DEF_SVE_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS) #endif -#ifndef DEF_SME_ZA_FUNCTION_GS -#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUP, PREDS) \ - DEF_SVE_FUNCTION_GS(NAME, SHAPE, TYPES, GROUP, PREDS) -#endif - -#ifndef DEF_SME_ZA_FUNCTION -#define DEF_SME_ZA_FUNCTION(NAME, SHAPE, TYPES, PREDS) \ - DEF_SME_ZA_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS) -#endif - DEF_SVE_MODE (n, none, none, none) DEF_SVE_MODE (single, none, none, none) DEF_SVE_MODE (index, none, none, elements) @@ -168,11 +158,8 @@ DEF_SVE_GROUP_SUFFIX (vg4x4, 4, 4) #include "aarch64-sve-builtins-base.def" #include "aarch64-sve-builtins-sve2.def" -#include "aarch64-sve-builtins-sme.def" -#undef DEF_SME_ZA_FUNCTION #undef DEF_SVE_FUNCTION -#undef DEF_SME_ZA_FUNCTION_GS #undef DEF_SVE_FUNCTION_GS #undef DEF_SVE_GROUP_SUFFIX #undef DEF_SME_ZA_SUFFIX diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c index 342bebc07d6..07e22d2dd71 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c @@ -13,7 +13,7 @@ f1 (svcount_t pn, svfloat16_t f16, svint16_t s16, svfloat32_t f32, svclamp (f16, f16, f16, f16); /* { dg-error {too many arguments to function 'svclamp'} } */ svclamp (0, f16, f16); /* { dg-error {passing 'int' to argument 1 of 'svclamp', which expects an SVE type rather than a scalar type} } */ svclamp (f16, f16, f16); - svclamp (s16, s16, s16); /* { dg-error {'svclamp' has no form that takes 'svint16_t' arguments} } */ + svclamp (s16, s16, s16); svclamp (pn, f16, f16); /* { dg-error {passing 'svfloat16_t' to argument 2 of 'svclamp', but argument 1 had type 'svcount_t'} } */ svclamp (f16, s16, f16); /* { dg-error {passing 'svint16_t' to argument 2 of 'svclamp', but argument 1 had type 'svfloat16_t'} } */ svclamp (f16, f32, f32); /* { dg-error {passing 'svfloat32_t' to argument 2 of 'svclamp', but argument 1 had type 'svfloat16_t'} } */ From patchwork Fri Jan 12 12:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 187720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp139468dyc; Fri, 12 Jan 2024 04:32:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpwBpJi3delH/aNDj+bpszCgHyO75pVygRsiarHACviXDa+axYVfZ2ehZViXqBRekbRG7D X-Received: by 2002:ac8:5a44:0:b0:429:b64f:3e1e with SMTP id o4-20020ac85a44000000b00429b64f3e1emr1189116qta.2.1705062761527; Fri, 12 Jan 2024 04:32:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705062761; cv=pass; d=google.com; s=arc-20160816; b=XXka9/e5XTaY8dSI3mr0fpsC9+exUIBvqKMxqwxMT8XPAlh/EBJmAfvHYfBaXif5Pb /eJxNRQBQ5tOFPz6gKMMajRgvdzvRSeA2rqE3sLukiWU+q52geK2TWZ0EPmmBfBCgAqF 3ce2oT18S4jmLRlxsenfT2aKKDegUG9EAD3//8SwUjJdIMTvmFTdwsbMpBIrUXiatMPP PCbRtF6umOcUFQTnzUXxp9NS18mD1ahwXaDyoJ7jt32kFiZ0mDNuQekqbaAydblPjMQH PJFJ6LSlEWyuymtzczdz3eG5JswF7MCdqQqS1f98+b/JOm/kK+Fif2MmjT3HawOzu+wW KN9w== 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:in-reply-to:date:references:subject:mail-followup-to:to :from:arc-filter:dmarc-filter:delivered-to; bh=7lMhmxeGuMou8GXa2J5GVYyLiPCoA6K/8EZGuMRkIbs=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=RxmuLuWHAJ2/vi4k9TmA+xiOo19cjDi3rB/E7TN/Axp4yuEn5963kwlaYKCl4RsRwT iWtYvd3ay9U+DA5ElVtzYJDbKXrdT2l9cvDr7YV9fHYP90Bz6zmpqcOoUblUeB+OYOIm wrd6J9hlHGrgR8VIgZYlxvMTJGlVOtBz+0UJ0weNkmMVLKBf2rHm46NSFddNRJpR2tlJ K0gJI9pkbPy7t6+TvJ6bHg49QUIcfcVSxke+3nk4K+BRBVFTYoJavxiB2QmjdjaVEMvs woMqJ9mKal5+XF4hqr41k7mx6MBj8sc6cZo7mUC7M29Y3LG20gPxsqLbJbwZyxHx22aU 8R0g== 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 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t20-20020a05622a149400b00417b8ceb616si2821339qtx.403.2024.01.12.04.32.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:32:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; 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 2620:52:3:1:0:246e:9693:128c 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 41E3B3858D20 for ; Fri, 12 Jan 2024 12:32:41 +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 AE31C3858C36 for ; Fri, 12 Jan 2024 12:31:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE31C3858C36 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 AE31C3858C36 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=1705062712; cv=none; b=xySrQ1qGJbPkBhkAALd6HqUYcJmWq3GvZ91rbpY1E+jyd3zFFkJhHBCiTvE86xn4TxfjpZ5uDPdFb9lytmVd2GduH2o3HARPbiz56Dhdq1Mdwj7UQUaQl5YjLA92Frfu7hu/DyBEUcdwRnBRWixrXTjNZTvUKYN2DvBKUd8BMxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705062712; c=relaxed/simple; bh=sN04BGjluT4ZjAIgdwcQ4NSEy5rwAlDrOzdiAq5p/Cw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=F1NXpvVrdjjOXx480DAP8gwdzU+F1w0AOWtIEwX9NF5QIStltkSbT01ajgfDurr2AJTvoXobrCj+lbJ+e9Ub4XtN9MHyY4apHR1uD2EsXyzrn0ZpeRi8kBL2/eZ5WnwwKaSDy+DRhHmUd1qCZPxK6J73buqw+OUGIPoFTBz8Sw0= 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 A4D971FB for ; Fri, 12 Jan 2024 04:32:36 -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 0D7403F73F for ; Fri, 12 Jan 2024 04:31:49 -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 2/2] aarch64: Use a global map to detect duplicated overloads [PR112989] References: Date: Fri, 12 Jan 2024 12:31:48 +0000 In-Reply-To: (Richard Sandiford's message of "Fri, 12 Jan 2024 12:31:09 +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=-21.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: 1787887890562168827 X-GMAIL-MSGID: 1787887890562168827 As explained in the covering note to the previous patch, the fact that aarch64-sve-* is now used for multiple header files means that function_builder::add_overloaded_function now needs to use a global map to detect duplicated overload functions, instead of the member variable that it used previously. Tested on aarch64-linux-gnu & pushed. Richard gcc/ PR target/112989 * config/aarch64/aarch64-sve-builtins.h (function_builder::m_overload_names): Replace with... * config/aarch64/aarch64-sve-builtins.cc (overload_names): ...this new global. (add_overloaded_function): Update accordingly, using get_identifier to get a GGC-friendly record of the name. --- gcc/config/aarch64/aarch64-sve-builtins.cc | 22 ++++++++++++++-------- gcc/config/aarch64/aarch64-sve-builtins.h | 4 ---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 3ad2271d51c..c2f1486315f 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -938,6 +938,10 @@ static GTY(()) vec *registered_functions; overloaded functions. */ static hash_table *function_table; +/* Maps all overloaded function names that we've registered so far to + their associated function_instances. The map keys are IDENTIFIER_NODEs. */ +static GTY(()) hash_map *overload_names; + /* True if we've already complained about attempts to use functions when the required extension is disabled. */ static bool reported_missing_extension_p; @@ -1585,21 +1589,23 @@ function_builder:: add_overloaded_function (const function_instance &instance, aarch64_feature_flags required_extensions) { + if (!overload_names) + overload_names = hash_map::create_ggc (); + char *name = get_name (instance, true); - if (registered_function **map_value = m_overload_names.get (name)) - { - gcc_assert ((*map_value)->instance == instance - && ((*map_value)->required_extensions - & ~required_extensions) == 0); - obstack_free (&m_string_obstack, name); - } + tree id = get_identifier (name); + if (registered_function **map_value = overload_names->get (id)) + gcc_assert ((*map_value)->instance == instance + && ((*map_value)->required_extensions + & ~required_extensions) == 0); else { registered_function &rfn = add_function (instance, name, m_overload_type, NULL_TREE, required_extensions, true, m_direct_overloads); - m_overload_names.put (name, &rfn); + overload_names->put (id, &rfn); } + obstack_free (&m_string_obstack, name); } /* If we are using manual overload resolution, add one function decl diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h index 2bb893af7dd..e66729ed635 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.h +++ b/gcc/config/aarch64/aarch64-sve-builtins.h @@ -453,10 +453,6 @@ private: /* Used for building up function names. */ obstack m_string_obstack; - - /* Maps all overloaded function names that we've registered so far - to their associated function_instances. */ - hash_map m_overload_names; }; /* A base class for handling calls to built-in functions. */