M68k for 2.12 patches
The following changes since commit 59667bb167f773965ce6547352f312eff0d4d523:
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging (2018-03-13 14:02:47 +0000)
are available in the Git repository at:
git://github.com/vivier/qemu-m68k.git tags/m68k-for-2.12-pull-request
for you to fetch changes up to 02f9124ebe26c36f0f7ed58085bd963e4372b2cd:
target/m68k: implement fcosh (2018-03-13 16:35:05 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Laurent Vivier (11):
target/m68k: implement ftan
target/m68k: implement fsin
target/m68k: implement fcos
target/m68k: implement fsincos
target/m68k: implement fatan
target/m68k: implement fasin
target/m68k: implement facos
target/m68k: implement fatanh
target/m68k: implement ftanh
target/m68k: implement fsinh
target/m68k: implement fcosh
target/m68k/fpu_helper.c | 61 ++ target/m68k/helper.h | 11 + target/m68k/softfloat.c | 1637 +++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 11 + target/m68k/softfloat_fpsp_tables.h | 267 ++++++ target/m68k/translate.c | 38 + 6 files changed, 2025 insertions(+)
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 07/11] target/m68k: implement facos
Using a local m68k floatx80_acos()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 ++++ target/m68k/helper.h | 1 + target/m68k/softfloat.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 +++ 5 files changed, 80 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -628,3 +628,8 @@ void HELPER(fasin)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_asin (val->d, &env->fp_status); } + +void HELPER (facos )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_acos (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -81,6 +81,7 @@ DEF_HELPER_3(fcos, void, env, fp, fp) DEF_HELPER_4(fsincos, void, env, fp, fp, fp) DEF_HELPER_3(fatan, void, env, fp, fp) DEF_HELPER_3(fasin, void, env, fp, fp) +DEF_HELPER_3(facos, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +70 -0
79 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -39,4 +39,5 @@ floatx80 floatx80_sin(floatx80 a, float_status *status);floatx80 floatx80_cos (floatx80 a,float_status *status);floatx80 floatx80_atan (floatx80 a,float_status *status);floatx80 floatx80_asin (floatx80 a,float_status *status); +floatx80 floatx80_acos (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5105,6 +5105,9 @@ DISAS_INSN(fpu)case 0x5e :/* fdneg */ gen_helper_fdneg (cpu_env, cpu_dest, cpu_src);break ; +case 0x1c :/* facos */ +gen_helper_facos (cpu_env, cpu_dest, cpu_src); +break ;case 0x1d :/* fcos */ gen_helper_fcos (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 09/11] target/m68k: implement ftanh
In reply to Laurent VivierUsing local m68k floatx80_tanh() and floatx80_etoxm1() [copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 366 +++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 2 + target/m68k/translate.c | 3 + 5 files changed, 377 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -638,3 +638,8 @@ void HELPER(fatanh)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_atanh (val->d, &env->fp_status); } + +void HELPER (ftanh )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_tanh (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -83,6 +83,7 @@ DEF_HELPER_3(fatan, void, env, fp, fp) DEF_HELPER_3(fasin, void, env, fp, fp) DEF_HELPER_3(facos, void, env, fp, fp) DEF_HELPER_3(fatanh, void, env, fp, fp) +DEF_HELPER_3(ftanh, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +366 -0
369 lines not on this page · raw message
target/m68k/softfloat.h +2 -0
@@ -41,4 +41,6 @@ floatx80 floatx80_atan(floatx80 a, float_status *status);floatx80 floatx80_asin (floatx80 a,float_status *status);floatx80 floatx80_acos (floatx80 a,float_status *status);floatx80 floatx80_atanh (floatx80 a,float_status *status); +floatx80 floatx80_etoxm1 (floatx80 a,float_status *status); +floatx80 floatx80_tanh (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5057,6 +5057,9 @@ DISAS_INSN(fpu)case 0x06 :/* flognp1 */ gen_helper_flognp1 (cpu_env, cpu_dest, cpu_src);break ; +case 0x09 :/* ftanh */ +gen_helper_ftanh (cpu_env, cpu_dest, cpu_src); +break ;case 0x0a :/* fatan */ gen_helper_fatan (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 04/11] target/m68k: implement fsincos
In reply to Laurent Vivierusing floatx80_sin() and floatx80_cos()
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 11 +++++++++++ target/m68k/helper.h | 1 + target/m68k/translate.c | 8 ++++++++ 3 files changed, 20 insertions(+)
target/m68k/fpu_helper.c +11 -0
@@ -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); +}
target/m68k/helper.h +1 -0
@@ -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)
target/m68k/translate.c +8 -0
@@ -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 ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 05/11] target/m68k: implement fatan
In reply to Laurent VivierUsing a local m68k floatx80_atan()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 200 ++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/softfloat_fpsp_tables.h | 131 +++++++++++++++++++++++ target/m68k/translate.c | 3 + 6 files changed, 341 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -618,3 +618,8 @@ void HELPER(fsincos)(CPUM68KState *env, FPReg *res0, FPReg *res1, FPReg *val) res1->d =floatx80_cos (a, &env->fp_status); res0->d =floatx80_sin (a, &env->fp_status); } + +void HELPER (fatan )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_atan (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -79,6 +79,7 @@ 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(fatan, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +200 -0
209 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -37,4 +37,5 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status);floatx80 floatx80_tan (floatx80 a,float_status *status);floatx80 floatx80_sin (floatx80 a,float_status *status);floatx80 floatx80_cos (floatx80 a,float_status *status); +floatx80 floatx80_atan (floatx80 a,float_status *status);#endif
target/m68k/softfloat_fpsp_tables.h +131 -0
135 lines not on this page · raw message
target/m68k/translate.c +3 -0
@@ -5057,6 +5057,9 @@ DISAS_INSN(fpu)case 0x06 :/* flognp1 */ gen_helper_flognp1 (cpu_env, cpu_dest, cpu_src);break ; +case 0x0a :/* fatan */ +gen_helper_fatan (cpu_env, cpu_dest, cpu_src); +break ;case 0x0e :/* fsin */ gen_helper_fsin (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 08/11] target/m68k: implement fatanh
In reply to Laurent VivierUsing a local m68k floatx80_atanh()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 ++++ target/m68k/helper.h | 1 + target/m68k/softfloat.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 +++ 5 files changed, 75 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -633,3 +633,8 @@ void HELPER(facos)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_acos (val->d, &env->fp_status); } + +void HELPER (fatanh )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_atanh (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -82,6 +82,7 @@ DEF_HELPER_4(fsincos, void, env, fp, fp, fp) DEF_HELPER_3(fatan, void, env, fp, fp) DEF_HELPER_3(fasin, void, env, fp, fp) DEF_HELPER_3(facos, void, env, fp, fp) +DEF_HELPER_3(fatanh, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +65 -0
68 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -40,4 +40,5 @@ floatx80 floatx80_cos(floatx80 a, float_status *status);floatx80 floatx80_atan (floatx80 a,float_status *status);floatx80 floatx80_asin (floatx80 a,float_status *status);floatx80 floatx80_acos (floatx80 a,float_status *status); +floatx80 floatx80_atanh (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5063,6 +5063,9 @@ DISAS_INSN(fpu)case 0x0c :/* fasin */ gen_helper_fasin (cpu_env, cpu_dest, cpu_src);break ; +case 0x0d :/* fatanh */ +gen_helper_fatanh (cpu_env, cpu_dest, cpu_src); +break ;case 0x0e :/* fsin */ gen_helper_fsin (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 10/11] target/m68k: implement fsinh
In reply to Laurent VivierUsing a local m68k floatx80_sinh()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 +++ target/m68k/helper.h | 1 + target/m68k/softfloat.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 ++ 5 files changed, 99 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -643,3 +643,8 @@ void HELPER(ftanh)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_tanh (val->d, &env->fp_status); } + +void HELPER (fsinh )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_sinh (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -84,6 +84,7 @@ DEF_HELPER_3(fasin, void, env, fp, fp) DEF_HELPER_3(facos, void, env, fp, fp) DEF_HELPER_3(fatanh, void, env, fp, fp) DEF_HELPER_3(ftanh, void, env, fp, fp) +DEF_HELPER_3(fsinh, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +89 -0
92 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -43,4 +43,5 @@ floatx80 floatx80_acos(floatx80 a, float_status *status);floatx80 floatx80_atanh (floatx80 a,float_status *status);floatx80 floatx80_etoxm1 (floatx80 a,float_status *status);floatx80 floatx80_tanh (floatx80 a,float_status *status); +floatx80 floatx80_sinh (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5042,6 +5042,9 @@ DISAS_INSN(fpu)case 1 :/* fint */ gen_helper_firound (cpu_env, cpu_dest, cpu_src);break ; +case 2 :/* fsinh */ +gen_helper_fsinh (cpu_env, cpu_dest, cpu_src); +break ;case 3 :/* fintrz */ gen_helper_fitrunc (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 03/11] target/m68k: implement fcos
In reply to Laurent VivierUsing a local m68k floatx80_cos()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 244 +++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 + 5 files changed, 254 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -602,3 +602,8 @@ void HELPER(fsin)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_sin (val->d, &env->fp_status); } + +void HELPER (fcos )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_cos (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -77,6 +77,7 @@ DEF_HELPER_3(ftwotox, void, env, fp, fp) 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_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +244 -0
247 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -36,4 +36,5 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status);floatx80 floatx80_tentox (floatx80 a,float_status *status);floatx80 floatx80_tan (floatx80 a,float_status *status);floatx80 floatx80_sin (floatx80 a,float_status *status); +floatx80 floatx80_cos (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5099,6 +5099,9 @@ DISAS_INSN(fpu)case 0x5e :/* fdneg */ gen_helper_fdneg (cpu_env, cpu_dest, cpu_src);break ; +case 0x1d :/* fcos */ +gen_helper_fcos (cpu_env, cpu_dest, cpu_src); +break ;case 0x1e :/* fgetexp */ gen_helper_fgetexp (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 06/11] target/m68k: implement fasin
In reply to Laurent VivierUsing a local m68k floatx80_asin()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 ++++ target/m68k/helper.h | 1 + target/m68k/softfloat.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 +++ 5 files changed, 75 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -623,3 +623,8 @@ void HELPER(fatan)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_atan (val->d, &env->fp_status); } + +void HELPER (fasin )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_asin (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -80,6 +80,7 @@ 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(fatan, void, env, fp, fp) +DEF_HELPER_3(fasin, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +65 -0
68 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -38,4 +38,5 @@ floatx80 floatx80_tan(floatx80 a, float_status *status);floatx80 floatx80_sin (floatx80 a,float_status *status);floatx80 floatx80_cos (floatx80 a,float_status *status);floatx80 floatx80_atan (floatx80 a,float_status *status); +floatx80 floatx80_asin (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5060,6 +5060,9 @@ DISAS_INSN(fpu)case 0x0a :/* fatan */ gen_helper_fatan (cpu_env, cpu_dest, cpu_src);break ; +case 0x0c :/* fasin */ +gen_helper_fasin (cpu_env, cpu_dest, cpu_src); +break ;case 0x0e :/* fsin */ gen_helper_fsin (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 02/11] target/m68k: implement fsin
In reply to Laurent VivierUsing a local m68k floatx80_sin()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 + 5 files changed, 257 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -597,3 +597,8 @@ void HELPER(ftan)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_tan (val->d, &env->fp_status); } + +void HELPER (fsin )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_sin (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -76,6 +76,7 @@ DEF_HELPER_3(fetox, void, env, fp, fp) DEF_HELPER_3(ftwotox, void, env, fp, fp) 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(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +247 -0
250 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -35,4 +35,5 @@ floatx80 floatx80_etox(floatx80 a, float_status *status);floatx80 floatx80_twotox (floatx80 a,float_status *status);floatx80 floatx80_tentox (floatx80 a,float_status *status);floatx80 floatx80_tan (floatx80 a,float_status *status); +floatx80 floatx80_sin (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5057,6 +5057,9 @@ DISAS_INSN(fpu)case 0x06 :/* flognp1 */ gen_helper_flognp1 (cpu_env, cpu_dest, cpu_src);break ; +case 0x0e :/* fsin */ +gen_helper_fsin (cpu_env, cpu_dest, cpu_src); +break ;case 0x0f :/* ftan */ gen_helper_ftan (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PULL 02/11] target/m68k: implement fsin
Quoted 44 lines · Laurent Vivier
Using a local m68k
floatx80_sin()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 + 5 files changed, 257 insertions(+)target/m68k/fpu_helper.c +5
-0@@ -597,3 +597,8 @@ void HELPER(ftan)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_tan (val->d, &env->fp_status); } + +void HELPER (fsin )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_sin (val->d, &env->fp_status); +}target/m68k/helper.h +1
-0@@ -76,6 +76,7 @@ DEF_HELPER_3(fetox, void, env, fp, fp) DEF_HELPER_3(ftwotox, void, env, fp, fp) 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(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)target/m68k/softfloat.c +0
-0
target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1485
Quoted 10 lines
target/m68k/softfloat.c +7
-0@@ -1476,3 +1476,250 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) } } } + +/*---------------------------------------------------------------------------- +| Sine +*----------------------------------------------------------------------------*/ + +floatx80 floatx80_sin (floatx80 a,float_status *status) +{
Hi; Coverity (CID1390617) points out that there is dead code in this function:
Quoted 18 lines
target/m68k/softfloat.c +18
-0+flag aSign, xSign; +int32_t aExp, xExp; +uint64_t aSig, xSig; + +int8_t user_rnd_mode, user_rnd_prec; + +int32_t compact, l, n, j; +floatx80 fp0, fp1, fp2, fp3, fp4, fp5, x, invtwopi, twopi1, twopi2; +float32 posneg1, twoto63; +flag adjn, endflag; + + aSig =extractFloatx80Frac (a); + aExp =extractFloatx80Exp (a); + aSign =extractFloatx80Sign (a); + +if (aExp ==0x7FFF ) { +if ((uint64_t ) (aSig <<1 )) { +return propagateFloatx80NaNOneArg (a, status);
target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1513
Quoted 10 lines
target/m68k/softfloat.c +10
-0+ } +float_raise (float_flag_invalid, status); +return floatx80_default_nan (status); + } + +if (aExp ==0 && aSig ==0 ) { +return packFloatx80 (aSign,0 ,0 ); + } + + adjn =0 ;
Here we set adjn == 0...
Quoted 66 lines
target/m68k/softfloat.c +66
-0+ + user_rnd_mode = status->float_rounding_mode; + user_rnd_prec = status->floatx80_rounding_precision; + status->float_rounding_mode = float_round_nearest_even; + status->floatx80_rounding_precision =80 ; + + compact =floatx80_make_compact (aExp, aSig); + + fp0 = a; + +if (compact <0x3FD78000 || compact >0x4004BC7E ) { +/* 2^(-40) > |X| > 15 PI */ +if (compact >0x3FFF8000 ) {/* |X| >= 15 PI */ +/* REDUCEX */ + fp1 =packFloatx80 (0 ,0 ,0 ); +if (compact ==0x7FFEFFFF ) { + twopi1 =packFloatx80 (aSign ^1 ,0x7FFE , +LIT64 (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (aSign ^1 ,0x7FDC , +LIT64 (0x85A308D300000000 )); + fp0 =floatx80_add (fp0, twopi1, status); + fp1 = fp0; + fp0 =floatx80_add (fp0, twopi2, status); + fp1 =floatx80_sub (fp1, fp0, status); + fp1 =floatx80_add (fp1, twopi2, status); + } + loop: + xSign =extractFloatx80Sign (fp0); + xExp =extractFloatx80Exp (fp0); + xExp -=0x3FFF ; +if (xExp <=28 ) { + l =0 ; + endflag =1 ; + }else { + l = xExp -27 ; + endflag =0 ; + } + invtwopi =packFloatx80 (0 ,0x3FFE - l, +LIT64 (0xA2F9836E4E44152A ));/* INVTWOPI */ + twopi1 =packFloatx80 (0 ,0x3FFF + l,LIT64 (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (0 ,0x3FDD + l,LIT64 (0x85A308D300000000 )); + +/* SIGN(INARG)*2^63 IN SGL */ + twoto63 =packFloat32 (xSign,0xBE ,0 ); + + fp2 =floatx80_mul (fp0, invtwopi, status); + fp2 =floatx80_add (fp2,float32_to_floatx80 (twoto63, status), + status);/* THE FRACT PART OF FP2 IS ROUNDED */ + fp2 =floatx80_sub (fp2,float32_to_floatx80 (twoto63, status), + status);/* FP2 is N */ + fp4 =floatx80_mul (twopi1, fp2, status);/* W = N*P1 */ + fp5 =floatx80_mul (twopi2, fp2, status);/* w = N*P2 */ + fp3 =floatx80_add (fp4, fp5, status);/* FP3 is P */ + fp4 =floatx80_sub (fp4, fp3, status);/* W-P */ + fp0 =floatx80_sub (fp0, fp3, status);/* FP0 is A := R - P */ + fp4 =floatx80_add (fp4, fp5, status);/* FP4 is p = (W-P)+w */ + fp3 = fp0;/* FP3 is A */ + fp1 =floatx80_sub (fp1, fp4, status);/* FP1 is a := r - p */ + fp0 =floatx80_add (fp0, fp1, status);/* FP0 is R := A+a */ + +if (endflag >0 ) { + n =floatx80_to_int32 (fp2, status); + goto sincont; + } + fp3 =floatx80_sub (fp3, fp0, status);/* A-R */ + fp1 =floatx80_add (fp1, fp3, status);/* FP1 is r := (A-R)+a */
target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1589
Quoted 10 lines
target/m68k/softfloat.c +10
-0+ goto loop; + }else { +/* SINSM */ + fp0 =float32_to_floatx80 (make_float32 (0x3F800000 ), + status);/* 1 */ + + status->float_rounding_mode = user_rnd_mode; + status->floatx80_rounding_precision = user_rnd_prec; + +if (adjn) {
...and we never change it before here, so this branch of this 'if' is dead code.
target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1600
Quoted 11 lines
target/m68k/softfloat.c +11
-0+/* COSTINY */ + a =floatx80_sub (fp0,float32_to_floatx80 ( +make_float32 (0x00800000 ), status), status); + }else { +/* SINTINY */ + a =floatx80_move (a, status); + } +float_raise (float_flag_inexact, status); + +return a; + }
Similarly in floatx80_cos(), we set adjn = 1 at the top of the function, and then later test it.
Should these two functions be sharing code? They do look rather similar...
thanks
-- PMM
Re: [Qemu-devel] [PULL 02/11] target/m68k: implement fsin
Le 27/04/2018 à 15:47, Peter Maydell a écrit :
Quoted 180 lines · Laurent Vivier
Quoted 44 lines
Using a local m68k
floatx80_sin()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 + 5 files changed, 257 insertions(+)target/m68k/fpu_helper.c +5
-0@@ -597,3 +597,8 @@ void HELPER(ftan)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_tan (val->d, &env->fp_status); } + +void HELPER (fsin )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_sin (val->d, &env->fp_status); +}target/m68k/helper.h +1
-0@@ -76,6 +76,7 @@ DEF_HELPER_3(fetox, void, env, fp, fp) DEF_HELPER_3(ftwotox, void, env, fp, fp) 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(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)target/m68k/softfloat.c +0
-0target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1485
Quoted 10 lines
target/m68k/softfloat.c +7
-0@@ -1476,3 +1476,250 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) } } } + +/*---------------------------------------------------------------------------- +| Sine +*----------------------------------------------------------------------------*/ + +floatx80 floatx80_sin (floatx80 a,float_status *status) +{Hi; Coverity (CID1390617) points out that there is dead code in this function:
Quoted 18 lines
target/m68k/softfloat.c +18
-0+flag aSign, xSign; +int32_t aExp, xExp; +uint64_t aSig, xSig; + +int8_t user_rnd_mode, user_rnd_prec; + +int32_t compact, l, n, j; +floatx80 fp0, fp1, fp2, fp3, fp4, fp5, x, invtwopi, twopi1, twopi2; +float32 posneg1, twoto63; +flag adjn, endflag; + + aSig =extractFloatx80Frac (a); + aExp =extractFloatx80Exp (a); + aSign =extractFloatx80Sign (a); + +if (aExp ==0x7FFF ) { +if ((uint64_t ) (aSig <<1 )) { +return propagateFloatx80NaNOneArg (a, status);target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1513
Quoted 10 lines
target/m68k/softfloat.c +10
-0+ } +float_raise (float_flag_invalid, status); +return floatx80_default_nan (status); + } + +if (aExp ==0 && aSig ==0 ) { +return packFloatx80 (aSign,0 ,0 ); + } + + adjn =0 ;Here we set adjn == 0...
Quoted 66 lines
target/m68k/softfloat.c +66
-0+ + user_rnd_mode = status->float_rounding_mode; + user_rnd_prec = status->floatx80_rounding_precision; + status->float_rounding_mode = float_round_nearest_even; + status->floatx80_rounding_precision =80 ; + + compact =floatx80_make_compact (aExp, aSig); + + fp0 = a; + +if (compact <0x3FD78000 || compact >0x4004BC7E ) { +/* 2^(-40) > |X| > 15 PI */ +if (compact >0x3FFF8000 ) {/* |X| >= 15 PI */ +/* REDUCEX */ + fp1 =packFloatx80 (0 ,0 ,0 ); +if (compact ==0x7FFEFFFF ) { + twopi1 =packFloatx80 (aSign ^1 ,0x7FFE , +LIT64 (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (aSign ^1 ,0x7FDC , +LIT64 (0x85A308D300000000 )); + fp0 =floatx80_add (fp0, twopi1, status); + fp1 = fp0; + fp0 =floatx80_add (fp0, twopi2, status); + fp1 =floatx80_sub (fp1, fp0, status); + fp1 =floatx80_add (fp1, twopi2, status); + } + loop: + xSign =extractFloatx80Sign (fp0); + xExp =extractFloatx80Exp (fp0); + xExp -=0x3FFF ; +if (xExp <=28 ) { + l =0 ; + endflag =1 ; + }else { + l = xExp -27 ; + endflag =0 ; + } + invtwopi =packFloatx80 (0 ,0x3FFE - l, +LIT64 (0xA2F9836E4E44152A ));/* INVTWOPI */ + twopi1 =packFloatx80 (0 ,0x3FFF + l,LIT64 (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (0 ,0x3FDD + l,LIT64 (0x85A308D300000000 )); + +/* SIGN(INARG)*2^63 IN SGL */ + twoto63 =packFloat32 (xSign,0xBE ,0 ); + + fp2 =floatx80_mul (fp0, invtwopi, status); + fp2 =floatx80_add (fp2,float32_to_floatx80 (twoto63, status), + status);/* THE FRACT PART OF FP2 IS ROUNDED */ + fp2 =floatx80_sub (fp2,float32_to_floatx80 (twoto63, status), + status);/* FP2 is N */ + fp4 =floatx80_mul (twopi1, fp2, status);/* W = N*P1 */ + fp5 =floatx80_mul (twopi2, fp2, status);/* w = N*P2 */ + fp3 =floatx80_add (fp4, fp5, status);/* FP3 is P */ + fp4 =floatx80_sub (fp4, fp3, status);/* W-P */ + fp0 =floatx80_sub (fp0, fp3, status);/* FP0 is A := R - P */ + fp4 =floatx80_add (fp4, fp5, status);/* FP4 is p = (W-P)+w */ + fp3 = fp0;/* FP3 is A */ + fp1 =floatx80_sub (fp1, fp4, status);/* FP1 is a := r - p */ + fp0 =floatx80_add (fp0, fp1, status);/* FP0 is R := A+a */ + +if (endflag >0 ) { + n =floatx80_to_int32 (fp2, status); + goto sincont; + } + fp3 =floatx80_sub (fp3, fp0, status);/* A-R */ + fp1 =floatx80_add (fp1, fp3, status);/* FP1 is r := (A-R)+a */ target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1589
Quoted 10 lines
target/m68k/softfloat.c +10
-0+ goto loop; + }else { +/* SINSM */ + fp0 =float32_to_floatx80 (make_float32 (0x3F800000 ), + status);/* 1 */ + + status->float_rounding_mode = user_rnd_mode; + status->floatx80_rounding_precision = user_rnd_prec; + +if (adjn) {...and we never change it before here, so this branch of this 'if' is dead code.
target/m68k/softfloat.c floatx80 floatx80_tan(floatx80 a, float_status *status) · line 1600
Quoted 11 lines
target/m68k/softfloat.c +11
-0+/* COSTINY */ + a =floatx80_sub (fp0,float32_to_floatx80 ( +make_float32 (0x00800000 ), status), status); + }else { +/* SINTINY */ + a =floatx80_move (a, status); + } +float_raise (float_flag_inexact, status); + +return a; + }
Quoted 5 lines
Similarly in
floatx80_cos(), we set adjn = 1 at the top of the function, and then later test it.Should these two functions be sharing code? They do look rather similar...
yes, I'm aware of these problems, but I let the code as-is to only port functions from "Previous" to QEMU. In fact, the original assembly code uses a sincos() function to compute both of them and then sin() and cos() calls it.
All these function need some cleanup now...
Thanks,
Laurent
[Qemu-devel] [PULL 11/11] target/m68k: implement fcosh
In reply to Laurent VivierUsing a local m68k floatx80_cosh()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 +++ target/m68k/helper.h | 1 + target/m68k/softfloat.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/translate.c | 3 ++ 5 files changed, 91 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -648,3 +648,8 @@ void HELPER(fsinh)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_sinh (val->d, &env->fp_status); } + +void HELPER (fcosh )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_cosh (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -85,6 +85,7 @@ DEF_HELPER_3(facos, void, env, fp, fp) DEF_HELPER_3(fatanh, void, env, fp, fp) DEF_HELPER_3(ftanh, void, env, fp, fp) DEF_HELPER_3(fsinh, void, env, fp, fp) +DEF_HELPER_3(fcosh, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +81 -0
84 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -44,4 +44,5 @@ floatx80 floatx80_atanh(floatx80 a, float_status *status);floatx80 floatx80_etoxm1 (floatx80 a,float_status *status);floatx80 floatx80_tanh (floatx80 a,float_status *status);floatx80 floatx80_sinh (floatx80 a,float_status *status); +floatx80 floatx80_cosh (floatx80 a,float_status *status);#endif
target/m68k/translate.c +3 -0
@@ -5105,6 +5105,9 @@ DISAS_INSN(fpu)case 0x5c :/* fdabs */ gen_helper_fdabs (cpu_env, cpu_dest, cpu_src);break ; +case 0x19 :/* fcosh */ +gen_helper_fcosh (cpu_env, cpu_dest, cpu_src); +break ;case 0x1a :/* fneg */ gen_helper_fneg (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 01/11] target/m68k: implement ftan
In reply to Laurent VivierUsing a local m68k floatx80_tan()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
Message-Id: <[email protected]>
--- target/m68k/fpu_helper.c | 5 + target/m68k/helper.h | 1 + target/m68k/softfloat.c | 210 ++++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 1 + target/m68k/softfloat_fpsp_tables.h | 136 +++++++++++++++++++++++ target/m68k/translate.c | 3 + 6 files changed, 356 insertions(+)
target/m68k/fpu_helper.c +5 -0
@@ -592,3 +592,8 @@ void HELPER(ftentox)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =floatx80_tentox (val->d, &env->fp_status); } + +void HELPER (ftan )(CPUM68KState *env,FPReg *res,FPReg *val) +{ + res->d =floatx80_tan (val->d, &env->fp_status); +}
target/m68k/helper.h +1 -0
@@ -75,6 +75,7 @@ DEF_HELPER_3(flog2, void, env, fp, fp) DEF_HELPER_3(fetox, void, env, fp, fp) DEF_HELPER_3(ftwotox, void, env, fp, fp) DEF_HELPER_3(ftentox, void, env, fp, fp) +DEF_HELPER_3(ftan, void, env, fp, fp) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target/m68k/softfloat.c +210 -0
213 lines not on this page · raw message
target/m68k/softfloat.h +1 -0
@@ -34,4 +34,5 @@ floatx80 floatx80_log2(floatx80 a, float_status *status);floatx80 floatx80_etox (floatx80 a,float_status *status);floatx80 floatx80_twotox (floatx80 a,float_status *status);floatx80 floatx80_tentox (floatx80 a,float_status *status); +floatx80 floatx80_tan (floatx80 a,float_status *status);#endif
target/m68k/softfloat_fpsp_tables.h +136 -0
140 lines not on this page · raw message
target/m68k/translate.c +3 -0
@@ -5057,6 +5057,9 @@ DISAS_INSN(fpu)case 0x06 :/* flognp1 */ gen_helper_flognp1 (cpu_env, cpu_dest, cpu_src);break ; +case 0x0f :/* ftan */ +gen_helper_ftan (cpu_env, cpu_dest, cpu_src); +break ;case 0x10 :/* fetox */ gen_helper_fetox (cpu_env, cpu_dest, cpu_src);break ;
Signature · 1 line
2.14.3
Peter Maydell
AppliedQuoted 29 lines · Laurent Vivier
The following changes since commit
59667bb167f773965ce6547352f312eff0d4d523:Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging (2018-03-13 14:02:47 +0000)
are available in the Git repository at:
git://github.com/vivier/qemu-m68k.gittags/m68k-for-2.12-pull-requestfor you to fetch changes up to
02f9124ebe26c36f0f7ed58085bd963e4372b2cd:target/m68k: implement fcosh (2018-03-13 16:35:05 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Laurent Vivier (11):
target/m68k: implement ftan
target/m68k: implement fsin
target/m68k: implement fcos
target/m68k: implement fsincos
target/m68k: implement fatan
target/m68k: implement fasin
target/m68k: implement facos
target/m68k: implement fatanh
target/m68k: implement ftanh
target/m68k: implement fsinh
target/m68k: implement fcosh
Quoted 7 lines
target/m68k/fpu_helper.c | 61 ++ target/m68k/helper.h | 11 + target/m68k/softfloat.c | 1637 +++++++++++++++++++++++++++++++++++ target/m68k/softfloat.h | 11 + target/m68k/softfloat_fpsp_tables.h | 267 ++++++ target/m68k/translate.c | 38 + 6 files changed, 2025 insertions(+)
Applied, thanks.
-- PMM