From patchwork Tue Feb 7 00:59:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9559035 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 69E9460236 for ; Tue, 7 Feb 2017 01:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 588A82074F for ; Tue, 7 Feb 2017 01:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D487269DA; Tue, 7 Feb 2017 01:13:18 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 EBBBA2074F for ; Tue, 7 Feb 2017 01:13:17 +0000 (UTC) Received: from localhost ([::1]:51382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cauLN-0006hf-2s for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Feb 2017 20:13:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cau9C-0005Ib-3e for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cau96-0006Dz-O7 for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:41 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:50498) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cau96-0006Ci-CW for qemu-devel@nongnu.org; Mon, 06 Feb 2017 20:00:36 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MNhFO-1cUpb81IWQ-007GWn; Tue, 07 Feb 2017 01:59:44 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 7 Feb 2017 01:59:30 +0100 Message-Id: <20170207005930.28327-17-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:esumLiADSEuKLoo86pk088u0vGZGq/8UIA8v4rAhZ33p8Yw8MBx Y1Ga9M81DztfNX+yirGXYTyczLwHhOjZ0cFFe2LsgmriJ/zDke3+2ZYwwTR3w6tUb73SfFt gbhLxN9eF7Kwja8+ouxjjSqSujAamGIHD5N9TVy1k7lY47LPiUMFDb9wrphlnLDJHg2hzpI JLAdq2Zr+7NwxC9dbml+w== X-UI-Out-Filterresults: notjunk:1; V01:K0:gp01DGm+38Y=:zd6rksPKrvDpwaW9RiTsen JJ4y37nLIs/pIiFbfgbbMZXbHnBvLU9VwpekpJkyeX/MfWN6D1bC+t3S5NXxW5pfqRdDUryFs jVBTRH32tfnUiJ8my681bhWg93xEhRO0UqQsN9rfihBjs1UF5ObxokVxA7GRJVK3dLy8TCpaK RMBRzpSDzlxUf7z8tn/v0+ihFGVUAVpIKfjNlB/gr8F8c/14Z/RfCNo75cVN759mDGSxugQfF 1LAvwy6FCfuhK0cBaay7K8Ttv7043iR/xmZxT9xNHNHpwRrtMulAL3Lh7C4MWi/QYuMPfn+OW OCTWzg0vWGAku5Zei8Z2cgO06+q2l08mt8cEBeAVvI3jZtXNIf8NJ27xamOYqKbT6dA2/O5Z3 AHCNSjTHA2EdDP6DGueOHL2xHb7bddObrwej0KYYXYhWf3Pr5kLG1GNJHsC5/Kduw4iq6sojj OV4QeDRd6A3Scc7QZMsqk1NCX7CTU/AG+XgqpS3rTMaa3dTji1OK77B6uEaEjTVwwIRjETLMB VeEWYql2qO1xKbbcPUIVSBlTsImRSi/pjHDCY+2W3JIV7VjQVNDOGo+N0t84gFrWLQDnuUVDV jP9FsWx6KPLoSLmKaT2aw39I7ZPnJGedPO+5ja9BLhkKH95QuKkwEm4UOSzaUy2bUnI6eMlDN wC1ZKW6WvJNpdEkns7ay5Sm48XyuK2VCDc35hgR8QJTf+jeDziETSgCly5c0ZnDTYPeU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PATCH v3 16/16] target-m68k: add fsincos 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 Signed-off-by: Laurent Vivier --- target/m68k/fpu_helper.c | 21 +++++++++++++++++++++ target/m68k/helper.h | 1 + target/m68k/translate.c | 15 +++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 95d5cc4..9b9d9aa 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -95,6 +95,12 @@ static floatx80 FP1_to_floatx80(CPUM68KState *env) return (floatx80){ .low = env->fp1l, .high = env->fp1h }; } +static void floatx80_to_FP1(CPUM68KState *env, floatx80 res) +{ + env->fp1l = res.low; + env->fp1h = res.high; +} + void HELPER(exts32_FP0)(CPUM68KState *env) { floatx80 res; @@ -949,3 +955,18 @@ void HELPER(cos_FP0)(CPUM68KState *env) res = ldouble_to_floatx80(val); floatx80_to_FP0(env, res); } + +void HELPER(sincos_FP0_FP1)(CPUM68KState *env) +{ + floatx80 res; + long double val, valsin, valcos; + + val = floatx80_to_ldouble(FP0_to_floatx80(env)); + + sincosl(val, &valsin, &valcos); + res = ldouble_to_floatx80(valsin); + floatx80_to_FP0(env, res); + res = ldouble_to_floatx80(valcos); + floatx80_to_FP1(env, res); + +} diff --git a/target/m68k/helper.h b/target/m68k/helper.h index 600a9a6..16f3370 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -69,6 +69,7 @@ DEF_HELPER_1(log10_FP0, void, env) DEF_HELPER_1(cosh_FP0, void, env) DEF_HELPER_1(acos_FP0, void, env) DEF_HELPER_1(cos_FP0, void, env) +DEF_HELPER_1(sincos_FP0_FP1, void, env) DEF_HELPER_3(mac_move, void, env, i32, i32) DEF_HELPER_3(macmulf, i64, env, i32, i32) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 7af88a2..cb4d9ce 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -923,6 +923,14 @@ static void gen_op_load_fpr_FP1(int freg) offsetof(CPUM68KState, fregs[freg].l.lower)); } +static void gen_op_store_fpr_FP1(int freg) +{ + tcg_gen_st16_i32(QREG_FP1H, cpu_env, + offsetof(CPUM68KState, fregs[freg].l.upper)); + tcg_gen_st_i64(QREG_FP1L, cpu_env, + offsetof(CPUM68KState, fregs[freg].l.lower)); +} + static void gen_extend_FP0(int opsize) { switch (opsize) { @@ -4773,6 +4781,13 @@ DISAS_INSN(fpu) gen_op_load_fpr_FP1(REG(ext, 7)); gen_helper_dsub_FP0_FP1(cpu_env); break; + case 0x30: case 0x31: case 0x32: + case 0x33: case 0x34: case 0x35: + case 0x36: case 0x37: + gen_helper_sincos_FP0_FP1(cpu_env); + gen_op_store_fpr_FP0(REG(ext, 7)); /* sin */ + gen_op_store_fpr_FP1(REG(ext, 0)); /* cos */ + break; case 0x38: /* fcmp */ gen_op_load_fpr_FP1(REG(ext, 7)); gen_helper_cmp_FP0_FP1(cpu_env);