aboutsummaryrefslogtreecommitdiff
path: root/sim/bfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-10-11 03:32:11 -0400
committerMike Frysinger <vapier@gentoo.org>2015-10-11 03:42:09 -0400
commit3f946aa82518e878aea2cba4b6a9bcc651412c5c (patch)
treefa0d5180ab294f40a2cd5ceef6458b1b783b12ea /sim/bfin
parent5fde150fede436dd250706d3fb1786c590e04b26 (diff)
downloadbinutils-3f946aa82518e878aea2cba4b6a9bcc651412c5c.zip
binutils-3f946aa82518e878aea2cba4b6a9bcc651412c5c.tar.gz
binutils-3f946aa82518e878aea2cba4b6a9bcc651412c5c.tar.bz2
sim: bfin: handle negative left saturated shifts as ashifts [BZ #18407]
When handling left saturated ashifts with negative immediates, they should be treated as right ashifts. This matches hardware behavior. Reported-by: Igor Rayak <igorr@gitatechnologies.com>
Diffstat (limited to 'sim/bfin')
-rw-r--r--sim/bfin/ChangeLog6
-rw-r--r--sim/bfin/bfin-sim.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index d0e91b3..2e62a74 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-11 Mike Frysinger <vapier@gentoo.org>
+
+ PR sim/18407
+ * bfin-sim.c (decode_dsp32shiftimm_0): Call ashiftrt when count
+ is less than 0.
+
2015-06-24 Mike Frysinger <vapier@gentoo.org>
* interp.c (trace_register): Delete.
diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c
index 8b19ead..b6acb4e 100644
--- a/sim/bfin/bfin-sim.c
+++ b/sim/bfin/bfin-sim.c
@@ -6083,7 +6083,11 @@ decode_dsp32shiftimm_0 (SIM_CPU *cpu, bu16 iw0, bu16 iw1)
int count = imm6 (immag);
TRACE_INSN (cpu, "R%i = R%i << %i (S);", dst0, src1, count);
- STORE (DREG (dst0), lshift (cpu, DREG (src1), count, 32, 1, 1));
+
+ if (count < 0)
+ STORE (DREG (dst0), ashiftrt (cpu, DREG (src1), -count, 32));
+ else
+ STORE (DREG (dst0), lshift (cpu, DREG (src1), count, 32, 1, 1));
}
else if (sop == 2 && sopcde == 2)
{