提交 ff8263a9 编写于 作者: B bellard

ARM saturating arithmetic fixes (Paul Brook)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1431 c046a42c-6fe2-441c-8c8c-71466251a162
上级 04d81be8
...@@ -805,6 +805,23 @@ void OPPROTO op_subl_T0_T1_saturate(void) ...@@ -805,6 +805,23 @@ void OPPROTO op_subl_T0_T1_saturate(void)
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_double_T1_saturate(void)
{
int32_t val;
val = T1;
if (val >= 0x40000000) {
T1 = 0x7fffffff;
env->QF = 1;
} else if (val <= (int32_t)0xc0000000) {
T1 = 0x80000000;
env->QF = 1;
} else {
T1 = val << 1;
}
FORCE_RET();
}
/* thumb shift by immediate */ /* thumb shift by immediate */
void OPPROTO op_shll_T0_im_thumb(void) void OPPROTO op_shll_T0_im_thumb(void)
{ {
......
...@@ -1019,20 +1019,15 @@ static void disas_arm_insn(CPUState * env, DisasContext *s) ...@@ -1019,20 +1019,15 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
case 0x5: /* saturating add/subtract */ case 0x5: /* saturating add/subtract */
rd = (insn >> 12) & 0xf; rd = (insn >> 12) & 0xf;
rn = (insn >> 16) & 0xf; rn = (insn >> 16) & 0xf;
gen_movl_T0_reg(s, rn); gen_movl_T0_reg(s, rm);
if (op1 & 2) {
gen_movl_T1_reg(s, rn); gen_movl_T1_reg(s, rn);
if (op1 & 2)
gen_op_double_T1_saturate();
if (op1 & 1) if (op1 & 1)
gen_op_subl_T0_T1_saturate(); gen_op_subl_T0_T1_saturate();
else else
gen_op_addl_T0_T1_saturate(); gen_op_addl_T0_T1_saturate();
} gen_movl_reg_T0(s, rd);
gen_movl_T1_reg(s, rm);
if (op1 & 1)
gen_op_subl_T0_T1_saturate();
else
gen_op_addl_T0_T1_saturate();
gen_movl_reg_T0(s, rn);
break; break;
case 0x8: /* signed multiply */ case 0x8: /* signed multiply */
case 0xa: case 0xa:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册