summaryrefslogtreecommitdiff
path: root/sim/h8300/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/h8300/compile.c')
-rw-r--r--sim/h8300/compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 7635655b3e5..3819fdd6929 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -818,7 +818,9 @@ decode (SIM_DESC sd, int addr, unsigned char *data, decoded_inst *dst)
(looking_for & SIZE) == L_16U)
{
cst[opnum] = (data[len / 2] << 8) + data[len / 2 + 1];
- if ((looking_for & SIZE) != L_16U)
+ /* Immediates are always unsigned. */
+ if ((looking_for & SIZE) != L_16U &&
+ (looking_for & MODE) != IMM)
cst[opnum] = (short) cst[opnum]; /* Sign extend. */
}
else if (looking_for & ABSJMP)