From patchwork Fri Dec 13 17:31:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 850173 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1640513wry; Fri, 13 Dec 2024 09:39:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXD/LI22pahLPGt5mYyFTLmzFKWUZZoJurOV31VxebUES0XHzqGK2n3a3/FeJsSerhFWuFN5g==@linaro.org X-Google-Smtp-Source: AGHT+IHLmN3seiyNuRhVAFgP/J4yxdB6ijLl8ze2cYm/HuWtBRhXYWijxs9pKremvHasIRBAYNZT X-Received: by 2002:a05:6000:4b12:b0:385:fa26:f0d9 with SMTP id ffacd0b85a97d-3886c725060mr3523968f8f.0.1734111548706; Fri, 13 Dec 2024 09:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734111548; cv=none; d=google.com; s=arc-20240605; b=NE/Sd/1yNhBxxY7jjmNstMREBNb6RMlSs0M050QPiF2fo93aUvIEwW54wXAciJG7p3 iwbbGVq/asVgJ6Y6Mfw++4YYpbbXs/nzwejB0DnEOX0pGYv1GK+gvJVnrTMBuHvm58ki G/Nw8Ch55V74Qsq8DgZP93oXEBcihccuc+oBPCe77yuSm9RUQKo2Ta26sUFVXwpiu7Dl xv7iSocwP8O0uQeRbXzgp569Tl+fE3b5Bf4+X7HVF3L41tZE9qBWFO3OA8B/cYmjO691 VS7JaiT6Op0ta09XuVoSESRY1tYfFZH9SlCSshwP3IEefEOqTBiUvjCmgo8GmhSgKgbh u3tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender: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:to:from :dkim-signature; bh=6CYlCkAXadMVLpj7YlTvLBxky39lmdyPLmwYujAWn20=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QrLBp8UFBxNu8ZQBKmuS4pz3hGJWddKtVTfahvTWl8WNiYERzEGnmOb/58M3bCPv7s MadwDmHGDqD0xcmQI9nF+RcyAn3USKgICX4jK4+E/lw9ppa8oyGu/865fG/awEdgMbUE 0DSI/lkpcpFuNwbFzaCQVwRZMbUui3LcEtlsCHpqxPQ1eN4LoMP1Ioz3M0UX4em6y7i6 Ju7J8C/Hyj/7bJ1OnN+yle/ONo3CL+nBv321si3FauXmm8rLlem2Wln07W0nfTjBw71Y fXlBBL6awvf1JUV1u/h/kRGnh5QxrKzPYvKav40q/uwBu/0SbBNAEVyKUzsxwlj+4J85 Yl1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCqIMSlT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-388c804de3bsi38934f8f.464.2024.12.13.09.39.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 09:39:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCqIMSlT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tM9Yb-0003UK-Ty; Fri, 13 Dec 2024 12:34:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tM9Xg-0007iI-Gc for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:33 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM9Xd-0001es-Oa for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:32 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385df53e559so1604215f8f.3 for ; Fri, 13 Dec 2024 09:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734111208; x=1734716008; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6CYlCkAXadMVLpj7YlTvLBxky39lmdyPLmwYujAWn20=; b=NCqIMSlTM7rKSk4ZadzfFNM5fxixVLMSDHzyL4R/Yl5i7KLUCiUHzLGULijqfy2SN1 2j4e3Nq2gfI8WcRUUoUoYGTtnykVX2yYNDr2HmfAS0mBSPGmENw4WJtH9Yqo7/8kXsqT G3wMGg6k9NlcvrszA1wHXrAXX9iYeEHNDAAY3RQDDVkPC4sYYQHKyd+SHN7MchYZX6Ds jAYPYi1XPhHQqq7kVx7r00oCyeQiRZVOvqmbwHC/8fLM2lK3dwy23noG6vAkrVlA1XBK 7yIHzaZA2YrE+75OF+CDk+eX0AxUpyy3xh5UKWAYDP/ZcUq/2HMR5Wrq3n+pMErZ2gw1 J7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734111208; x=1734716008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6CYlCkAXadMVLpj7YlTvLBxky39lmdyPLmwYujAWn20=; b=BQOoFRPuVdx7PFpoUX+XpF4t8r3txNwK4vbChVyFixPLdBuZwSlaw9MG5auKBghJFp s1GDkJ6BGb48uMBdshgeN3bYQ4rS50pMp/4rDy7w1/LYDGbisB34CHzxfFMZPoYqScR/ 1R75fs49kJgwbIm2qyRWCNKRmIx7lopnkMLi9CslXYrygWXovji2IROlgaqdd1JWl+6S FAtSH6IjcbzPoqGXP1nX9W2SQHVZGToup3lztckQ2XHqdHr7ZZqFVlDpTzI6SaIrPYCG CvIycj4HNG1vselcqau18q5s1i/XjstQ/pOvzyfChalGou86LP9o6iov7hwNDorsKqJf Ua6Q== X-Gm-Message-State: AOJu0Yxk3b/iSlh0oCCu1LgKl/7pTB+tT8JxfoXwXLtRf+n6cD3lz3cg 9TC9QaSAMCjCPo51IV/Vx/+5kbED3tkUCKBTgKqjNrx/IqrKSA2GVn5CJI0+Fu4bwvbKay8WmQR I X-Gm-Gg: ASbGncvJ1MtucS6PK3/xF9gMLUihG4lm/zEsp1VSiFrlyilYYwaftGr/6vOETPXIg8C ACry12UFgUbt8LGwB00tbqFI1aO000TxylEVoIVYB7K/ZM4Icyvo/qamk3OqZwwk3QXByF7m6lw fRQzBb9nad9UdLnIBgj9QmE5HBni06UTDrng5QKqKswRFt0ao/4yFDUb58W8nCx90gxiiaR1qxV 0rezKmm2vstyxW05ilw1Zk1KSrqGus9f1kl6hxDjn84WI0Rbj3RZm2i5SSduQ== X-Received: by 2002:a05:6000:4609:b0:385:fac7:89b9 with SMTP id ffacd0b85a97d-3889ad37d7amr2725035f8f.59.1734111208195; Fri, 13 Dec 2024 09:33:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c80162ddsm87026f8f.37.2024.12.13.09.33.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 09:33:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 53/85] target/arm: Implement gen_gvec_fabs, gen_gvec_fneg Date: Fri, 13 Dec 2024 17:31:57 +0000 Message-Id: <20241213173229.3308926-54-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241213173229.3308926-1-peter.maydell@linaro.org> References: <20241213173229.3308926-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Move the current implementation out of translate-neon.c, and extend to handle all element sizes. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20241211163036.2297116-54-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate.h | 6 ++++++ target/arm/tcg/gengvec.c | 14 ++++++++++++++ target/arm/tcg/translate-neon.c | 20 ++------------------ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index edd775d5640..b996de2c156 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -602,6 +602,12 @@ void gen_gvec_uaddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); +/* These exclusively manipulate the sign bit. */ +void gen_gvec_fabs(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz); +void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 2755da8ac71..01c9d5436d4 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2697,3 +2697,17 @@ void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, assert(vece <= MO_32); tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); } + +void gen_gvec_fabs(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz) +{ + uint64_t s_bit = 1ull << ((8 << vece) - 1); + tcg_gen_gvec_andi(vece, dofs, aofs, s_bit - 1, oprsz, maxsz); +} + +void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz) +{ + uint64_t s_bit = 1ull << ((8 << vece) - 1); + tcg_gen_gvec_xori(vece, dofs, aofs, s_bit, oprsz, maxsz); +} diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 0821f10fad5..b9b3d1c1fbc 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3041,14 +3041,6 @@ static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) return true; } -static void gen_VABS_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, - uint32_t oprsz, uint32_t maxsz) -{ - tcg_gen_gvec_andi(vece, rd_ofs, rm_ofs, - vece == MO_16 ? 0x7fff : 0x7fffffff, - oprsz, maxsz); -} - static bool trans_VABS_F(DisasContext *s, arg_2misc *a) { if (a->size == MO_16) { @@ -3058,15 +3050,7 @@ static bool trans_VABS_F(DisasContext *s, arg_2misc *a) } else if (a->size != MO_32) { return false; } - return do_2misc_vec(s, a, gen_VABS_F); -} - -static void gen_VNEG_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, - uint32_t oprsz, uint32_t maxsz) -{ - tcg_gen_gvec_xori(vece, rd_ofs, rm_ofs, - vece == MO_16 ? 0x8000 : 0x80000000, - oprsz, maxsz); + return do_2misc_vec(s, a, gen_gvec_fabs); } static bool trans_VNEG_F(DisasContext *s, arg_2misc *a) @@ -3078,7 +3062,7 @@ static bool trans_VNEG_F(DisasContext *s, arg_2misc *a) } else if (a->size != MO_32) { return false; } - return do_2misc_vec(s, a, gen_VNEG_F); + return do_2misc_vec(s, a, gen_gvec_fneg); } static bool trans_VRECPE(DisasContext *s, arg_2misc *a)