qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>,
	Thomas Huth <huth@tuxfamily.org>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 04/11] target/m68k: implement fsincos
Date: Mon, 12 Mar 2018 21:27:21 +0100	[thread overview]
Message-ID: <20180312202728.23790-5-laurent@vivier.eu> (raw)
In-Reply-To: <20180312202728.23790-1-laurent@vivier.eu>

using floatx80_sin() and floatx80_cos()

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/m68k/fpu_helper.c | 11 +++++++++++
 target/m68k/helper.h     |  1 +
 target/m68k/translate.c  |  8 ++++++++
 3 files changed, 20 insertions(+)

diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
index 71df19c685..36e34d42a8 100644
--- a/target/m68k/fpu_helper.c
+++ b/target/m68k/fpu_helper.c
@@ -607,3 +607,14 @@ void HELPER(fcos)(CPUM68KState *env, FPReg *res, FPReg *val)
 {
     res->d = floatx80_cos(val->d, &env->fp_status);
 }
+
+void HELPER(fsincos)(CPUM68KState *env, FPReg *res0, FPReg *res1, FPReg *val)
+{
+    floatx80 a = val->d;
+    /* If res0 and res1 specify the same floating-point data register,
+     * the sine result is stored in the register, and the cosine
+     * result is discarded.
+     */
+    res1->d = floatx80_cos(a, &env->fp_status);
+    res0->d = floatx80_sin(a, &env->fp_status);
+}
diff --git a/target/m68k/helper.h b/target/m68k/helper.h
index 767baf75a3..a168ffbaea 100644
--- a/target/m68k/helper.h
+++ b/target/m68k/helper.h
@@ -78,6 +78,7 @@ DEF_HELPER_3(ftentox, void, env, fp, fp)
 DEF_HELPER_3(ftan, void, env, fp, fp)
 DEF_HELPER_3(fsin, void, env, fp, fp)
 DEF_HELPER_3(fcos, void, env, fp, fp)
+DEF_HELPER_4(fsincos, void, env, fp, fp, fp)
 
 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 f47388da4b..a78edd8825 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -5159,6 +5159,14 @@ DISAS_INSN(fpu)
     case 0x6c: /* fdsub */
         gen_helper_fdsub(cpu_env, cpu_dest, cpu_src, cpu_dest);
         break;
+    case 0x30: case 0x31: case 0x32:
+    case 0x33: case 0x34: case 0x35:
+    case 0x36: case 0x37: {
+            TCGv_ptr cpu_dest2 = gen_fp_ptr(REG(ext, 0));
+            gen_helper_fsincos(cpu_env, cpu_dest, cpu_dest2, cpu_src);
+            tcg_temp_free_ptr(cpu_dest2);
+        }
+        break;
     case 0x38: /* fcmp */
         gen_helper_fcmp(cpu_env, cpu_src, cpu_dest);
         return;
-- 
2.14.3

  parent reply	other threads:[~2018-03-12 20:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 20:27 [Qemu-devel] [PATCH 00/11] implement 680x0 FPU (part 5) Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 01/11] target/m68k: implement ftan Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 02/11] target/m68k: implement fsin Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 03/11] target/m68k: implement fcos Laurent Vivier
2018-03-12 20:27 ` Laurent Vivier [this message]
2018-03-12 20:27 ` [Qemu-devel] [PATCH 05/11] target/m68k: implement fatan Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 06/11] target/m68k: implement fasin Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 07/11] target/m68k: implement facos Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 08/11] target/m68k: implement fatanh Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 09/11] target/m68k: implement ftanh Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 10/11] target/m68k: implement fsinh Laurent Vivier
2018-03-12 20:27 ` [Qemu-devel] [PATCH 11/11] target/m68k: implement fcosh Laurent Vivier
2018-03-15 16:24 ` [Qemu-devel] [PATCH 00/11] implement 680x0 FPU (part 5) Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180312202728.23790-5-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=huth@tuxfamily.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).