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: 165856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3287281vqg; Thu, 16 Nov 2023 07:27:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9xLBP//rbv90fHzG5eYFvOb62XNE3UYT6WfXO7CcGdWGxN8vQwFC8jVyBT7cr9jROYJx5 X-Received: by 2002:a9d:6c8f:0:b0:6d6:3ebc:73d0 with SMTP id c15-20020a9d6c8f000000b006d63ebc73d0mr9583439otr.22.1700148479438; Thu, 16 Nov 2023 07:27:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700148479; cv=pass; d=google.com; s=arc-20160816; b=0C/a9YX7C6jiFftHixLyTgyUvIuKvRVftKYFLtzo6V/1cD3diXYD03WVYK05mBhQEU 3qtVZwENXfpoKTB85CdWckNPHZ1WTOohw0udHv1U/agiuzHK71Lj5BRz1sCqwiMGnVQ2 xaZHfuypiUn/zym1JIsejtqd1FAVzHnDj/89Rk2IESbtnMyDznG6ooPO2UUY057uQnhf sQoJwT/EEJrPHBLlH8y2anMMeL4OMPQz/Ji+KfcRU/of4e4hrCGBSMFbKXCbbsjuTTDn ZcYEwM37TARbxJ3inaUIQ4xd8X+Jpp0Lt4JV/corIuMYH/DYmTaJx1BhsQLiXXsFaNCJ mIoQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=83FiEIExZ9j1boBUnaD4iiCo+F6ujGpoCS7/0N5XLUQ=; fh=FRNyphhuT2DfOrWLD6nTLzU8xRqveLticgMhz0p6TRc=; b=cxshQpPIfoWeBnCyinGD7A7CJyc/oGEITg6vfMaRbyILx440H6qzwVABPR3TT23Psm 0WSa9Rs68p0GpHRvFbT+7gzT/ZkzjRl3EQRk3Hwm2wNciB8c/dvl0gqDOHJAIT0NdDYZ Orh1a+1igmiKQ4zl7yp6/UdE/QRLafYvXXiZtoMYwXfx1ksdY120mzvmZqDctg3BT7e9 ddSZsGWa3ZGCZRh3Y9dD5BFPqJchBPSzkr8N6M3ZIHFub9GM9s/Y9tYVX1Olv3HFKmPK 3seFMW7uWKCngZjB7Lyowfn7eF0+FXowtyMZ1Fkp5HCkWSZKRmnSoLnCtF0qg9Yo/EBP //uQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AigckYDF; arc=pass (i=1); 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v1-20020ad45281000000b0064c92f86b15si11384881qvr.145.2023.11.16.07.27.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:27:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=AigckYDF; arc=pass (i=1); 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6F779385843A for ; Thu, 16 Nov 2023 15:27:45 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782734891814874866 X-GMAIL-MSGID: 1782734891814874866 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