diff options
author | Michael Snyder <msnyder@vmware.com> | 2003-08-11 19:28:05 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2003-08-11 19:28:05 +0000 |
commit | d1789acece69deabeddae520341aa828d5a96c7f (patch) | |
tree | fbdf96d7dbb1c2453cf149d57415fde69764c971 /sim/sh/interp.c | |
parent | b246147cd381994da11d762f3e204a97ec00ef9a (diff) | |
download | gdb-d1789acece69deabeddae520341aa828d5a96c7f.zip gdb-d1789acece69deabeddae520341aa828d5a96c7f.tar.gz gdb-d1789acece69deabeddae520341aa828d5a96c7f.tar.bz2 |
2003-08-11 Shrinivas Atre <shrinivasa@KPITCummins.com>
* sim/sh/gencode.c ( tab[] ): Addition of MAC.L handler and
correction for MAC.W handler
* sim/sh/interp.c ( macl ): New Function. Implementation of
MAC.L handler.
Diffstat (limited to 'sim/sh/interp.c')
-rw-r--r-- | sim/sh/interp.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 887b7a6..91899f4 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -169,6 +169,7 @@ static char **prog_argv; #if 1 static int maskw = 0; +static int maskl = 0; #endif static SIM_OPEN_KIND sim_kind; @@ -651,6 +652,7 @@ rbat_fast (memory, x, maskb) #define RUWAT(x) (RWAT(x) & 0xffff) #define RSWAT(x) ((short)(RWAT(x))) +#define RSLAT(x) ((long)(RLAT(x))) #define RSBAT(x) (SEXT(RBAT(x))) #define RDAT(x, n) (do_rdat (memory, (x), (n), (maskl))) @@ -1348,6 +1350,56 @@ macw (regs, memory, n, m, endianw) MACL = sum; } +static void +macl (regs, memory, n, m) + int *regs; + unsigned char *memory; + 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; + + tempm = RSLAT(regs[m]); + regs[m] += 4; + + tempn = RSLAT(regs[n]); + regs[n] += 4; + + mach = MACH; + macl = MACL; + + mac64.m[0] = macl; + mac64.m[1] = mach; + + ans = (long long)tempm * (long long)tempn; /* Multiply 32bit * 32bit */ + + mac64.m64 += ans; /* Accumulate 64bit + 64 bit */ + + macl = mac64.m[0]; + mach = mac64.m[1]; + + if (S) /* Store only 48 bits of the result */ + { + if (mach < 0) /* Result is negative */ + { + mach = mach & 0x0000ffff; /* Mask higher 16 bits */ + mach |= 0xffff8000; /* Sign extend higher 16 bits */ + } + else + mach = mach & 0x00007fff; /* Postive Result */ + } + + MACL = macl; + MACH = mach; +} + static struct loop_bounds get_loop_bounds (rs, re, memory, mem_end, maskw, endianw) int rs, re; |