From patchwork Tue Dec 10 16:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848862 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421063wrn; Tue, 10 Dec 2024 08:28:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV0nYV/0jtGRUl8GcAP7rIMKZ57xjPpSzwITa+Ugd5Xvlli8MOuf9O35hGF792mvyjPY9uBAg==@linaro.org X-Google-Smtp-Source: AGHT+IEQh4xqcU+yYKxmHdTyKJfLv97edWbYTrdwKYVb1VZHuBCrxpIDdXGiSwxgVmvEeHKJaXGH X-Received: by 2002:a05:6122:2087:b0:50d:a31c:678c with SMTP id 71dfb90a1353d-518882ec754mr5452486e0c.2.1733848125025; Tue, 10 Dec 2024 08:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848125; cv=none; d=google.com; s=arc-20240605; b=cVpOh3/hUpM3gklOuzrTyq4Af+l2XirEgJJmcphokjuSLNotSZrgk7qSn2+D2c22bN tUW2Ey8AhIjuE3gN35pNM7YZYuYDzKGwS47g9KFEkiDtG8b7AAWGYYokJRSLRSgKw146 EJgy569/n/4Q+OhoE6jxG5tc6MX3Ngy6rXzSf5W2RwMSUyPgJz2q9EPMvQCQoProK7W2 4r2xz5gICZSoeHoAKBqFQnS4Qxo1ezthWgXl1l0r8561yn5e50p6pbnD4VGcZk7eQvHE 7TQlMa2CcNmhUx0iXFok67Zi76VWcfStoKcBtAafpCrb0QOKPgF2W4gzNC03QF4rqCGy if/Q== 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:cc:to :from:dkim-signature; bh=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=F042SRipq6DXLuW6/t40wWwHcM3CLO4b1W073+x2s9ErXhkxrKgSQrCfcGFB7DV8sY HKPjp1KgueFrXHDuCf8NmWQj8u3y3RN4nn/ItOEDFGofJgiGn2H29uXw9b0qDRzE+PRz xt5wab10Hlj8xbiXIeUrv4PM//dToltYgtucO0opBHyG4C06I5/4cFJWmpv1V9wxBJo0 sM6a6pdMaAnsnXloUOUxnf6tW0BYq0zd7A9uQKGnVN5HXJABiAo4bgC0YXSWnbFUU2zZ uZQ9mQW9aF5GSoe/UFS8Ny6NeCM1eGQQK6CZ6HZ9vVVkt+tQAJeb325CFuavc0kfgmTp XxZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SapsFqLq; 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 71dfb90a1353d-516f9472a88si1289359e0c.273.2024.12.10.08.28.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28:45 -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=SapsFqLq; 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 1tL33B-0001ZG-FA; Tue, 10 Dec 2024 11:25:29 -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 1tL32Q-0007uM-9l for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:44 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32J-0007Wa-HC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:41 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-54021daa6cbso1934576e87.0 for ; Tue, 10 Dec 2024 08:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847863; x=1734452663; darn=nongnu.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=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; b=SapsFqLqGCjwA8GS3OYSyTVAV0dZWvUZPo+0itr2DC/P2crvlZldpu9tKo9KA0SZIk QfWAdycuQx42eKq76Imy0q2sT643jaEGbIJl3BQ+jMLtSSUsUGAm1dTTSU2qOu12nYsB UtMueasODyvmjTIsoTgjgA0ZPpBXprfcFxc9xQeVtkoSZs4v+lrFyRQXyREseto9/lcz C4fpCgbIJVU4IMPfgD15c5miTB455z9G6bfGuAZeedh3zOPWG3UELZlTnR+G7/Q8+k39 BPjnlplPLTBF6phbjchA+Jcg/0IjrEQY5CszskB7Aku36hn+i0/mKdUUtCJIOYgA9aeY I7EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847863; x=1734452663; 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=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; b=JeUsGWLShIyLra8tFjIyX/SheHczmB7pN9oeuQSrKEi61gDjHnz8sM5vhr4izZSgj3 TeC4wASVjXnP/1at16k+ZsZaTSaUAn9RIA5AG+RHneRf8Fv6kTNZYzuW9wXXIzKEkCmH UHnHg/2PcuVrxiX4D8NneT3t1LM/xJO4jnDz1Lnl5on+ZQIt3GmS/zRdYP4cwMyfP9PW qvMcaus4CbeVCJNmuq3G/DeSA03p8HHMPw/xuJWEf1XHZtaHWCOW9pjVZ8UF4pCruCsx ImOzUhd3MD0JTwMyubSOEuhl4gzTgwIClPIczFaf9C6w+kmuLXzO2Mwgu09JSkr90rXE 0hgg== X-Gm-Message-State: AOJu0YxaaCJ/GE6pGfPcuXIMNvOeT3RLEdvBwyos/3DV2vW8dgXbR6Tn bdqg807jUr6Th/Wxuc/g23wiubizuxVYgPfu9YvW48XvB0BvAJ9tbCyF8uN4fTsCqj8QOQKMxmX vu6bToDM0 X-Gm-Gg: ASbGncvLoAD8lYOmkhN8Vbueq30NwM3b/HSYV3Jydh5kpMlYsJzmFD4jiidGnzNXP7V /JjuBcM8cCcb6/DqtmknTC3lh9OSK8GEt+i7EBD2lH6LTp7auixZGUDSakK0NPtHbwCEwd0kgPw zrVLSkw5EdsnhWyolqX11LE03smadVezpJNuvec7X4DIhtMOHD/cW6MqVSVgn/a2yJhQO4GJIIa kYpI3EtCS9GfGAiNeeVt6lTKxE01M/qjueK5YQS4RGwTLgQNT5hSe4g11Y= X-Received: by 2002:a05:6512:6cc:b0:53f:22f8:74f with SMTP id 2adb3069b0e04-54024107643mr2085047e87.44.1733847863413; Tue, 10 Dec 2024 08:24:23 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 54/69] target/arm: Convert FABS, FNEG (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:18 -0600 Message-ID: <20241210161733.1830573-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 54 +++++++++++++++------------------- target/arm/tcg/a64.decode | 7 +++++ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 397420a141..f810e31ccc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9149,6 +9149,20 @@ static bool trans_SHLL_v(DisasContext *s, arg_qrr_e *a) return true; } +static bool do_fabs_fneg_v(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) +{ + int check = fp_access_check_vector_hsd(s, a->q, a->esz); + + if (check <= 0) { + return check == 0; + } + + gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz); + return true; +} + +TRANS(FABS_v, do_fabs_fneg_v, a, gen_gvec_fabs) +TRANS(FNEG_v, do_fabs_fneg_v, a, gen_gvec_fneg) /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, @@ -9447,12 +9461,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, * requires them. */ switch (opcode) { - case 0x2f: /* FABS */ - gen_vfp_absd(tcg_rd, tcg_rn); - break; - case 0x6f: /* FNEG */ - gen_vfp_negd(tcg_rd, tcg_rn); - break; case 0x7f: /* FSQRT */ gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_fpstatus); break; @@ -9497,6 +9505,8 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x9: /* CMEQ, CMLE */ case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } } @@ -9968,13 +9978,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = is_double ? 3 : 2; switch (opcode) { - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0x1d: /* SCVTF */ case 0x5d: /* UCVTF */ { @@ -10099,6 +10102,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x16: /* FCVTN, FCVTN2 */ case 0x36: /* BFCVTN, BFCVTN2 */ case 0x56: /* FCVTXN, FCVTXN2 */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ unallocated_encoding(s); return; } @@ -10171,12 +10176,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) { /* Special cases for 32 bit elements */ switch (opcode) { - case 0x2f: /* FABS */ - gen_vfp_abss(tcg_res, tcg_op); - break; - case 0x6f: /* FNEG */ - gen_vfp_negs(tcg_res, tcg_op); - break; case 0x7f: /* FSQRT */ gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10220,6 +10219,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) break; default: case 0x7: /* SQABS, SQNEG */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } } @@ -10362,15 +10363,12 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x7b: /* FCVTZU */ rmode = FPROUNDING_ZERO; break; - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - only_in_vector = true; - need_fpst = false; - break; case 0x7d: /* FRSQRTE */ case 0x7f: /* FSQRT (vector) */ break; default: + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ unallocated_encoding(s); return; } @@ -10472,12 +10470,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x59: /* FRINTX */ gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x2f: /* FABS */ - tcg_gen_andi_i32(tcg_res, tcg_op, 0x7fff); - break; - case 0x6f: /* FNEG */ - tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); - break; case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10485,6 +10477,8 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) gen_helper_vfp_sqrth(tcg_res, tcg_op, tcg_fpstatus); break; default: + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index ec0d46a563..f46bd1a715 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -77,6 +77,7 @@ @qrr_s . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=2 @qrr_bh . q:1 ...... . esz:1 ...... ...... rn:5 rd:5 &qrr_e @qrr_hs . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_hs +@qrr_sd . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_sd @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @@ -1687,3 +1688,9 @@ FCVTXN_v 0.10 1110 011 00001 01101 0 ..... ..... @qrr_s BFCVTN_v 0.00 1110 101 00001 01101 0 ..... ..... @qrr_h SHLL_v 0.10 1110 ..1 00001 00111 0 ..... ..... @qrr_e + +FABS_v 0.00 1110 111 11000 11111 0 ..... ..... @qrr_h +FABS_v 0.00 1110 1.1 00000 11111 0 ..... ..... @qrr_sd + +FNEG_v 0.10 1110 111 11000 11111 0 ..... ..... @qrr_h +FNEG_v 0.10 1110 1.1 00000 11111 0 ..... ..... @qrr_sd