diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-18 19:42:55 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-06-18 19:42:55 +0000 |
commit | ef26d60eba5736240c27c545e275667bb4b0fbd1 (patch) | |
tree | 1964dea48acfb2df2639d14cb5cb8fd8b8b62f5b /sim | |
parent | 075a845a9281b4bdef459b6494a7db3bf666b911 (diff) | |
download | gdb-ef26d60eba5736240c27c545e275667bb4b0fbd1.zip gdb-ef26d60eba5736240c27c545e275667bb4b0fbd1.tar.gz gdb-ef26d60eba5736240c27c545e275667bb4b0fbd1.tar.bz2 |
sim: bfin: fix sign extension in dsp insns with MM flag
After testing the hardware with all the different dsp flags, the MM flag
triggers sign extension in all modes. So drop the limited use of it, and
the local custom helper that was also extending unsigned values. We also
can see that the flag checks in the mult/mac insns have the same behavior
with sign extending, so add a helper func to keep the logic the same in
both places.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r-- | sim/bfin/ChangeLog | 7 | ||||
-rw-r--r-- | sim/bfin/bfin-sim.c | 11 |
2 files changed, 10 insertions, 8 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog index 72bd358..52b75ee 100644 --- a/sim/bfin/ChangeLog +++ b/sim/bfin/ChangeLog @@ -1,5 +1,12 @@ 2011-06-18 Robin Getz <robin.getz@analog.com> + * bfin-sim.c (decode_multfunc): Call new is_macmod_signed, and + allow MM to sign extend all the time. + (decode_macfunc): Likewise. Drop sign extension of unsigned + values. + +2011-06-18 Robin Getz <robin.getz@analog.com> + * bfin-sim.c (extract_mult): When mmod is M_IH, change the order from round/saturate to saturate/round/saturate. diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c index 5b8d601..017ddca 100644 --- a/sim/bfin/bfin-sim.c +++ b/sim/bfin/bfin-sim.c @@ -1380,8 +1380,8 @@ decode_multfunc (SIM_CPU *cpu, int h0, int h1, int src0, int src1, int mmod, } val1 = val; - if (mmod == 0 || mmod == M_IS || mmod == M_T || mmod == M_S2RND - || mmod == M_ISS2 || mmod == M_IH || (MM && mmod == M_FU)) + /* In signed modes, sign extend. */ + if (is_macmod_signed (mmod) || MM) val1 |= -(val1 & 0x80000000); if (*psat) @@ -1579,16 +1579,11 @@ decode_macfunc (SIM_CPU *cpu, int which, int op, int h0, int h1, int src0, bu32 sat = 0, tsat, ret; /* Sign extend accumulator if necessary, otherwise unsigned. */ - if (mmod == 0 || mmod == M_T || mmod == M_IS || mmod == M_ISS2 - || mmod == M_S2RND || mmod == M_IH || mmod == M_W32) + if (is_macmod_signed (mmod) || MM) acc = get_extended_acc (cpu, which); else acc = get_unextended_acc (cpu, which); - if (MM && (mmod == M_T || mmod == M_IS || mmod == M_ISS2 - || mmod == M_S2RND || mmod == M_IH || mmod == M_W32)) - acc |= -(acc & 0x80000000); - if (op != 3) { bu8 sgn0 = (acc >> 31) & 1; |