Patchwork [079/111] m68k: add fsin instruction

login
register
mail settings
Submitter Bryce Lanham
Date Aug. 17, 2011, 8:47 p.m.
Message ID <1313614076-28878-80-git-send-email-blanham@gmail.com>
Download mbox | patch
Permalink /patch/110403/
State New
Headers show

Comments

Bryce Lanham - Aug. 17, 2011, 8:47 p.m.
From: Laurent Vivier <laurent@vivier.eu>

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target-m68k/helper.c    |   15 +++++++++++++++
 target-m68k/helpers.h   |    1 +
 target-m68k/translate.c |    3 +++
 3 files changed, 19 insertions(+), 0 deletions(-)

Patch

diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 319723e..699f28a 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -1332,6 +1332,21 @@  void HELPER(log10_FP0)(CPUState *env)
     floatx80_to_FP0(env, res);
 }
 
+void HELPER(sin_FP0)(CPUState *env)
+{
+    floatx80 res;
+    long double val;
+
+    res = FP0_to_floatx80(env);
+    val = LDOUBLE(res);
+
+    DBG_FPUH("sin_FP0 %Lg", val);
+    val = sinl(val);
+    DBG_FPU(" = %Lg", val);
+    res = FLOATx80(val);
+    floatx80_to_FP0(env, res);
+}
+
 void HELPER(tan_FP0)(CPUState *env)
 {
     floatx80 res;
diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h
index ec51ce0..c704953 100644
--- a/target-m68k/helpers.h
+++ b/target-m68k/helpers.h
@@ -65,6 +65,7 @@  DEF_HELPER_2(const_FP0, void, env, i32)
 DEF_HELPER_1(iround_FP0, void, env)
 DEF_HELPER_1(itrunc_FP0, void, env)
 DEF_HELPER_1(sqrt_FP0, void, env)
+DEF_HELPER_1(sin_FP0, void, env)
 DEF_HELPER_1(tan_FP0, void, env)
 DEF_HELPER_1(exp_FP0, void, env)
 DEF_HELPER_1(exp2_FP0, void, env)
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index b69cac9..0fafa3b 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3661,6 +3661,9 @@  DISAS_INSN(fpu)
     case 4: case 0x41: case 0x45: /* fsqrt */
         gen_helper_sqrt_FP0(cpu_env);
         break;
+    case 0x0e:                       /* fsin */
+        gen_helper_sin_FP0(cpu_env);
+        break;
     case 0x0f:                       /* ftan */
         gen_helper_tan_FP0(cpu_env);
         break;