From patchwork Fri Dec 13 17:31:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 850209 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1643511wry; Fri, 13 Dec 2024 09:45:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWghK6LPQoP5nsURYbjznJMpQ+6dbHwtCrPOVeNblHeB/E7EpCdhMRedLbDviFe2MvktyJ6dA==@linaro.org X-Google-Smtp-Source: AGHT+IFIlVt5PDGogdfQlnJIEgFU2oGsT42WwMwB3XtpZl9nJHSdmAgBNBZXlTK0nUS0ERBJdceu X-Received: by 2002:a17:906:25c4:b0:aa6:5eae:7ece with SMTP id a640c23a62f3a-aab77e7ba08mr378555066b.43.1734111957292; Fri, 13 Dec 2024 09:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734111957; cv=none; d=google.com; s=arc-20240605; b=Co8O9zhxzc1fbCHo5pxpxOby3c935YbOHWNuhp5QS5QqSdIuTIxDiDXcCGH/XIJK+5 l0T8RN+2zEeYdpTimx3L0mcUmVqNgrpdPHKtYJzZzxLnhyh4JrJlHyA4Ph54qaEyTpth dS6lSOuSV26jL+rtRE/lFS63aq4Zm090hY10yhzQ2U9Uhm4+MIWYC/b7IQK1jQF8U78U aCR35d7cnE2CC4XFsJMrSrt/EW/GXMmbRMg3cTEo5RbzC+ITc0QDL27jn5ncUy15l3bZ tNIZt0Ir7sv2eiBMUxP99ZAadvudyiRGGafGl24xjY5g6eV3UHFPz13oXpq8y7aC+ni7 Y9rQ== 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=pxqeEqK5xe+iFA9/sNUO2IfLug2C1fWvs977/dJQRE0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZZqn4qaLE4f2L5VfLsmzFSB0xHlIaZP82ugN7eGBkUKqi3tusdP9K7Vf8Tr48DZsXg Jq/x3qjvpwjFZVOzZ59qoG3uL2xz1GlOa2x6khKC6ZM7COq0CN8aC8w1m4c+Wkn1l9wp rzKDV99XoBpMVaBguDxwrCRVaR3oMlRclIu43LHGJYBTAPq3yWwlYWqbWl5014AW0PM6 Drdji+Ze+dhcw0buseE8rYo9VH/737ZmNfA16eAs1heaozif2KDwWde6fAccgoNOmRZf YcLQaNBPknVtpx5TK0KtozgsFaJIrc6zKmFlGlWKeRFlc01pmOgoiEWrQuSLs47NdS0f yEKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hjwXpILL; 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-aa6741628a9si881087966b.748.2024.12.13.09.45.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 09:45:57 -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=hjwXpILL; 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 1tM9Xf-0007ee-KG; Fri, 13 Dec 2024 12:33:31 -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 1tM9XI-00077q-1P for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:08 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM9XE-0001Yu-Sz for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:06 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3863494591bso1067813f8f.1 for ; Fri, 13 Dec 2024 09:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734111183; x=1734715983; 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=pxqeEqK5xe+iFA9/sNUO2IfLug2C1fWvs977/dJQRE0=; b=hjwXpILLi2xaxZs88+6d2zPMej/dLjJoUudOhVJHtiPP/CIEY6EUKjfHB8tn+yf8vj S1WiydtMCXZjcv0OXUXaZF5juGX4zyBBGig31OuP6CdxIDlkU8KbMbIfuMSeqFkVgV3P O7HxZUzT5DGg7rTO4+WRyrrgrMyv0ou90QYwTUS5D2hUMmc7I/VKN4oUG8ljVwdGgmqB ihzNSUCkJpRQHdqDnuUezoffCIFsxPmyWxHmEid5t3r3vhR7lD3ipggjlXH3Us60Aqu8 3qORV9IuF+sFDxFTaMvLlozOmzYmlV2JAnGReBpIpCXYiP7ELa4cuEHiUcMvU7ss/IS4 Gs8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734111183; x=1734715983; 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=pxqeEqK5xe+iFA9/sNUO2IfLug2C1fWvs977/dJQRE0=; b=MEvmRQpm65BmvB0H7CM2yl7E29xxBJqpvDtg0Dh1R94eVTWmO/0hptB0TpiBvyFD0b RkKX2nqIbt0cFLoWJdbOZoUZ/tSx9AAx3JwuEu6/fYwSZiCECA3Lekjqe+HLu7zLUa0+ SnhYID5dY8dOwC9h8BzVeqexl75goUBKyfxKWsixbyDDaJrsqi866c7oArLquH68WMLh o/yh1wFzNlGNBVXY0fgDwEKuXPrenw5woUfEtMtkzAQwKhLyAmXg3LYZIoMiWq20O654 LVL3NcMbnxkf8cSbSdGGUShZRx5SySa3Ve9Okzo6q/ZpA6N7sx0WewXnTxcJ9psIBZRW O3cw== X-Gm-Message-State: AOJu0YwaAM+p6No5WlTfVf8T97H7EpQFkzVikDHkvFDeXrQUyfQWUDM1 zzuCaTSyEYknH6xWhgZ/QNvhrC23OO5H3redeyEKgXBv7HdAEbMS+UQs5vJ78Cv/H6shjjiDPJ3 Q X-Gm-Gg: ASbGnctEn/TaBo6EydHNTkuHP2Ujq9XOMXHLccmrWZIuTUCSRYVnGXNXgxXlYtMofSS 1OMKC2rDqgNhLp0wks+Q8hQRXOTH1uzWZkS9NWo3bXq5ZlRqqo3d09dIrexhUsPwEDE0CBY4XlO HNSzTWKRovW27u+GTvZmQ0/X2T6TVUZX+K1OaYQlztl2VJUoVibQWaJuaZ1SonRKzNKxKcqNh9o q7KK7tK5SBH5MxNniaOjzIIoeAoE+Np54i4MEOJlXtZiBczJ1fEAxKoXrAUqg== X-Received: by 2002:a05:6000:4b02:b0:386:37bb:dde3 with SMTP id ffacd0b85a97d-38880abfbb7mr2861200f8f.12.1734111183250; Fri, 13 Dec 2024 09:33:03 -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.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 09:33:02 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/85] target/arm: Convert FRINT{32, 64}[ZX] (scalar) to decodetree Date: Fri, 13 Dec 2024 17:31:34 +0000 Message-Id: <20241213173229.3308926-31-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::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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 Remove handle_fp_1src_single and handle_fp_1src_double as these were the last insns decoded by those functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20241211163036.2297116-31-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 5 ++ target/arm/tcg/translate-a64.c | 146 ++++----------------------------- 2 files changed, 22 insertions(+), 129 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 4a48fcff1dc..4f7b3ee3d95 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1340,6 +1340,11 @@ FRINTI_s 00011110 .. 1 001111 10000 ..... ..... @rr_hsd BFCVT_s 00011110 01 1 000110 10000 ..... ..... @rr_s +FRINT32Z_s 00011110 0. 1 010000 10000 ..... ..... @rr_sd +FRINT32X_s 00011110 0. 1 010001 10000 ..... ..... @rr_sd +FRINT64Z_s 00011110 0. 1 010010 10000 ..... ..... @rr_sd +FRINT64X_s 00011110 0. 1 010011 10000 ..... ..... @rr_sd + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5b30b4cacac..e48dd308fcc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8425,112 +8425,23 @@ static const FPScalar1 f_scalar_bfcvt = { }; TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar, a, &f_scalar_bfcvt, -1) -/* Floating-point data-processing (1 source) - single precision */ -static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) -{ - void (*gen_fpst)(TCGv_i32, TCGv_i32, TCGv_ptr); - TCGv_i32 tcg_op, tcg_res; - TCGv_ptr fpst; - int rmode = -1; +static const FPScalar1 f_scalar_frint32 = { + NULL, + gen_helper_frint32_s, + gen_helper_frint32_d, +}; +TRANS_FEAT(FRINT32Z_s, aa64_frint, do_fp1_scalar, a, + &f_scalar_frint32, FPROUNDING_ZERO) +TRANS_FEAT(FRINT32X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint32, -1) - tcg_op = read_fp_sreg(s, rn); - tcg_res = tcg_temp_new_i32(); - - switch (opcode) { - case 0x10: /* FRINT32Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint32_s; - break; - case 0x11: /* FRINT32X */ - gen_fpst = gen_helper_frint32_s; - break; - case 0x12: /* FRINT64Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint64_s; - break; - case 0x13: /* FRINT64X */ - gen_fpst = gen_helper_frint64_s; - break; - default: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - case 0x6: /* BFCVT */ - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - case 0xe: /* FRINTX */ - case 0xf: /* FRINTI */ - g_assert_not_reached(); - } - - fpst = fpstatus_ptr(FPST_FPCR); - if (rmode >= 0) { - TCGv_i32 tcg_rmode = gen_set_rmode(rmode, fpst); - gen_fpst(tcg_res, tcg_op, fpst); - gen_restore_rmode(tcg_rmode, fpst); - } else { - gen_fpst(tcg_res, tcg_op, fpst); - } - - write_fp_sreg(s, rd, tcg_res); -} - -/* Floating-point data-processing (1 source) - double precision */ -static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) -{ - void (*gen_fpst)(TCGv_i64, TCGv_i64, TCGv_ptr); - TCGv_i64 tcg_op, tcg_res; - TCGv_ptr fpst; - int rmode = -1; - - tcg_op = read_fp_dreg(s, rn); - tcg_res = tcg_temp_new_i64(); - - switch (opcode) { - case 0x10: /* FRINT32Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint32_d; - break; - case 0x11: /* FRINT32X */ - gen_fpst = gen_helper_frint32_d; - break; - case 0x12: /* FRINT64Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint64_d; - break; - case 0x13: /* FRINT64X */ - gen_fpst = gen_helper_frint64_d; - break; - default: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - case 0xe: /* FRINTX */ - case 0xf: /* FRINTI */ - g_assert_not_reached(); - } - - fpst = fpstatus_ptr(FPST_FPCR); - if (rmode >= 0) { - TCGv_i32 tcg_rmode = gen_set_rmode(rmode, fpst); - gen_fpst(tcg_res, tcg_op, fpst); - gen_restore_rmode(tcg_rmode, fpst); - } else { - gen_fpst(tcg_res, tcg_op, fpst); - } - - write_fp_dreg(s, rd, tcg_res); -} +static const FPScalar1 f_scalar_frint64 = { + NULL, + gen_helper_frint64_s, + gen_helper_frint64_d, +}; +TRANS_FEAT(FRINT64Z_s, aa64_frint, do_fp1_scalar, a, + &f_scalar_frint64, FPROUNDING_ZERO) +TRANS_FEAT(FRINT64X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, -1) static void handle_fp_fcvt(DisasContext *s, int opcode, int rd, int rn, int dtype, int ntype) @@ -8631,30 +8542,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) break; } - case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ - if (type > 1 || !dc_isar_feature(aa64_frint, s)) { - goto do_unallocated; - } - /* 32-to-32 and 64-to-64 ops */ - switch (type) { - case 0: - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_single(s, opcode, rd, rn); - break; - case 1: - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_double(s, opcode, rd, rn); - break; - case 3: - default: - goto do_unallocated; - } - break; - default: do_unallocated: case 0x0: /* FMOV */ @@ -8669,6 +8556,7 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) case 0xc: /* FRINTA */ case 0xe: /* FRINTX */ case 0xf: /* FRINTI */ + case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ unallocated_encoding(s); break; }