From patchwork Tue Feb 7 00:59:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9559015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FA6F60236 for ; Tue, 7 Feb 2017 01:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D13E269DA for ; Tue, 7 Feb 2017 01:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41EB527F17; Tue, 7 Feb 2017 01:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B05E5269DA for ; Tue, 7 Feb 2017 01:06:49 +0000 (UTC) Received: from localhost ([::1]:51350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cauF6-00017V-O2 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Feb 2017 20:06:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cau9D-0005JF-1L for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cau97-0006Ej-QT for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:42 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:63648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cau97-0006D3-47 for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:37 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Lgc09-1c75Xn1lfJ-00nyrO; Tue, 07 Feb 2017 01:59:42 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 7 Feb 2017 01:59:27 +0100 Message-Id: <20170207005930.28327-14-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207005930.28327-1-laurent@vivier.eu> References: <20170207005930.28327-1-laurent@vivier.eu> X-Provags-ID: V03:K0:RJB362U9132u8JP+Yv1FTTSXZiF3Kv6SEYBpx6AdBAP3Ld5Z7o+ cQq/DoT/0r5WvtdSNXZF+4bcEi6qExi236WP2jOK4tjv1I4qJqz5cAodv+U00piy+sY/kjF RnUHLDFz3mF54Muf02iP+bdlkBZhtMfEE1UXvmjbHeTjSSnrrt6GAqolH8H1Ev5KINlqtAz CqiSQ/kXlO7w9iLgeABow== X-UI-Out-Filterresults: notjunk:1; V01:K0:nnRNPVGAiZ8=:ffou1S61kdcob1NvCTyclr wwcXqSfCH2GCBx3zBrDkN3Z9N0gSzLHve5kqv9RI3BWdEpLFk830c2aDfxkX1UmN0CPv6W/pb hI/s6NWFhIG8UrxCQbXXOG55fBNhleRpuQ4XTIMRG3bzzGwIk/TtLH41+xQbnPLGDk8ohFPzA DGslw2agXUsRidbQhP0MQaz2RHFZdBIKRIEUNU5FeMJ0roVrukToANA3pVegPBmG5PdYl/h0k LbLR+aYp83Y7n5EKuPey5lJqyxzW6RtH/d+VP2ZwZfg8/dsKsaMJgzV3lj9PuRwfP491MXxyB 00g9EpLECxGGMZ2B/XtFAUD3VStkte9np7jFGnJJ7/hzw3YTj01YIj+rLqVPFOIix8o+KG8pC nkrARCzdR4b4+yoyjKY5ud472sWj8+jlE1Yz/VEzJRUpEw0qVkF/rMVLkhv7wWBJBf3Npmg7b rVpCukDqseBAwAN4DY9QRUtS0SdBKGT63RWK1pY+zPFUGXqq9cOIBPANCCASF0sxeYflAkui4 bkv7deVbo8nWfIxASfAWOo4VYCjwR02XG2K2NvDhU6r9fzdg5K6rmtSIH0SAYeyMOoGu8oXaP l6FyI/juJ6W3mJlF5oNVwyaue7QSRceeXJIlfVeW8yQpvsMkCNQFRay4ox8JyPg3bQR5BVm7Q UhZ4E36qxliENm+B7wGzuqWQiVEEuecp+76cM1aJQptm5XeDpgRMsH6ej+W3PDlbcf4Q= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PATCH v3 13/16] target-m68k: add fsglmul and fsgldiv 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: Laurent Vivier , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP fsglmul and fsgldiv truncate data to single precision before computing results. Signed-off-by: Laurent Vivier --- target/m68k/fpu_helper.c | 22 ++++++++++++++++++++++ target/m68k/helper.h | 2 ++ target/m68k/translate.c | 8 ++++++++ 3 files changed, 32 insertions(+) diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 42f5b5c..8a3eed3 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -351,6 +351,17 @@ void HELPER(mul_FP0_FP1)(CPUM68KState *env) floatx80_to_FP0(env, res); } +void HELPER(sglmul_FP0_FP1)(CPUM68KState *env) +{ + float64 a, b, res; + + a = floatx80_to_float64(FP0_to_floatx80(env), &env->fp_status); + b = floatx80_to_float64(FP1_to_floatx80(env), &env->fp_status); + res = float64_mul(a, b, &env->fp_status); + + floatx80_to_FP0(env, float64_to_floatx80(res, &env->fp_status)); +} + void HELPER(div_FP0_FP1)(CPUM68KState *env) { floatx80 res; @@ -361,6 +372,17 @@ void HELPER(div_FP0_FP1)(CPUM68KState *env) floatx80_to_FP0(env, res); } +void HELPER(sgldiv_FP0_FP1)(CPUM68KState *env) +{ + float64 a, b, res; + + a = floatx80_to_float64(FP1_to_floatx80(env), &env->fp_status); + b = floatx80_to_float64(FP0_to_floatx80(env), &env->fp_status); + res = float64_div(a, b, &env->fp_status); + + floatx80_to_FP0(env, float64_to_floatx80(res, &env->fp_status)); +} + static int float_comp_to_cc(int float_compare) { switch (float_compare) { diff --git a/target/m68k/helper.h b/target/m68k/helper.h index 620e707..c30e5f7 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -26,7 +26,9 @@ DEF_HELPER_1(chs_FP0, void, env) DEF_HELPER_1(add_FP0_FP1, void, env) DEF_HELPER_1(sub_FP0_FP1, void, env) DEF_HELPER_1(mul_FP0_FP1, void, env) +DEF_HELPER_1(sglmul_FP0_FP1, void, env) DEF_HELPER_1(div_FP0_FP1, void, env) +DEF_HELPER_1(sgldiv_FP0_FP1, void, env) DEF_HELPER_1(cmp_FP0_FP1, void, env) DEF_HELPER_2(set_fpcr, void, env, i32) DEF_HELPER_1(tst_FP0, void, env) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index be18083..99f41d3 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4651,10 +4651,18 @@ DISAS_INSN(fpu) gen_op_load_fpr_FP1(REG(ext, 7)); gen_helper_mul_FP0_FP1(cpu_env); break; + case 0x24: /* fsgldiv */ + gen_op_load_fpr_FP1(REG(ext, 7)); + gen_helper_sgldiv_FP0_FP1(cpu_env); + break; case 0x26: /* fscale */ gen_op_load_fpr_FP1(REG(ext, 7)); gen_helper_scale_FP0_FP1(cpu_env); break; + case 0x27: /* fsglmul */ + gen_op_load_fpr_FP1(REG(ext, 7)); + gen_helper_sglmul_FP0_FP1(cpu_env); + break; case 0x28: case 0x68: case 0x6c: /* fsub */ gen_op_load_fpr_FP1(REG(ext, 7)); gen_helper_sub_FP0_FP1(cpu_env);