diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-18 17:27:01 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-06-18 17:27:01 +0000 |
commit | 73aae8efb21ca7ff1c792fe4d2c394eecc346958 (patch) | |
tree | 355ab6e40228049339c35bbf5abdd5f57c9da067 /sim | |
parent | 886ea33b698889a48276ee7d5faf4c3ba26c9c0b (diff) | |
download | binutils-gdb-73aae8efb21ca7ff1c792fe4d2c394eecc346958.tar.gz |
sim: bfin: fix accumulator edge case saturation
When the accumulator saturates, it needs to be greater than, but not
equal to, the largest unsigned value as this is what the hardware does.
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 | 5 | ||||
-rw-r--r-- | sim/bfin/bfin-sim.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog index 5aab1171afe..75de6f4db4f 100644 --- a/sim/bfin/ChangeLog +++ b/sim/bfin/ChangeLog @@ -1,3 +1,8 @@ +2011-06-18 Robin Getz <robin.getz@analog.com> + + * bfin-sim.c (saturate_s40_astat): Change ">" to ">=". + (decode_macfunc): Likewise when mmod is M_IH. + 2011-06-18 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_create_inferior): Change free to freeargv. diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c index 1cdfd27a352..31136a0660b 100644 --- a/sim/bfin/bfin-sim.c +++ b/sim/bfin/bfin-sim.c @@ -1398,7 +1398,7 @@ saturate_s40_astat (bu64 val, bu32 *v) *v = 1; return -((bs64)1 << 39); } - else if ((bs64)val >= ((bs64)1 << 39) - 1) + else if ((bs64)val > ((bs64)1 << 39) - 1) { *v = 1; return ((bu64)1 << 39) - 1; @@ -1645,7 +1645,7 @@ decode_macfunc (SIM_CPU *cpu, int which, int op, int h0, int h1, int src0, case M_IH: if ((bs64)acc < -0x80000000ll) acc = -0x80000000ull, sat = 1; - else if ((bs64)acc >= 0x7fffffffll) + else if ((bs64)acc > 0x7fffffffll) acc = 0x7fffffffull, sat = 1; break; case M_W32: |