From patchwork Fri Dec 13 17:31:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 850163 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1639983wry; Fri, 13 Dec 2024 09:37:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXvUYECBAPKokQ8l+aGxdCX+xbeypBcURFW7LsmAY4N3RHi7gnL34nvjxkCB4iWSswgNRWK6Q==@linaro.org X-Google-Smtp-Source: AGHT+IHMr6YyA8/EBEe4lQPUCT66L2EZv8Nww7YaDSUS1hoMzwPNKaJZoArhvYpdmSTymIH4YBKR X-Received: by 2002:a17:907:720a:b0:aa6:7933:8b33 with SMTP id a640c23a62f3a-aab7795c732mr448284066b.15.1734111479427; Fri, 13 Dec 2024 09:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734111479; cv=none; d=google.com; s=arc-20240605; b=YVm5riQ0Gbej1JasdWM5S55i6sUcrJCmQmjv2yaalCpWiEqR2Jn8fNaB8Ps6s7fJxO q/J8C8TYUyF7mzYnUDQ0IL/wZHC2LC8bn/BzZGwcXWFIvGAsAu7Lpmxj3Vt4pX3AwXEd V5deCN0jvkhGWor2wIXWbP3fOnbtoEtPWNgbCTNlwGEyVDXMyku4e71Jdtip/ZzSkC1f zrd8ZasrlCOwATipUXdyA8LooZKjc8g46pgWLPVwR7kWWr5HjFl3b3OB6mQmpaVUNE+E JdEpLU7hS0Nrn/2T6hCBgbWje8mG3rwttFcYSwV+0PHK7Guy/H7r3IlVsFklQ9QsfyHH glgQ== 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=vJNrCZs7jygffNDcKOHYLnUHgBAtLYIR4zuUaLi1yJo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=i36IH1oXYkGcvQwdVFI8C13yzLmiYYIS5en2whoS3Zyv3YkkFUzrC1JlshM9HfeVlq UTK42s3nqXKjPlxmica3N//+3XM7rhaDPtHcLsVfOhieamy1+mjbpLndt/Zx/MggqOwt ImYyJ5WrwWhMt4aDooA8CEeCT8/lhfBtXOrAKUkI9/wCI8Pxl7h+Ew8sSy0rL4L0BHWM W0vkm73QPmXjOv9eMKy1dq9kPzqvMMEENn/NPf3/QhaN5A9G+QexK684mkZ3QTxBoCtC elGn2mLugT2b9nhl+A1poQhgehwcnQUyNmD+IPwOQkUWsMa/4QVw5Sw0apfnFa/+mkFx YeBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YkKBjBF/"; 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 a640c23a62f3a-aa69aaa0bf4si698482966b.911.2024.12.13.09.37.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 09:37:59 -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="YkKBjBF/"; 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 1tM9Xd-0007Yx-P5; Fri, 13 Dec 2024 12:33: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 1tM9XN-0007Bv-Mw for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:14 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM9XK-0001ao-SO for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:13 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-436249df846so14435345e9.3 for ; Fri, 13 Dec 2024 09:33:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734111189; x=1734715989; 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=vJNrCZs7jygffNDcKOHYLnUHgBAtLYIR4zuUaLi1yJo=; b=YkKBjBF/lYrh29SvUvvzjQQlOAXJPO3a5ruuCFtZLi1GM5V03OV+lHZxQm/8JlrjKg VAaL1KgojS2KYvuRSN3LBWVvblwFUIx5jbg4TtvQvckAxAeegRA7qbq97tncMj4lQY7m sL1LqzixBMiE7FzUVBtLctEKeiiYlFnBhkSWNCxLp7DYWJf8vwgueTOgI7fIMflWLjAB D2F67r19p0XB+CzGhvWyEkNh17AUX2sBy/Gm76SMwGhNW/Bn9TImQqU/p4FQO1VY1LOL h71wjINF6M5K8aQwLHjYSAXvOUdkgo6rpa7PXVdSjI1ltmBm1tJq5FBfR0TI3A46StHQ oP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734111189; x=1734715989; 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=vJNrCZs7jygffNDcKOHYLnUHgBAtLYIR4zuUaLi1yJo=; b=w6dglel0kXgFC8fWM8P7iQLt2DBbKLRa9Tufmo5OpXhLdPPhGcgbsg3pqySuhNLU0W XRo6orIWCYpBFpaivfP4bkyjfMuF1WhLw1pcWBqt1I+Rk9P8AxPyFJmPseOwUJRuPYwJ 8zSHvToULYX9nx4jrjrCegk81iWZGhL59kKJL1Tz+Estl7A2SnfaQJ/hY1gL9QVmqQdU 1jhPe0RWAPj1IKYS1B/+GkBaMZR3rjZBMAk/GdRlxjKE9dkZ2flHhxqAiXHvT1Vv/zvb khGYsYgslLfugWiOsp0A3lSZ9ESP/GvfIQXcwg6AZsE0PIgy6p1qgp1rxN+TllRvRoQS gNAA== X-Gm-Message-State: AOJu0Yy1TfJTU6sUGDqOgtt0D1G3prNCgwGCViWMJjCXk9NYHxyuK80z iQFe9LPuQAcp87FvrWOGr+VMYikliMRqYbTDHBmiRstVGxO/czF6VS0juX1XyJ8s5gWPD+9tLws N X-Gm-Gg: ASbGncs57c/wZCmnU1kJJQraIEGC3iSEbkk3B9Cn5voVkrs2OlBPA0inf5GQ+mxCTv8 iJ4Yn5BDH6qfT8I0Bd5JvLgNn9kO7PCilp6oLuxm9ucNfYhYTMx7R1dS/37B3Usrb5kruoxORb8 Z3z8X3tppVCsUjXlC6vKkZXXt2Lx4rc7NdKEZn5wdvr6yQnsrkz7RgC7n3pC5EQsAfJHCLycb4R kYKrhlku4f6Oit+PA78bRVTDFdMCPOSENSHD0Y3wP1pRutH8pdCfvPc7iC20g== X-Received: by 2002:a05:6000:79e:b0:385:dfab:1644 with SMTP id ffacd0b85a97d-38880ae238amr3246521f8f.33.1734111189407; Fri, 13 Dec 2024 09:33:09 -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.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 09:33:08 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/85] target/arm: Convert ABS, NEG to decodetree Date: Fri, 13 Dec 2024 17:31:40 +0000 Message-Id: <20241213173229.3308926-37-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::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20241211163036.2297116-37-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 4 +++ target/arm/tcg/translate-a64.c | 46 +++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 17ecdac9dbd..f112951df72 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1632,8 +1632,12 @@ SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_s SQABS_s 0101 1110 ..1 00000 01111 0 ..... ..... @rr_e SQNEG_s 0111 1110 ..1 00000 01111 0 ..... ..... @rr_e +ABS_s 0101 1110 111 00000 10111 0 ..... ..... @rr +NEG_s 0111 1110 111 00000 10111 0 ..... ..... @rr # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e SQNEG_v 0.10 1110 ..1 00000 01111 0 ..... ..... @qrr_e +ABS_v 0.00 1110 ..1 00000 10111 0 ..... ..... @qrr_e +NEG_v 0.10 1110 ..1 00000 10111 0 ..... ..... @qrr_e diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9bb9668d111..c697f0e9441 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8889,6 +8889,33 @@ static const ENVScalar1 f_scalar_sqneg = { TRANS(SQNEG_s, do_env_scalar1, a, &f_scalar_sqneg) TRANS(SQNEG_v, do_env_vector1, a, &f_scalar_sqneg) +static bool do_scalar1_d(DisasContext *s, arg_rr *a, ArithOneOp *f) +{ + if (fp_access_check(s)) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + f(t, t); + write_fp_dreg(s, a->rd, t); + } + return true; +} + +TRANS(ABS_s, do_scalar1_d, a, tcg_gen_abs_i64) +TRANS(NEG_s, do_scalar1_d, a, tcg_gen_neg_i64) + +static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) +{ + if (!a->q && a->esz == MO_64) { + return false; + } + if (fp_access_check(s)) { + gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz); + } + return true; +} + +TRANS(ABS_v, do_gvec_fn2, a, tcg_gen_gvec_abs) +TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9213,13 +9240,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x9: /* CMEQ, CMLE */ cond = u ? TCG_COND_LE : TCG_COND_EQ; goto do_cmop; - case 0xb: /* ABS, NEG */ - if (u) { - tcg_gen_neg_i64(tcg_rd, tcg_rn); - } else { - tcg_gen_abs_i64(tcg_rd, tcg_rn); - } - break; case 0x2f: /* FABS */ gen_vfp_absd(tcg_rd, tcg_rn); break; @@ -9264,6 +9284,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, break; default: case 0x7: /* SQABS, SQNEG */ + case 0xb: /* ABS, NEG */ g_assert_not_reached(); } } @@ -9614,7 +9635,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) /* fall through */ case 0x8: /* CMGT, CMGE */ case 0x9: /* CMEQ, CMLE */ - case 0xb: /* ABS, NEG */ if (size != 3) { unallocated_encoding(s); return; @@ -9705,6 +9725,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* USQADD / SUQADD */ case 0x7: /* SQABS / SQNEG */ + case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; } @@ -10103,7 +10124,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) /* fall through */ case 0x8: /* CMGT, CMGE */ case 0x9: /* CMEQ, CMLE */ - case 0xb: /* ABS, NEG */ if (size == 3 && !is_q) { unallocated_encoding(s); return; @@ -10280,6 +10300,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* SUQADD, USQADD */ case 0x7: /* SQABS, SQNEG */ + case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; } @@ -10324,12 +10345,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size); return; case 0xb: - if (u) { /* ABS, NEG */ - gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_neg, size); - } else { - gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_abs, size); - } - return; + g_assert_not_reached(); } if (size == 3) {