From patchwork Thu Nov 16 15:26:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 1864802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=AigckYDF; dkim-atps=neutral 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 4SWP6c1gYHz1yRR for ; Fri, 17 Nov 2023 02:27:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C1633858008 for ; Thu, 16 Nov 2023 15:27:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id EF6863858438 for ; Thu, 16 Nov 2023 15:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF6863858438 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EF6863858438 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::234 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700148411; cv=none; b=l0kUGYPA+BSGQtBdhEaiOHLBZpteJXMejNR8UpO007nLKPqkAL9PEX1KTg+ejfapG449BKJjc2R90ORQ+HV8lSQVrm2LLhekZXxNRNt+YAS5YTBSCfLHbaAOYVqSYsHLdMbQG0h+EB5piozi4ZPx17OcgdUpRrs6R34qSq331Gw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700148411; c=relaxed/simple; bh=7OmIAiTqu2xHENNTLOqPn3Z3sdBVBKjFukXQggJ7FKY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=iXtFM9LMCf61sEA7T43d/WmiGwj6hacYtrp61yQrFU3zsiczLwG0S0eAPnr52yBSGSQPmy8/efeomK9MV9BITcoSccAPsZ1tnclK16wkZtEBL2Lrun7dYULm3QNikjWUOzp7teqNgbMyxsqRFpCXXTES7/lIS9bPjhUqbsvU9Ts= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3b58d96a3bbso529371b6e.1 for ; Thu, 16 Nov 2023 07:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700148409; x=1700753209; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=83FiEIExZ9j1boBUnaD4iiCo+F6ujGpoCS7/0N5XLUQ=; b=AigckYDFXiYSOfWy6JTa/+LYAe741MSJsXDJr4uA9UQx+nMSIwHG/IupiEc5SQ9ZNP m1WF3BNhprLlt9Pjj0gP+N+MzjiUyz7DANg9QI3I0csDE8UZ3KcKUB46Smk5exyeh0F5 WTslDAnyhdvX6xw0+qUihNo7Ume2mFeDrbEOmhIcJ2M1pSxo+SK0z/UPTo5r7ZWqFVtu tnQMAFHx/OHSeXPZaZF5lcNVEIYhispWUgYei8Wi6HCKjtbJp9UQXZpFlFj4+zzXsitL FR8hMvjMK9vn5cR9BhaCiZAxWvp0aU8Bglt5OUj7CVeiqd2ldB99XDthlQklannl6Z3s UDgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700148409; x=1700753209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=83FiEIExZ9j1boBUnaD4iiCo+F6ujGpoCS7/0N5XLUQ=; b=vI28pWJ29v0FOJQtH7YXcqYiRelUakQGB/1TnsZgDqvVV3cuvojFTTMKwG/HyQiuD4 x7iGa0HcC9qiJc5/iYKRCbJmxqVwwRq5ZWtZFY95kmGVwVMq8VvSHiRAycRe7vKc4NS9 Zgp259tUx0sKWWGZUirF+o4ksfM6FTAZkuA4umqt1hWTnkj9YWGK2+3AvB1KPVbb13PY oCuyM7EjhrzJYEkxiNX5FN3v3HjAjbhqDMC+Ti6S14nRpEM0jjeIrPC4FuH6+A1fbmKL KfJJDTR193dNNuC2SXOuL04Xf4Z9lQ3KKD3mT0qxcrWSApWC0bILrtn3NrwziyEn90Vl D99Q== X-Gm-Message-State: AOJu0YyKVdVMJzKVH2yWmmKqcS7bs7UWpu9/N2pmSXCi+HavIeCKi/8+ hopm2kYD2XB0zHKboI7FCZK3C8mVPjnUvtJ0dU/bgHV+ X-Google-Smtp-Source: AGHT+IFMoH2aFqQhzObwaXMzDctPA1tK0QWIbGTKhb6Qav9mmkgORdNv9k7sTHNi73dwDENpzJjc4Q== X-Received: by 2002:a05:6808:1782:b0:3b6:21cc:742b with SMTP id bg2-20020a056808178200b003b621cc742bmr20528332oib.30.1700148408850; Thu, 16 Nov 2023 07:26:48 -0800 (PST) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id a26-20020a056808099a00b003af5f6e40d7sm1817426oic.15.2023.11.16.07.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:26:48 -0800 (PST) From: Christophe Lyon To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com, richard.earnshaw@arm.com, kyrylo.tkachov@arm.com Cc: Christophe Lyon Subject: [PATCH 2/6] arm: [MVE intrinsics] Add support for void and load/store pointers as argument types. Date: Thu, 16 Nov 2023 15:26:13 +0000 Message-Id: <20231116152617.2193377-2-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231116152617.2193377-1-christophe.lyon@linaro.org> References: <20231116152617.2193377-1-christophe.lyon@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org This patch adds support for '_', 'al' and 'as' for void, load pointer and store pointer argument/return value types in intrinsic signatures. It also adds a mew memory_scalar_type() helper to function_instance, which is used by 'al' and 'as'. 2023-11-16 Christophe Lyon gcc/ * config/arm/arm-mve-builtins-shapes.cc (build_const_pointer): New. (parse_type): Add support for '_', 'al' and 'as'. * config/arm/arm-mve-builtins.h (function_instance): Add memory_scalar_type. (function_base): Likewise. --- gcc/config/arm/arm-mve-builtins-shapes.cc | 25 +++++++++++++++++++++++ gcc/config/arm/arm-mve-builtins.h | 17 +++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index 23eb9d0e69b..ce87ebcef30 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -39,6 +39,13 @@ namespace arm_mve { +/* Return a representation of "const T *". */ +static tree +build_const_pointer (tree t) +{ + return build_pointer_type (build_qualified_type (t, TYPE_QUAL_CONST)); +} + /* If INSTANCE has a predicate, add it to the list of argument types in ARGUMENT_TYPES. RETURN_TYPE is the type returned by the function. */ @@ -140,6 +147,9 @@ parse_element_type (const function_instance &instance, const char *&format) /* Read and return a type from FORMAT for function INSTANCE. Advance FORMAT beyond the type string. The format is: + _ - void + al - array pointer for loads + as - array pointer for stores p - predicates with type mve_pred16_t s - a scalar type with the given element suffix t - a vector or tuple type with given element suffix [*1] @@ -156,6 +166,21 @@ parse_type (const function_instance &instance, const char *&format) { int ch = *format++; + + if (ch == '_') + return void_type_node; + + if (ch == 'a') + { + ch = *format++; + if (ch == 'l') + return build_const_pointer (instance.memory_scalar_type ()); + if (ch == 's') { + return build_pointer_type (instance.memory_scalar_type ()); + } + gcc_unreachable (); + } + if (ch == 'p') return get_mve_pred16_t (); diff --git a/gcc/config/arm/arm-mve-builtins.h b/gcc/config/arm/arm-mve-builtins.h index 37b8223dfb2..4fd230fe4c7 100644 --- a/gcc/config/arm/arm-mve-builtins.h +++ b/gcc/config/arm/arm-mve-builtins.h @@ -277,6 +277,7 @@ public: bool could_trap_p () const; unsigned int vectors_per_tuple () const; + tree memory_scalar_type () const; const mode_suffix_info &mode_suffix () const; @@ -519,6 +520,14 @@ public: of vectors in the tuples, otherwise return 1. */ virtual unsigned int vectors_per_tuple () const { return 1; } + /* If the function addresses memory, return the type of a single + scalar memory element. */ + virtual tree + memory_scalar_type (const function_instance &) const + { + gcc_unreachable (); + } + /* Try to fold the given gimple call. Return the new gimple statement on success, otherwise return null. */ virtual gimple *fold (gimple_folder &) const { return NULL; } @@ -644,6 +653,14 @@ function_instance::vectors_per_tuple () const return base->vectors_per_tuple (); } +/* If the function addresses memory, return the type of a single + scalar memory element. */ +inline tree +function_instance::memory_scalar_type () const +{ + return base->memory_scalar_type (*this); +} + /* Return information about the function's mode suffix. */ inline const mode_suffix_info & function_instance::mode_suffix () const