aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2008-02-04 17:26:07 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2008-02-04 17:26:07 +0000
commitf3876f690925c2febc6964e43e5646fd3bd0b954 (patch)
tree890eada9fd354057518d6e49e8e37431535ca5d3
parentc39c82565f3bf5a918aebbe329f66622e941e027 (diff)
downloadgdb-f3876f690925c2febc6964e43e5646fd3bd0b954.zip
gdb-f3876f690925c2febc6964e43e5646fd3bd0b954.tar.gz
gdb-f3876f690925c2febc6964e43e5646fd3bd0b954.tar.bz2
2008-02-04 Antony King <antony.king@st.com>
* interp.c (macl): Fix non-portable implementation.
-rw-r--r--sim/sh/ChangeLog4
-rw-r--r--sim/sh/interp.c21
2 files changed, 12 insertions, 13 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index e06e764..8a3d88a 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-04 Antony King <antony.king@st.com>
+
+ * interp.c (macl): Fix non-portable implementation.
+
2007-10-08 Andrew Stubbs <andrew.stubbs@st.com>
* gencode.c (tab): Add RAISE_EXCEPTION_IF_IN_DELAY_SLOT to the
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index d89b0dc..a2472ad 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -1429,14 +1429,9 @@ macl (regs, memory, n, m)
int m, n;
{
long tempm, tempn;
- long prod, macl, mach, sum;
- long long ans,ansl,ansh,t;
- unsigned long long high,low,combine;
- union mac64
- {
- long m[2]; /* mach and macl*/
- long long m64; /* 64 bit MAC */
- }mac64;
+ long macl, mach;
+ long long ans;
+ long long mac64;
tempm = RSLAT (regs[m]);
regs[m] += 4;
@@ -1447,15 +1442,15 @@ macl (regs, memory, n, m)
mach = MACH;
macl = MACL;
- mac64.m[0] = macl;
- mac64.m[1] = mach;
+ mac64 = ((long long) macl & 0xffffffff) |
+ ((long long) mach & 0xffffffff) << 32;
ans = (long long) tempm * (long long) tempn; /* Multiply 32bit * 32bit */
- mac64.m64 += ans; /* Accumulate 64bit + 64 bit */
+ mac64 += ans; /* Accumulate 64bit + 64 bit */
- macl = mac64.m[0];
- mach = mac64.m[1];
+ macl = (long) (mac64 & 0xffffffff);
+ mach = (long) ((mac64 >> 32) & 0xffffffff);
if (S) /* Store only 48 bits of the result */
{