From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtn49-0000NG-CL for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qtn47-00072o-R2 for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:21 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:43213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtn47-0006nS-HO for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:19 -0400 Received: by mail-gw0-f45.google.com with SMTP id 19so554570gwb.4 for ; Wed, 17 Aug 2011 13:50:19 -0700 (PDT) From: Bryce Lanham Date: Wed, 17 Aug 2011 15:47:22 -0500 Message-Id: <1313614076-28878-78-git-send-email-blanham@gmail.com> In-Reply-To: <1313614076-28878-1-git-send-email-blanham@gmail.com> References: <1313614076-28878-1-git-send-email-blanham@gmail.com> Subject: [Qemu-devel] [PATCH 077/111] m68k: add facos instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laurent Vivier From: Laurent Vivier Signed-off-by: Laurent Vivier --- target-m68k/helper.c | 29 ++++++++++++++++++++++++----- target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/target-m68k/helper.c b/target-m68k/helper.c index cccae97..bba4ae3 100644 --- a/target-m68k/helper.c +++ b/target-m68k/helper.c @@ -28,10 +28,15 @@ #include "gdbstub.h" #include "helpers.h" +#include #if 0 #define DBG_FPUH(...) do { fprintf(stderr, "0x%08x: ", env->pc); fprintf(stderr, __VA_ARGS__); } while(0) #define DBG_FPU(...) do { fprintf(stderr, __VA_ARGS__); } while(0) +#else +#define DBG_FPUH(...) +#define DBG_FPU(...) +#endif static inline float FLOAT(float32 x) { return *(float *)&x; @@ -44,11 +49,10 @@ static inline long double LDOUBLE(floatx80 x) { return *(long double *)&x; } -#else -#define DBG_FPUH(...) -#define DBG_FPU(...) -#define LDOUBLE(x) -#endif +static inline floatx80 FLOATx80(long double x) +{ + return *(floatx80 *)&x; +} #define SIGNBIT (1u << 31) @@ -1386,6 +1390,21 @@ void HELPER(chs_FP0)(CPUState *env) floatx80_to_FP0(env, res); } +void HELPER(acos_FP0)(CPUState *env) +{ + floatx80 res; + long double val; + + res = FP0_to_floatx80(env); + val = LDOUBLE(res); + + DBG_FPUH("acos_FP0 %Lg", val); + val = acosl(val); + DBG_FPU(" = %Lg", val); + res = FLOATx80(val); + floatx80_to_FP0(env, res); +} + void HELPER(getexp_FP0)(CPUState *env) { int32_t exp; diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h index 184ceef..1a375c0 100644 --- a/target-m68k/helpers.h +++ b/target-m68k/helpers.h @@ -71,6 +71,7 @@ DEF_HELPER_1(ln_FP0, void, env) DEF_HELPER_1(log10_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env) +DEF_HELPER_1(acos_FP0, void, env) DEF_HELPER_1(getexp_FP0, void, env) DEF_HELPER_1(scale_FP0_FP1, void, env) DEF_HELPER_1(add_FP0_FP1, void, env) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 4f73bf8..ece5de3 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -3679,6 +3679,9 @@ DISAS_INSN(fpu) case 0x1a: case 0x5a: case 0x5e: /* fneg */ gen_helper_chs_FP0(cpu_env); break; + case 0x1c: /* facos */ + gen_helper_acos_FP0(cpu_env); + break; case 0x1e: /* fgetexp */ gen_helper_getexp_FP0(cpu_env); break; -- 1.7.2.3