sim: bfin: handle the MM flag in M_IU/M_TFU modes with dsp insns
authorMike Frysinger <vapier@gentoo.org>
Sat, 18 Jun 2011 19:44:14 +0000 (19:44 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 18 Jun 2011 19:44:14 +0000 (19:44 +0000)
Our handling of the M_IU/M_TFU modes are missing signed saturation when
the MM flag is set, so add it to match the hardware behavior.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sim/bfin/ChangeLog
sim/bfin/bfin-sim.c

index 52b75ee6fa52a1699ba3e362f858c184557f9c38..4c3692f995f4048cd0d6e0afac2570a46d04b8f5 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-18  Robin Getz  <robin.getz@analog.com>
+
+       * bfin-sim.c (extract_mult): Call saturate_s32 when MM is set
+       and mmod is M_IU.  Call saturate_s16 when MM is set and mmod
+       is M_TFU.
+
 2011-06-18  Robin Getz  <robin.getz@analog.com>
 
        * bfin-sim.c (decode_multfunc): Call new is_macmod_signed, and
index 017ddcad5121850d13b9576bc60c6d9b93964590..71fda3e1ea1450cdb9dfa403dbd0ed166e751877 100644 (file)
@@ -1516,6 +1516,8 @@ extract_mult (SIM_CPU *cpu, bu64 res, int mmod, int MM,
       case M_IS:
        return saturate_s32 (res, overflow);
       case M_IU:
+       if (MM)
+         return saturate_s32 (res, overflow);
        return saturate_u32 (res, overflow);
       case M_FU:
        if (MM)
@@ -1559,6 +1561,8 @@ extract_mult (SIM_CPU *cpu, bu64 res, int mmod, int MM,
       case M_T:
        return saturate_s16 (trunc16 (res), overflow);
       case M_TFU:
+       if (MM)
+         return saturate_s16 (trunc16 (res), overflow);
        return saturate_u16 (trunc16 (res), overflow);
 
       case M_S2RND:
This page took 0.03034 seconds and 4 git commands to generate.