M68k for 2.10 patches
The following changes since commit 3f0602927b120a480b35dcf58cf6f95435b3ae91:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170613' into staging (2017-06-13 15:49:07 +0100)
are available in the git repository at:
git://github.com/vivier/qemu-m68k.git tags/m68k-for-2.10-pull-request
for you to fetch changes up to 69e698220f68a17ce9584b068f68ed09e527a6ad:
target-m68k: define ext_opsize (2017-06-15 09:16:38 +0200)
----------------------------------------------------------------
----------------------------------------------------------------
Laurent Vivier (4):
target/m68k: fix V flag for CC_OP_SUBx
softfloat: define 680x0 specific values
target-m68k: move FPU helpers to fpu_helper.c
target-m68k: define ext_opsize
fpu/softfloat-specialize.h | 34 ++++++++++++-- target/m68k/Makefile.objs | 2 +- target/m68k/fpu_helper.c | 112 +++++++++++++++++++++++++++++++++++++++++++++ target/m68k/helper.c | 88 ----------------------------------- target/m68k/translate.c | 45 ++++++++++-------- 5 files changed, 169 insertions(+), 112 deletions(-) create mode 100644 target/m68k/fpu_helper.c
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 1/4] target/m68k: fix V flag for CC_OP_SUBx
V flag for subtraction is:
v = (res ^ src1) & (src1 ^ src2)
(see COMPUTE_CCR() in target/m68k/helper.c)
But gen_flush_flags() uses:
v = (res ^ src2) & (src1 ^ src2)
The problem has been found with the following program:
.global _start_start:
move.l #-2147483648,%d0
subq.l #1,%d0
jvc 1f
move.l #1,%d1
move.l #1,%d0
trap #0
1:
move.l #0,%d1
move.l #1,%d0
trap #0It works fine (exit(1)) on real hardware, and with "-singlestep".
"-singlestep" uses gen_helper_flush_flags(), whereas without "-singlestep", V flag is computed directly in gen_flush_flags().
This patch updates gen_flush_flags() to have the same result as with gen_helper_flush_flags().
Message-Id: <[email protected]>
--- target/m68k/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +1 -1
@@ -565,7 +565,7 @@ static void gen_flush_flags(DisasContext *s) t1 =tcg_temp_new ();tcg_gen_add_i32 (t0,QREG_CC_N ,QREG_CC_V );gen_ext (t0, t0, s->cc_op -CC_OP_SUBB ,1 ); -tcg_gen_xor_i32 (t1,QREG_CC_N ,QREG_CC_V ); +tcg_gen_xor_i32 (t1,QREG_CC_N , t0);tcg_gen_xor_i32 (QREG_CC_V ,QREG_CC_V , t0);tcg_temp_free (t0);tcg_gen_and_i32 (QREG_CC_V ,QREG_CC_V , t1);
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 2/4] softfloat: define 680x0 specific values
In reply to Laurent VivierMessage-Id: <[email protected]>
--- fpu/softfloat-specialize.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)
fpu/softfloat-specialize.h +31 -3
@@ -111,7 +111,7 @@ float16 float16_default_nan(float_status *status)*----------------------------------------------------------------------------*/ float32 float32_default_nan (float_status *status) { -#if defined(TARGET_SPARC ) +#if defined(TARGET_SPARC ) || defined(TARGET_M68K )return const_float32 (0x7FFFFFFF );#elif defined(TARGET_PPC ) || defined(TARGET_ARM ) || defined(TARGET_ALPHA ) || \ defined(TARGET_XTENSA ) || defined(TARGET_S390X ) || defined(TARGET_TRICORE )
@@ -136,7 +136,7 @@ float32 float32_default_nan(float_status *status)*----------------------------------------------------------------------------*/ float64 float64_default_nan (float_status *status) { -#if defined(TARGET_SPARC ) +#if defined(TARGET_SPARC ) || defined(TARGET_M68K )return const_float64 (LIT64 (0x7FFFFFFFFFFFFFFF ));#elif defined(TARGET_PPC ) || defined(TARGET_ARM ) || defined(TARGET_ALPHA ) || \ defined(TARGET_S390X )
@@ -162,7 +162,10 @@ float64 float64_default_nan(float_status *status)floatx80 floatx80_default_nan (float_status *status) {floatx80 r; - +#if defined(TARGET_M68K ) + r.low =LIT64 (0xFFFFFFFFFFFFFFFF ); + r.high =0x7FFF ; +#else if (status->snan_bit_is_one) { r.low =LIT64 (0xBFFFFFFFFFFFFFFF ); r.high =0x7FFF ;
@@ -170,6 +173,7 @@ floatx80 floatx80_default_nan(float_status *status) r.low =LIT64 (0xC000000000000000 ); r.high = 0xFFFF; } +#endif return r; }
@@ -502,6 +506,30 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, return 1; } } +#elif defined(TARGET_M68K) +static int pickNaN (flag aIsQNaN,flag aIsSNaN,flag bIsQNaN,flag bIsSNaN, +flag aIsLargerSignificand) +{ +/* M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL +* 3.4 FLOATING-POINT INSTRUCTION DETAILS +* If either operand, but not both operands, of an operation is a +* nonsignaling NaN, then that NaN is returned as the result. If both +* operands are nonsignaling NaNs, then the destination operand +* nonsignaling NaN is returned as the result. +* If either operand to an operation is a signaling NaN (SNaN), then the +* SNaN bit is set in the FPSR EXC byte. If the SNaN exception enable bit +* is set in the FPCR ENABLE byte, then the exception is taken and the +* destination is not modified. If the SNaN exception enable bit is not +* set, setting the SNaN bit in the operand to a one converts the SNaN to +* a nonsignaling NaN. The operation then continues as described in the +* preceding paragraph for nonsignaling NaNs. +*/ +if (aIsQNaN || aIsSNaN) {/* a is the destination operand */ +return 0 ;/* return the destination operand */ + }else { +return 1 ;/* return b */ + } +}#else static int pickNaN (flag aIsQNaN,flag aIsSNaN,flag bIsQNaN,flag bIsSNaN,flag aIsLargerSignificand)
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 4/4] target-m68k: define ext_opsize
In reply to Laurent VivierMessage-Id: <[email protected]>
--- target/m68k/translate.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-)
target/m68k/translate.c +24 -19
@@ -669,6 +669,21 @@ static inline int insn_opsize(int insn) } } +static inline int ext_opsize (int ext,int pos) +{ +switch ((ext >> pos) &7 ) { +case 0 :return OS_LONG ; +case 1 :return OS_SINGLE ; +case 2 :return OS_EXTENDED ; +case 3 :return OS_PACKED ; +case 4 :return OS_WORD ; +case 5 :return OS_DOUBLE ; +case 6 :return OS_BYTE ; +default : +g_assert_not_reached (); + } +} +/* Assign value to a register. If the width is less than the register width only the low part of the register is set. */ static void gen_partset_reg (int opsize,TCGv reg,TCGv val)
@@ -4111,20 +4126,19 @@ DISAS_INSN(fpu) tmp32 =tcg_temp_new_i32 ();/* fmove */ /* ??? TODO: Proper behavior on overflow. */ -switch ((ext >>10 ) &7 ) { -case 0 : - opsize =OS_LONG ; + + opsize =ext_opsize (ext,10 ); +switch (opsize) { +case OS_LONG :gen_helper_f64_to_i32 (tmp32, cpu_env, src);break ; -case 1 : - opsize =OS_SINGLE ; +case OS_SINGLE :gen_helper_f64_to_f32 (tmp32, cpu_env, src);break ; -case 4 : - opsize =OS_WORD ; +case OS_WORD :gen_helper_f64_to_i32 (tmp32, cpu_env, src);break ; -case 5 :/* OS_DOUBLE */ +case OS_DOUBLE :tcg_gen_mov_i32 (tmp32,AREG (insn,0 ));switch ((insn >>3 ) &7 ) {case 2 :
@@ -4153,8 +4167,7 @@ DISAS_INSN(fpu) }tcg_temp_free_i32 (tmp32);return ; -case 6 : - opsize =OS_BYTE ; +case OS_BYTE :gen_helper_f64_to_i32 (tmp32, cpu_env, src);break ;default :
@@ -4227,15 +4240,7 @@ DISAS_INSN(fpu) }if (ext & (1 <<14 )) {/* Source effective address. */ -switch ((ext >>10 ) &7 ) { -case 0 : opsize =OS_LONG ;break ; -case 1 : opsize =OS_SINGLE ;break ; -case 4 : opsize =OS_WORD ;break ; -case 5 : opsize =OS_DOUBLE ;break ; -case 6 : opsize =OS_BYTE ;break ; -default : - goto undef; - } + opsize =ext_opsize (ext,10 );if (opsize ==OS_DOUBLE ) { tmp32 =tcg_temp_new_i32 ();tcg_gen_mov_i32 (tmp32,AREG (insn,0 ));
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 3/4] target-m68k: move FPU helpers to fpu_helper.c
In reply to Laurent VivierMessage-Id: <[email protected]>
--- target/m68k/Makefile.objs | 2 +- target/m68k/fpu_helper.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++ target/m68k/helper.c | 88 ------------------------------------ 3 files changed, 113 insertions(+), 89 deletions(-) create mode 100644 target/m68k/fpu_helper.c
target/m68k/Makefile.objs +1 -1
@@ -1,3 +1,3 @@ obj-y += m68k-semi.o -obj-y += translate.o op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o fpu_helper.o obj-y += gdbstub.o
target/m68k/fpu_helper.c new file +112 -0
112 lines not on this page · raw message
target/m68k/helper.c +0 -88
94 lines not on this page · raw message
Signature · 1 line
2.9.4
Peter Maydell
AppliedQuoted 14 lines · Laurent Vivier
The following changes since commit
3f0602927b120a480b35dcf58cf6f95435b3ae91:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170613' into staging (2017-06-13 15:49:07 +0100)
are available in the git repository at:
git://github.com/vivier/qemu-m68k.gittags/m68k-for-2.10-pull-requestfor you to fetch changes up to
69e698220f68a17ce9584b068f68ed09e527a6ad:target-m68k: define
ext_opsize(2017-06-15 09:16:38 +0200)----------------------------------------------------------------
Quoted 7 lines
----------------------------------------------------------------
Laurent Vivier (4):
target/m68k: fix V flag forCC_OP_SUBx
softfloat: define 680x0 specific values
target-m68k: move FPU helpers tofpu_helper.c
target-m68k: defineext_opsize
Applied, thanks.
-- PMM