aboutsummaryrefslogtreecommitdiff
path: root/sim/mips
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-09-20 19:49:49 +0000
committerIan Lance Taylor <ian@airs.com>1996-09-20 19:49:49 +0000
commit149ee67274766a0a56a671ec2c35b556b5fdb4ae (patch)
treed940ea0a60056b234a3b076fbc7fccc7a07295c8 /sim/mips
parente12ab364d210b4e6418145ae2457b2d4f7e65a21 (diff)
downloadgdb-149ee67274766a0a56a671ec2c35b556b5fdb4ae.zip
gdb-149ee67274766a0a56a671ec2c35b556b5fdb4ae.tar.gz
gdb-149ee67274766a0a56a671ec2c35b556b5fdb4ae.tar.bz2
* gencode.c (process_instructions): Call build_endian_shift when
expanding STORE RIGHT, to fix swr. * support.h (SIGNEXTEND): If the sign bit is not set, explicitly clear the high bits. * interp.c (Convert): Fix fmt_single to fmt_long to not truncate. Fix float to int conversions to produce signed values.
Diffstat (limited to 'sim/mips')
-rw-r--r--sim/mips/gencode.c1
-rw-r--r--sim/mips/support.h5
2 files changed, 5 insertions, 1 deletions
diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c
index ff27ef6..dce648a 100644
--- a/sim/mips/gencode.c
+++ b/sim/mips/gencode.c
@@ -1530,6 +1530,7 @@ process_instructions(doarch,features)
printf(" GPR[destreg] = SIGNEXTEND(GPR[destreg],32);\n");
} else { /* store */
printf(" memval = (op2 << (byte * 8));\n");
+ build_endian_shift(proc64,datalen,2,s_left,32);
printf(" StoreMemory(uncached,(%s - byte),memval,paddr,vaddr,isREAL);\n",accesslength);
}
}
diff --git a/sim/mips/support.h b/sim/mips/support.h
index b9bf0dd..11f285c 100644
--- a/sim/mips/support.h
+++ b/sim/mips/support.h
@@ -48,7 +48,10 @@ typedef unsigned long long uword64;
/* Sign-extend the given value (e) as a value (b) bits long. We cannot
assume the HI32bits of the operand are zero, so we must perform a
mask to ensure we can use the simple subtraction to sign-extend. */
-#define SIGNEXTEND(e,b) (((e) & ((uword64)1 << ((b) - 1))) ? (((e) & (((uword64)1 << (b)) - 1)) - ((uword64)1 << (b))) : (e))
+#define SIGNEXTEND(e,b) \
+ (((e) & ((uword64) 1 << ((b) - 1))) \
+ ? (((e) & (((uword64) 1 << (b)) - 1)) - ((uword64)1 << (b))) \
+ : ((e) & (((((uword64) 1 << ((b) - 1)) - 1) << 1) | 1)))
/* Check if a value will fit within a word (unsigned int): */
#define NOTWORDVALUE(v) ((((((uword64)(v)>>32) == 0) && !((v) & ((unsigned)1 << 31))) || ((((uword64)(v)>>32) == 0xFFFFFFFF) && ((v) & ((unsigned)1 << 31)))) ? (1 == 0) : (1 == 1))