summaryrefslogtreecommitdiff
path: root/sim/common/sim-alu.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-10-14 09:39:05 +0000
committerAndrew Cagney <cagney@redhat.com>1997-10-14 09:39:05 +0000
commit7456a10d9b80ae68b7df7a9e801b076acdb58fb2 (patch)
tree40ffc9b6c1cfacd59e03781ecae074de1a37c08b /sim/common/sim-alu.h
parent055ee2977fb1d20d8db53f48a62fcec279458631 (diff)
downloadbinutils-gdb-7456a10d9b80ae68b7df7a9e801b076acdb58fb2.tar.gz
* sim-alu.h (ALU64_HAD_OVERFLOW): Define.
(ALU64_SUB): Define. * Make-common.in (all): Build SIM_EXTRA_ALL first. (.gdbinit): Remove dependencies, generate once per build.
Diffstat (limited to 'sim/common/sim-alu.h')
-rw-r--r--sim/common/sim-alu.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/sim/common/sim-alu.h b/sim/common/sim-alu.h
index 46306c9eb74..98bbfd288a5 100644
--- a/sim/common/sim-alu.h
+++ b/sim/common/sim-alu.h
@@ -132,7 +132,7 @@ do { \
#define ALU64_ADD(VAL) \
do { \
unsigned64 val = (VAL); \
- unsigned64 alu_lo = alu_val + val); \
+ unsigned64 alu_lo = alu_val + val; \
signed alu_carry = ((alu_lo & LSBIT64 (31)) != 0); \
alu_carry_val = (alu_carry_val \
+ MSEXTRACTED64 (val, 0, 31) \
@@ -186,7 +186,8 @@ do { \
#define ALU64_SUB(VAL) \
do { \
- error("ALU_SUB64"); \
+ signed64 subval = -(VAL); /* -MININT? */ \
+ ALU64_ADD (subval); \
} while (0)
#define ALU_SUB(VAL) XCONCAT3(ALU,WITH_TARGET_WORD_BITSIZE,_SUB)(VAL)
@@ -334,11 +335,15 @@ do { \
(!(alu_overflow_val & MSBIT32 (0)) != !(alu_overflow_val & MSBIT32 (16)))
#define ALU32_HAD_OVERFLOW \
- ((((unsigned64)(alu_overflow_val & BIT64(0))) >> 32) \
- != (alu_overflow_val & MSBIT64(32)))
+ ((((unsigned64)(alu_overflow_val & MSBIT64(0))) >> 32) \
+ != (unsigned64)(alu_overflow_val & MSBIT64(32)))
+
+#define ALU64_HAD_OVERFLOW \
+ ((alu_val & MSBIT64 (0)) != (alu_overflow_val & MSBIT64 (0)))
#define ALU_HAD_OVERFLOW XCONCAT3(ALU,WITH_TARGET_WORD_BITSIZE,_HAD_OVERFLOW)
+
/* carry found in bit before sign */
#define ALU16_HAD_CARRY \