Patchwork [108/111] m68k: add fatanh instruction

login
register
mail settings
Submitter Bryce Lanham
Date Aug. 17, 2011, 8:54 p.m.
Message ID <1313614456-29404-9-git-send-email-blanham@gmail.com>
Download mbox | patch
Permalink /patch/110435/
State New
Headers show

Comments

Bryce Lanham - Aug. 17, 2011, 8:54 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 |    5 ++++-
 3 files changed, 20 insertions(+), 1 deletions(-)

Patch

diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index f9a35d5..93a178a 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -1443,6 +1443,21 @@  void HELPER(asin_FP0)(CPUState *env)
     floatx80_to_FP0(env, res);
 }
 
+void HELPER(atanh_FP0)(CPUState *env)
+{
+    floatx80 res;
+    long double val;
+
+    res = FP0_to_floatx80(env);
+    val = floatx80_to_ldouble(res);
+
+    DBG_FPUH("atanh_FP0 %Lg", val);
+    val = atanhl(val);
+    DBG_FPU(" = %Lg", val);
+    res = ldouble_to_floatx80(val);
+    floatx80_to_FP0(env, res);
+}
+
 void HELPER(sin_FP0)(CPUState *env)
 {
     floatx80 res;
diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h
index c043c54..373660e 100644
--- a/target-m68k/helpers.h
+++ b/target-m68k/helpers.h
@@ -69,6 +69,7 @@  DEF_HELPER_1(sqrt_FP0, void, env)
 DEF_HELPER_1(lognp1_FP0, void, env)
 DEF_HELPER_1(atan_FP0, void, env)
 DEF_HELPER_1(asin_FP0, void, env)
+DEF_HELPER_1(atanh_FP0, void, env)
 DEF_HELPER_1(sin_FP0, void, env)
 DEF_HELPER_1(tanh_FP0, void, env)
 DEF_HELPER_1(tan_FP0, void, env)
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index f4f10f4..71cbffb 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3746,9 +3746,12 @@  DISAS_INSN(fpu)
     case 0x0a:                       /* fatan */
         gen_helper_atan_FP0(cpu_env);
         break;
-    case 0x0c:
+    case 0x0c:                       /* fasin */
         gen_helper_asin_FP0(cpu_env);
         break;
+    case 0x0d:                       /* fatanh */
+        gen_helper_atanh_FP0(cpu_env);
+        break;
     case 0x0e:                       /* fsin */
         gen_helper_sin_FP0(cpu_env);
         break;