mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
sim: bfin: tweak saturation handling with TFU/FU modes and MM bit
This too should have been squashed into an earlier change. It covers a few more cases in the V/VS saturation patch when working with TFU and FU modes of dsp insns. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2011-06-18 Robin Getz <robin.getz@analog.com>
|
||||||
|
|
||||||
|
* bfin-sim.c (decode_macfunc): Handle MM when mmod is M_TFU.
|
||||||
|
Check MM once when mmod is M_FU to match M_TFU better.
|
||||||
|
|
||||||
2011-06-18 Robin Getz <robin.getz@analog.com>
|
2011-06-18 Robin Getz <robin.getz@analog.com>
|
||||||
|
|
||||||
* bfin-sim.c (decode_dsp32shiftimm_0): When shift is greater than
|
* bfin-sim.c (decode_dsp32shiftimm_0): When shift is greater than
|
||||||
|
@ -1617,10 +1617,20 @@ decode_macfunc (SIM_CPU *cpu, int which, int op, int h0, int h1, int src0,
|
|||||||
acc = 0x7fffffffffull, sat = 1;
|
acc = 0x7fffffffffull, sat = 1;
|
||||||
break;
|
break;
|
||||||
case M_TFU:
|
case M_TFU:
|
||||||
if (!MM && (bs64)acc < 0)
|
if (MM)
|
||||||
|
{
|
||||||
|
if ((bs64)acc < -((bs64)1 << 39))
|
||||||
|
acc = -((bu64)1 << 39), sat = 1;
|
||||||
|
if ((bs64)acc > 0x7FFFFFFFFFll)
|
||||||
|
acc = 0x7FFFFFFFFFull, sat = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((bs64)acc < 0)
|
||||||
acc = 0, sat = 1;
|
acc = 0, sat = 1;
|
||||||
if (!MM && (bs64)acc > 0xFFFFFFFFFFull)
|
if ((bs64)acc > 0xFFFFFFFFFFull)
|
||||||
acc = 0xFFFFFFFFFFull, sat = 1;
|
acc = 0xFFFFFFFFFFull, sat = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case M_IU:
|
case M_IU:
|
||||||
if (!MM && acc & 0x8000000000000000ull)
|
if (!MM && acc & 0x8000000000000000ull)
|
||||||
@ -1633,16 +1643,22 @@ decode_macfunc (SIM_CPU *cpu, int which, int op, int h0, int h1, int src0,
|
|||||||
acc |= 0xffffff0000000000ull;
|
acc |= 0xffffff0000000000ull;
|
||||||
break;
|
break;
|
||||||
case M_FU:
|
case M_FU:
|
||||||
if (!MM && (bs64)acc < 0)
|
if (MM)
|
||||||
acc = 0x0, sat = 1;
|
{
|
||||||
if (MM && (bs64)acc < -((bs64)1 << 39))
|
if ((bs64)acc < -((bs64)1 << 39))
|
||||||
acc = -((bu64)1 << 39), sat = 1;
|
acc = -((bu64)1 << 39), sat = 1;
|
||||||
if (!MM && (bs64)acc > (bs64)0xFFFFFFFFFFll)
|
if ((bs64)acc > 0x7FFFFFFFFFll)
|
||||||
acc = 0xFFFFFFFFFFull, sat = 1;
|
acc = 0x7FFFFFFFFFull, sat = 1;
|
||||||
if (MM && acc > 0xFFFFFFFFFFull)
|
else if (acc & 0x8000000000ull)
|
||||||
acc &= 0xFFFFFFFFFFull;
|
|
||||||
if (MM && acc & 0x8000000000ull)
|
|
||||||
acc |= 0xffffff0000000000ull;
|
acc |= 0xffffff0000000000ull;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((bs64)acc < 0)
|
||||||
|
acc = 0x0, sat = 1;
|
||||||
|
else if ((bs64)acc > (bs64)0xFFFFFFFFFFll)
|
||||||
|
acc = 0xFFFFFFFFFFull, sat = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case M_IH:
|
case M_IH:
|
||||||
if ((bs64)acc < -0x80000000ll)
|
if ((bs64)acc < -0x80000000ll)
|
||||||
|
Reference in New Issue
Block a user