From patchwork Thu Nov 7 09:18:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 2007895 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=q91qWMPh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4Xkc3L3CFjz1xyS for ; Thu, 7 Nov 2024 20:19:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 834D63858405 for ; Thu, 7 Nov 2024 09:19:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id ED6AA3858C56 for ; Thu, 7 Nov 2024 09:19:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED6AA3858C56 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 ED6AA3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730971154; cv=none; b=rUyCDlGlflFxUi40DdHSzYI6U5wSTMuAPWrGdKijCq6TUN6Eg3w04k6o/bUQ3etSYIpAsQXWj6+XHKFEtF7HtoCmXJ4jenQZvgF2k7gTaKTFbOQiAio+JDuwlqRo76DPNpdQnVd7nQXlXzO6hG2j5QXPlFiEgLcldbm7dz2EVlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730971154; c=relaxed/simple; bh=2hwmJdgYfzU2e9QWeQ9zS8BHXrdHa7ccb7Sp5RLO1fw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=tFxfLYPX1scOcaN6FXELGte//MdhaPWljndnHRPxOFDC0hedzB48sB5U7eDXRBdWxwWFjrW4Ax6bTBmCOujEJiz495ddPcqN7ABRhBUU5z7qGkDFWKF9YqMH6U/hzTapK40cSMAfmKsIMOUgrViNV6xZ8skQJOWo1h3swav9ll0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-718066adb47so464153a34.0 for ; Thu, 07 Nov 2024 01:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730971146; x=1731575946; 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=UtAPUdx27oX/bMEPxSluDzs/G+NmPkW1PaSvH9d1SyE=; b=q91qWMPhkjATEgiLAIMCskOV84+WoJGEC/mBq6F36gj0qzV5tpLI0i3a8/j+TKlzGB fiTZKvqST1NvxZ6bU/UIqa0jHmdZlxqcq/O/JyNBvuhiM/iMkhS+UlR/0ilX5F8wQrwc o6KlFBWTYhK5V+dwFYAntQV5IwCTY+c1gN4CkxldFPpQyybOOUljPTYLADGm8ZcBl/35 KPLJUsp/zqkQ3VrWCj+zIk/h8RjlPdXE3XmTGa6gWxCuiGl+b1xADUdpVwx06824/QWV YKgKJLkuMEFTOvtu1z/THGV6cENEfGeWxzqGqQdKZr9CqA8UGG5O5LTy1RNvzT5Pn6Wg Vyig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730971146; x=1731575946; 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=UtAPUdx27oX/bMEPxSluDzs/G+NmPkW1PaSvH9d1SyE=; b=ANpxQPPrSt0haL4aUi8DVc/XYRuHJ9nJ5L87ZTL77Bb0d5BhKq8NcNYCurp1jbCZAe 7GJQ/PR6vAbEsiKWgX00CpL4I3V9da+euFl2xS6vJ2L6QrNjLq4f5q4J7nSVTo3qdY2Q 2GAhlq7/37id2USYTsg+muA93ZxdDhSVT+YL3Cg0Toj5jKraog0cmZ4gQf2xPaOtLii1 9HyQRUIrezjK9/HhTQQPTUiKL4Kru2202VFGXFtIzeWDUmNJiBka+wHFaAVfXJFUTetq oZmM1kRxB+3xYw1hCyrgP5CMeZZ9DXuSrPTCuAAK7iy8KojBP0w6zKudNoIKof0KEI9C 2i7A== X-Gm-Message-State: AOJu0Yx9JLaPy9Gmv4GJnyds4lNfWdw3qglv5suY9uN+d1OFs0QNjWKK zLNyXWHidy2tzOEENn+qE8zH3tvTg1iuk82Wlum+Qb6IsYpQzaukQwueWdi3hzDPE7RmoOwQ2OL PS5dShA== X-Google-Smtp-Source: AGHT+IF23mI3dFi5ac2+FQ37vI6B79f7yPx77L7HIOWdaQCX2TnQnWJELhR/j7NELWbdttQkpyGSmw== X-Received: by 2002:a05:6830:3c0c:b0:718:65f3:6b3e with SMTP id 46e09a7af769-719ca1af6b7mr25992374a34.15.1730971145668; Thu, 07 Nov 2024 01:19:05 -0800 (PST) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71a108e344asm189755a34.48.2024.11.07.01.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 01:19:05 -0800 (PST) From: Christophe Lyon To: gcc-patches@gcc.gnu.org, richard.earnshaw@arm.com, ramanara@nvidia.com, andre.simoesdiasvieira@arm.com Cc: Christophe Lyon Subject: [PATCH 02/15] arm: [MVE intrinsics] add store_scatter_offset shape Date: Thu, 7 Nov 2024 09:18:07 +0000 Message-Id: <20241107091820.2010568-3-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107091820.2010568-1-christophe.lyon@linaro.org> References: <20241107091820.2010568-1-christophe.lyon@linaro.org> MIME-Version: 1.0 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 the store_scatter_offset shape and uses a new helper class (store_scatter), which will also be used by later patches. gcc/ChangeLog: * config/arm/arm-mve-builtins-shapes.cc (struct store_scatter): New. (struct store_scatter_offset_def): New. * config/arm/arm-mve-builtins-shapes.h (store_scatter_offset): New. --- gcc/config/arm/arm-mve-builtins-shapes.cc | 64 +++++++++++++++++++++++ gcc/config/arm/arm-mve-builtins-shapes.h | 1 + 2 files changed, 65 insertions(+) diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index b5bd03a465b..9350805c2a2 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -1613,6 +1613,70 @@ struct store_def : public overloaded_base<0> }; SHAPE (store) +/* Base class for store_scatter_offset and store_scatter_shifted_offset, which + differ only in the units of the displacement. Also used by + store_scatter_base. */ +struct store_scatter : public overloaded_base<0> +{ + bool + explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override + { + return true; + } + + bool + mode_after_pred () const override + { + return false; + } +}; + +/* void vfoo[_t0](_t *, _t, _t) + + where might be tied to (for non-truncating stores) or might + depend on the function base name (for truncating stores), + has the same width as but is of unsigned type. + + Example: vstrbq_scatter_offset + void [__arm_]vstrbq_scatter_offset[_s16](int8_t *base, uint16x8_t offset, int16x8_t value) + void [__arm_]vstrbq_scatter_offset_p[_s16](int8_t *base, uint16x8_t offset, int16x8_t value, mve_pred16_t p) */ +struct store_scatter_offset_def : public store_scatter +{ + void + build (function_builder &b, const function_group_info &group, + bool preserve_user_namespace) const override + { + b.add_overloaded_functions (group, MODE_offset, preserve_user_namespace); + build_all (b, "_,as,vu0,v0", group, MODE_offset, preserve_user_namespace); + } + + /* Resolve a scatter store that takes a scalar pointer base and a vector + displacement. + + The stored data is the final argument, and it determines the + type suffix. */ + tree + resolve (function_resolver &r) const override + { + unsigned int i, nargs; + type_suffix_index type; + if (!r.check_gp_argument (3, i, nargs) + || !r.require_pointer_type (0) + || (type = r.infer_vector_type (2)) == NUM_TYPE_SUFFIXES) + return error_mark_node; + + /* Offset (arg 1) should be a vector of unsigned with same width as value + (arg 2). */ + type_suffix_index offset_type + = find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); + if (!r.require_matching_vector_type (1, offset_type)) + return error_mark_node; + + return r.resolve_to (r.mode_suffix_id, type); + } +}; +SHAPE (store_scatter_offset) + /* _t vfoo[_t0](_t, _t, _t) i.e. the standard shape for ternary operations that operate on diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h index db7c6311728..be0e09755cc 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -65,6 +65,7 @@ namespace arm_mve extern const function_shape *const load_ext; extern const function_shape *const mvn; extern const function_shape *const store; + extern const function_shape *const store_scatter_offset; extern const function_shape *const ternary; extern const function_shape *const ternary_lshift; extern const function_shape *const ternary_n;