aboutsummaryrefslogtreecommitdiff
path: root/sim/mips/dsp.igen
diff options
context:
space:
mode:
authorChao-ying Fu <fu@mips.com>2006-05-15 20:34:18 +0000
committerChao-ying Fu <fu@mips.com>2006-05-15 20:34:18 +0000
commit69088b17068a002cfdad9aaa12a3e486b9f47f61 (patch)
treeb088e6287b1db877996114c83033376966ec35b0 /sim/mips/dsp.igen
parentb07969118378598261be761f87630385a7627879 (diff)
downloadgdb-69088b17068a002cfdad9aaa12a3e486b9f47f61.zip
gdb-69088b17068a002cfdad9aaa12a3e486b9f47f61.tar.gz
gdb-69088b17068a002cfdad9aaa12a3e486b9f47f61.tar.bz2
* dsp.igen (do_ph_shift, do_w_shra): Fix bugs for rounding instructions.
Diffstat (limited to 'sim/mips/dsp.igen')
-rw-r--r--sim/mips/dsp.igen14
1 files changed, 8 insertions, 6 deletions
diff --git a/sim/mips/dsp.igen b/sim/mips/dsp.igen
index 9c39b71..18aafcb 100644
--- a/sim/mips/dsp.igen
+++ b/sim/mips/dsp.igen
@@ -193,9 +193,10 @@
}
else // right
{
- if (sat == 1 && shift != 0)
- h0 += (1 << (shift - 1));
- h0 = h0 >> shift;
+ if (sat == 1 && shift != 0 && (h0 & (1 << (shift-1))))
+ h0 = (h0 >> shift) + 1;
+ else
+ h0 = h0 >> shift;
}
result |= ((unsigned32)((unsigned16)h0) << i);
@@ -246,9 +247,10 @@
{
unsigned32 result = GPR[rt];
signed32 h0 = (signed32)result;
- if (shift != 0)
- h0 += (1 << (shift - 1));
- h0 = h0 >> shift;
+ if (shift != 0 && (h0 & (1 << (shift-1))))
+ h0 = (h0 >> shift) + 1;
+ else
+ h0 = h0 >> shift;
GPR[rd] = EXTEND32 (h0);
}