aboutsummaryrefslogtreecommitdiff
path: root/sim/h8300
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1996-03-11 23:25:53 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1996-03-11 23:25:53 +0000
commit5d06fa80b20ad5cb5729eadc128b6ac970875eaf (patch)
treee41d706ac9b06d7fa359dcb0d9dad89de23719a5 /sim/h8300
parente10bb7b3e9548019333d30c527e0051db4514c92 (diff)
downloadgdb-5d06fa80b20ad5cb5729eadc128b6ac970875eaf.zip
gdb-5d06fa80b20ad5cb5729eadc128b6ac970875eaf.tar.gz
gdb-5d06fa80b20ad5cb5729eadc128b6ac970875eaf.tar.bz2
(sim_resume, shift insns): Fix setting of overflow flag for shal.
Diffstat (limited to 'sim/h8300')
-rw-r--r--sim/h8300/ChangeLog1
-rw-r--r--sim/h8300/compile.c25
2 files changed, 14 insertions, 12 deletions
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index d1c5fb9..b96f031 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -2,6 +2,7 @@ Mon Mar 11 09:53:25 1996 Doug Evans <dje@charmed.cygnus.com>
* 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 <signal.h>.
(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 7a2df63..2545b1d 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;