sim: bfin: fix sign extension in dsp insns with MM flag
[deliverable/binutils-gdb.git] / sim / bfin / bfin-sim.c
index 5b8d601d7d681bd8370ab28216e6c4f33758e623..017ddcad5121850d13b9576bc60c6d9b93964590 100644 (file)
@@ -1380,8 +1380,8 @@ decode_multfunc (SIM_CPU *cpu, int h0, int h1, int src0, int src1, int mmod,
     }
   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)
@@ -1579,16 +1579,11 @@ decode_macfunc (SIM_CPU *cpu, int which, int op, int h0, int h1, int src0,
   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;
This page took 0.023867 seconds and 4 git commands to generate.