}
/* -- Shl -- */
+ case Iop_Shl8:
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7)
+ e2 = IRExpr_Const(IRConst_U8(toUChar(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ << shift))));
+ break;
+ case Iop_Shl16:
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15)
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ << shift))));
+ break;
case Iop_Shl32:
vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
shift = (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U8);
break;
/* -- Sar -- */
+ case Iop_Sar8: {
+ Int s8;
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ s8 = (Char)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7) {
+ s8 >>=/*signed*/ shift;
+ e2 = IRExpr_Const(IRConst_U8(toUChar(s8)));
+ }
+ break;
+ }
+ case Iop_Sar16: {
+ Int s16;
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ s16 = (Short)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U16);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15) {
+ s16 >>=/*signed*/ shift;
+ e2 = IRExpr_Const(IRConst_U16(toUShort(s16)));
+ }
+ break;
+ }
case Iop_Sar32: {
/* paranoid ... */
/*signed*/ Int s32;
}
/* -- Shr -- */
+ case Iop_Shr8: {
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7)
+ e2 = IRExpr_Const(IRConst_U8(toUChar(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ >> shift))));
+ break;
+ }
+ case Iop_Shr16: {
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15)
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ >> shift))));
+ break;
+ }
case Iop_Shr32: {
/* paranoid ... */
/*unsigned*/ UInt u32;
// { OPNAME(ModU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
// { OPNAME(ModS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
-// { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet
-// { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet
+ { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 },
{ OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 },
{ OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8 },
-// { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet
-// { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet
+ { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 },
{ OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 },
{ OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8 },
-// { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet
-// { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet
+ { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 },
{ OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 },
{ OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8 },