+2011-06-18 Robin Getz <robin.getz@analog.com>
+
+ * bfin.h (is_macmod_signed): New func
+
2011-06-18 Mike Frysinger <vapier@gentoo.org>
* bfin.h (is_macmod_pmove): Add missing space before func args.
|| (x == M_TFU) || (x == M_S2RND) || (x == M_ISS2) || (x == M_IH);
}
+static inline int is_macmod_signed (int x)
+{
+ return (x == 0) || (x == M_IS) || (x == M_T) || (x == M_S2RND)
+ || (x == M_ISS2) || (x == M_IH) || (x == M_W32);
+}
+
/* dsp32mac
+----+----+---+---|---+----+----+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
+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
}
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)
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;