*p++ = 0x6B;
p = doAMode_R(p, i->Xin.Alu32R.dst, i->Xin.Alu32R.dst);
*p++ = 0xFF & i->Xin.Alu32R.src->Xrmi.Imm.imm32;
- goto done;
} else {
- goto bad;
+ *p++ = 0x69;
+ p = doAMode_R(p, i->Xin.Alu32R.dst, i->Xin.Alu32R.dst);
+ p = emit32(p, i->Xin.Alu32R.src->Xrmi.Imm.imm32);
}
+ goto done;
default:
goto bad;
}
static IRExpr* fold_Expr ( IRExpr* e )
{
+ Int shift;
IRExpr* e2 = e; /* e2 is the result of folding e, if possible */
/* UNARY ops */
| e->Iex.Binop.arg2->Iex.Const.con->Ico.U32)));
break;
case Iop_Shl32:
- e2 = IRExpr_Const(IRConst_U32(
- (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
- << e->Iex.Binop.arg2->Iex.Const.con->Ico.U32)));
+ shift = (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U32);
+ if (shift >= 0 && shift <= 31)
+ e2 = IRExpr_Const(IRConst_U32(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
+ << shift)));
+ break;
+ case Iop_Sar32: {
+ /* paranoid ... */
+ /*signed*/ Int s32;
+ s32 = (Int)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32);
+ shift = (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U32);
+ if (shift >= 0 && shift <= 31) {
+ s32 >>=/*signed*/ shift;
+ e2 = IRExpr_Const(IRConst_U32((UInt)s32));
+ }
break;
+ }
case Iop_CmpEQ32:
e2 = IRExpr_Const(IRConst_Bit(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32