From patchwork Mon Aug 14 18:34:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 1821097 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=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=) 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=H1OAv+Yi; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RPjlb6nK5z1yfP for ; Tue, 15 Aug 2023 04:36:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C72363882078 for ; Mon, 14 Aug 2023 18:36:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C72363882078 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692038169; bh=v6Rh/MbVUiJsS9hMgwydxRkzFqx7g7zgHiStXarhcy4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=H1OAv+YiRadE6dKo/j9xdEUr/tJ7OW2GqvickQ2EhtLtQrV1kGRMaxuNhBQcrpEnL rgVR2PAJ2lCOvU9vmFKc9FQNTlcUCb+SW+l7FbEU9dM1SHtnI0gYRX1mIDVG8pYAAP uSVgF/s0gxBFjEyt8xortOQ+udPx3Gs1q/p0UmxA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by sourceware.org (Postfix) with ESMTPS id D93FE3857714 for ; Mon, 14 Aug 2023 18:34:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D93FE3857714 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-56d0f4180bbso3469778eaf.1 for ; Mon, 14 Aug 2023 11:34:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692038087; x=1692642887; 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=v6Rh/MbVUiJsS9hMgwydxRkzFqx7g7zgHiStXarhcy4=; b=kzPhxa9Tm+Rq8sd7KK3qQGW73w4oExgVhq2u/rtZMPqv2FloM3sn2cV4x03Tf4A8E1 c3SOIDiQoR84RMfT9B9DHOsaco3w3ttvYrMEiqnu4Z435wIoft32Yi8zTg5jYbzyCfY/ oWacbA0i1aDZHLvd6HAhrAvZJ1ckedut5re9KWHFgPs94HzvxFWKvN7Ys2Mh7TH/klwT dz4t8/gKkIkehvDoReVfeJrJCbGTHz449AnmDU0emmtLNDPPi+6aoX+etkq5Pvl4u6wn wXMU5140OSZkORYiaVjvgBvFUCkIYOdPGxO32tJhVckvsUlaPvJeX+QQpVTBiAI7nL+Z i4lQ== X-Gm-Message-State: AOJu0YxL5isNlXRBsN5s3DmYVNBjCJAUoTNhur+SkJj6H9LvfbQiSyHy yBDUwOp0ISdnvNn59MlfsbkOx9iEUZ3ZMUEB+se1d7+o X-Google-Smtp-Source: AGHT+IHusyENBZ/+FasYNCBm9ZloMK+8AnSpIcIvmw1FZAYECTf/nmpN6sOrh8MrwY4oDg89/RT8GA== X-Received: by 2002:a05:6870:3102:b0:1bf:d8a:b5bf with SMTP id v2-20020a056870310200b001bf0d8ab5bfmr11845088oaa.36.1692038086746; Mon, 14 Aug 2023 11:34:46 -0700 (PDT) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id l22-20020a056870e91600b001bec2a8f4e3sm5451968oan.14.2023.08.14.11.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 11:34:46 -0700 (PDT) To: gcc-patches@gcc.gnu.org, Kyrylo.Tkachov@arm.com, richard.earnshaw@arm.com, richard.sandiford@arm.com Cc: Christophe Lyon Subject: [PATCH 7/9] arm: [MVE intrinsics] add binary_widen_poly shape Date: Mon, 14 Aug 2023 18:34:20 +0000 Message-Id: <20230814183422.1905511-7-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230814183422.1905511-1-christophe.lyon@linaro.org> References: <20230814183422.1905511-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 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: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds the binary_widen_poly shape description. 2023-08-14 Christophe Lyon gcc/ * config/arm/arm-mve-builtins-shapes.cc (binary_widen_poly): New. * config/arm/arm-mve-builtins-shapes.h (binary_widen_poly): New. --- gcc/config/arm/arm-mve-builtins-shapes.cc | 49 +++++++++++++++++++++++ gcc/config/arm/arm-mve-builtins-shapes.h | 1 + 2 files changed, 50 insertions(+) diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index 761da4d8ece..23eb9d0e69b 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -1187,6 +1187,55 @@ struct binary_widen_def : public overloaded_base<0> }; SHAPE (binary_widen) +/* _t vfoo[_t0](_t, _t) + + Example: vmullbq_poly. + uint32x4_t [__arm_]vmullbq_poly[_p16](uint16x8_t a, uint16x8_t b) + uint32x4_t [__arm_]vmullbq_poly_m[_p16](uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) + uint32x4_t [__arm_]vmullbq_poly_x[_p16](uint16x8_t a, uint16x8_t b, mve_pred16_t p) */ +struct binary_widen_poly_def : public overloaded_base<0> +{ + void + build (function_builder &b, const function_group_info &group, + bool preserve_user_namespace) const override + { + b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); + build_all (b, "vU0,vp0,vp0", group, MODE_none, preserve_user_namespace); + } + + tree + resolve (function_resolver &r) const override + { + unsigned int i, nargs; + type_suffix_index type; + if (!r.check_gp_argument (2, i, nargs) + || (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES) + return error_mark_node; + + /* infer_vector_type found the 'unsigned' version of the 'poly' + type we are looking for, so find the 'poly' type with the same + width. */ + type = find_type_suffix (TYPE_poly, type_suffixes[type].element_bits); + + type_suffix_index wide_suffix + = find_type_suffix (TYPE_unsigned, + type_suffixes[type].element_bits * 2); + + /* Require the 'poly' type, require_matching_vector_type would try + and fail with the 'unsigned' one. */ + if (!r.require_vector_type (i, type_suffixes[type].vector_type)) + return error_mark_node; + + /* Check the inactive argument has the wide type. */ + if ((r.pred == PRED_m) + && (r.infer_vector_type (0) != wide_suffix)) + return r.report_no_such_form (type); + + return r.resolve_to (r.mode_suffix_id, type); + } +}; +SHAPE (binary_widen_poly) + /* _t vfoo[_n_t0](_t, const int) Check that 'imm' is in the [1..#bits] range. diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h index fa6ec4fc002..a93245321c9 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -57,6 +57,7 @@ namespace arm_mve extern const function_shape *const binary_widen; extern const function_shape *const binary_widen_n; extern const function_shape *const binary_widen_opt_n; + extern const function_shape *const binary_widen_poly; extern const function_shape *const cmp; extern const function_shape *const create; extern const function_shape *const inherent;