From nobody Wed Nov 5 10:33:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499395297113989.3333250770644; Thu, 6 Jul 2017 19:41:37 -0700 (PDT) Received: from localhost ([::1]:54188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTJD4-0000dF-RS for importer@patchew.org; Thu, 06 Jul 2017 22:41:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIxe-0004CQ-Om for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTIxb-0001gz-J8 for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:38 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:35978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTIxb-0001gr-Ea for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:25:35 -0400 Received: by mail-qk0-x241.google.com with SMTP id v143so2750005qkb.3 for ; Thu, 06 Jul 2017 19:25:35 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id i85sm1407176qke.66.2017.07.06.19.25.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jul 2017 19:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=FtT5p1RMMWtDyxUOddIaqPH6P4RxEZjhx3DV2AWG3AA=; b=Z/9REBkntqhLJoYHVb4bePrqKVqG885oT/HIGYu/wFba2caQ7aT/VKy6btM4wgvj4C jpmMdIrJYVsOPRA8oCF3E6N4MQ5Bov8aMCH/hqFxAqb3sw/0QQKVhN3iBXMginNz76c/ y5D8b3OeQfwzGsv1CZhgX1R4oS3jWcVrU+gLeNYHCHvIioVzY+s8Pfc4Dw3q0DQpplgC 1yf4nEyh9EpCOLm1ROWTkZSLifKLHVE0/y7RKK8Rakv6ol4p7VPpq9rMGeYfnu3IS3iV YYmwEpJpaGPzuNwKlAEGfyFfHzp0O1MQ/V26aJEljCanYzW9tflcrRrjAynYDCoCvyHo ASLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=FtT5p1RMMWtDyxUOddIaqPH6P4RxEZjhx3DV2AWG3AA=; b=V0lxL5tWEtmElZEaudqRoO0q6kTKgKouQFV1oGJEPiLOMIOSshfy8uXQv5PQgiTJKz 4aAqVilNWWBiVtq0mMYZWiHlyQMlsYS5pe1tkAXQCFpc947pmglW4sFQ3Ay3J3RrccZ6 CP0DJffZtMutkhuZzGqxgmftVJPUKo1rolk+Fk7CZsyadM3F8Ld4pt4o42HGT5ZDhGqE zvIRm3OAcDXCYiyzD5RtfWoMYagzsm/Ywv/zjd7lGFP4A8U8oun4URUk/B4OP146OJ/q hXOH3wr1bItONSANPBgn4ztGka1oXJh9u2BwUA9uckwviz7boUB7oD1akrWlC/MR2a6O Dt2g== X-Gm-Message-State: AKS2vOx+QDTpjq3DR3WwBJ+h8Qq+iZLvFcBITzmLx+H7xk3W3PvbYEF8 DRyjFEpqXBjyL2xNf4Q= X-Received: by 10.55.43.214 with SMTP id r83mr58829378qkr.59.1499394334750; Thu, 06 Jul 2017 19:25:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 6 Jul 2017 16:21:10 -1000 Message-Id: <20170707022111.21836-27-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707022111.21836-1-rth@twiddle.net> References: <20170707022111.21836-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH v2 26/27] target/sh4: Implement fsrra X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruno@clisp.org, laurent@vivier.eu, aurelien@aurel32.net, glaubitz@debian.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/sh4/helper.h | 1 + target/sh4/op_helper.c | 16 ++++++++++++++++ target/sh4/translate.c | 2 ++ 3 files changed, 19 insertions(+) diff --git a/target/sh4/helper.h b/target/sh4/helper.h index 6c6fa04..ea92dc0 100644 --- a/target/sh4/helper.h +++ b/target/sh4/helper.h @@ -37,6 +37,7 @@ DEF_HELPER_FLAGS_3(fsub_FT, TCG_CALL_NO_WG, f32, env, f32= , f32) DEF_HELPER_FLAGS_3(fsub_DT, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_2(fsqrt_FT, TCG_CALL_NO_WG, f32, env, f32) DEF_HELPER_FLAGS_2(fsqrt_DT, TCG_CALL_NO_WG, f64, env, f64) +DEF_HELPER_FLAGS_2(fsrra_FT, TCG_CALL_NO_WG, i32, env, i32) DEF_HELPER_FLAGS_2(ftrc_FT, TCG_CALL_NO_WG, i32, env, f32) DEF_HELPER_FLAGS_2(ftrc_DT, TCG_CALL_NO_WG, i32, env, f64) DEF_HELPER_3(fipr, void, env, i32, i32) diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c index 8513f38..d798f23 100644 --- a/target/sh4/op_helper.c +++ b/target/sh4/op_helper.c @@ -406,6 +406,22 @@ float64 helper_fsqrt_DT(CPUSH4State *env, float64 t0) return t0; } =20 +float32 helper_fsrra_FT(CPUSH4State *env, float32 t0) +{ + set_float_exception_flags(0, &env->fp_status); + /* "Approximate" 1/sqrt(x) via actual computation. */ + t0 =3D float32_sqrt(t0, &env->fp_status); + t0 =3D float32_div(float32_one, t0, &env->fp_status); + /* Since this is supposed to be an approximation, an imprecision + exception is required. One supposes this also follows the usual + IEEE rule that other exceptions take precidence. */ + if (get_float_exception_flags(&env->fp_status) =3D=3D 0) { + set_float_exception_flags(float_flag_inexact, &env->fp_status); + } + update_fpscr(env, GETPC()); + return t0; +} + float32 helper_fsub_FT(CPUSH4State *env, float32 t0, float32 t1) { set_float_exception_flags(0, &env->fp_status); diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 2b62e39..5fae872 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -1753,6 +1753,8 @@ static void _decode_opc(DisasContext * ctx) return; case 0xf07d: /* fsrra FRn */ CHECK_FPU_ENABLED + CHECK_FPSCR_PR_0 + gen_helper_fsrra_FT(FREG(B11_8), cpu_env, FREG(B11_8)); break; case 0xf08d: /* fldi0 FRn - FPSCR: R[PR] */ CHECK_FPU_ENABLED --=20 2.9.4