aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-alu.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-05 00:30:38 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-05 00:30:38 +0000
commit30efae3acdacbd3239bd7385a5b535abf5ed23e9 (patch)
tree4e7757304f2588b575f205ab3600c3fd05307af2 /sim/common/sim-alu.h
parentc142a1f507edd58eaa3aa708baaf7ca49a5cf031 (diff)
downloadfsf-binutils-gdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.zip
fsf-binutils-gdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.tar.gz
fsf-binutils-gdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.tar.bz2
Define SIGNED64 and UNSIGNED64 macros - handle MSC/GCC LL issue.
Diffstat (limited to 'sim/common/sim-alu.h')
-rw-r--r--sim/common/sim-alu.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/sim/common/sim-alu.h b/sim/common/sim-alu.h
index 6bb35f0..46306c9 100644
--- a/sim/common/sim-alu.h
+++ b/sim/common/sim-alu.h
@@ -62,11 +62,6 @@
values */
-/* Macro's to type cast 32bit constants to 64bits */
-#define SIGNED64(val) ((signed64)(signed32)(val))
-#define UNSIGNED64(val) ((unsigned64)(unsigned32)(val))
-
-
/* Start a section of ALU code */
#define ALU16_BEGIN(VAL) \
@@ -82,6 +77,14 @@
signed64 alu_overflow_val; \
ALU32_SET(VAL)
+#define ALU64_BEGIN(VAL) \
+{ \
+ natural64 alu_val; \
+ unsigned64 alu_carry_val; \
+ signed64 alu_overflow_val; \
+ ALU64_SET(VAL)
+
+
#define ALU_BEGIN(VAL) XCONCAT3(ALU,WITH_TARGET_WORD_BITSIZE,_BEGIN)(VAL)
/* More basic alu operations */
@@ -128,14 +131,14 @@ do { \
#define ALU64_ADD(VAL) \
do { \
- unsigned64 alu_lo = (UNSIGNED64(alu_val) \
- + UNSIGNED64(VAL)); \
- signed alu_carry = ((alu_lo & BIT(31)) != 0); \
+ unsigned64 val = (VAL); \
+ unsigned64 alu_lo = alu_val + val); \
+ signed alu_carry = ((alu_lo & LSBIT64 (31)) != 0); \
alu_carry_val = (alu_carry_val \
- + UNSIGNED64(EXTRACTED(val, 0, 31)) \
+ + MSEXTRACTED64 (val, 0, 31) \
+ alu_carry); \
alu_overflow_val = (alu_overflow_val \
- + SIGNED64(EXTRACTED(val, 0, 31)) \
+ + MSEXTRACTED64 (val, 0, 31) \
+ alu_carry); \
alu_val = alu_val + val; \
} while (0)