From 5d06fa80b20ad5cb5729eadc128b6ac970875eaf Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Mon, 11 Mar 1996 23:25:53 +0000 Subject: [PATCH] (sim_resume, shift insns): Fix setting of overflow flag for shal. --- sim/h8300/ChangeLog | 1 + sim/h8300/compile.c | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index d1c5fb90472..b96f0318647 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -2,6 +2,7 @@ Mon Mar 11 09:53:25 1996 Doug Evans * compile.c: #include "wait.h". (sim_resume, sleep insn): Check program exit status in r0. + (sim_resume, shift insns): Fix setting of overflow flag for shal. * run.c: #include . (main): Abort if program got SIGILL. Print error message if argument is invalid. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 7a2df633c09..2545b1db7eb 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -1171,32 +1171,38 @@ sim_resume (step, siggnal) printf ("%c", cpu.regs[2]); goto next; - OSHIFTS (O_NOT, rd = ~rd); - OSHIFTS (O_SHLL, c = rd & hm; + OSHIFTS (O_NOT, rd = ~rd; v = 0;); + OSHIFTS (O_SHLL, c = rd & hm; v = 0; rd <<= 1); - OSHIFTS (O_SHLR, c = rd & 1; + OSHIFTS (O_SHLR, c = rd & 1; v = 0; rd = (unsigned int) rd >> 1); OSHIFTS (O_SHAL, c = rd & hm; + v = (rd & hm) != ((rd & (hm >> 1)) << 1); rd <<= 1); OSHIFTS (O_SHAR, t = rd & hm; c = rd & 1; + v = 0; rd >>= 1; rd |= t; ); OSHIFTS (O_ROTL, c = rd & hm; + v = 0; rd <<= 1; rd |= C); OSHIFTS (O_ROTR, c = rd & 1; + v = 0; rd = (unsigned int) rd >> 1; if (c) rd |= hm;); OSHIFTS (O_ROTXL, t = rd & hm; rd <<= 1; rd |= C; c = t; + v = 0; ); OSHIFTS (O_ROTXR, t = rd & 1; rd = (unsigned int) rd >> 1; - if (C) rd |= hm; c = t;); + if (C) rd |= hm; c = t; + v = 0;); case O (O_JMP, SB): { @@ -1433,27 +1439,22 @@ sim_resume (step, siggnal) shift8: - /* Set flags after an 8 bit shift op, carry set in insn */ + /* Set flags after an 8 bit shift op, carry,overflow set in insn */ n = (rd & 0x80); - v = 0; nz = rd & 0xff; SET_B_REG (code->src.reg, rd); goto next; - shift16: - /* Set flags after an 16 bit shift op, carry set in insn */ + /* Set flags after an 16 bit shift op, carry,overflow set in insn */ n = (rd & 0x8000); - v = 0; nz = rd & 0xffff; - SET_W_REG (code->src.reg, rd); goto next; shift32: - /* Set flags after an 32 bit shift op, carry set in insn */ + /* Set flags after an 32 bit shift op, carry,overflow set in insn */ n = (rd & 0x80000000); - v = 0; nz = rd & 0xffffffff; SET_L_REG (code->src.reg, rd); goto next; -- 2.30.2