if (! condition) goto next_instruction;
goto computed_target;
-
- This inversion is being handled at code generation time. So we just
- take the condition here as is.
*/
static void
-if_not_condition_goto_computed(IRExpr *condition, IRExpr *target)
+if_condition_goto_computed(IRExpr *condition, IRExpr *target)
{
vassert(typeOfIRExpr(irsb->tyenv, condition) == Ity_I1);
+ condition = unop(Iop_Not1, condition);
+
stmt(IRStmt_Exit(condition, Ijk_Boring, IRConst_U64(guest_IA_next_instr),
S390X_GUEST_OFFSET(guest_IA)));
return_from_function(get_gpr_dw0(r2));
} else {
assign(cond, s390_call_calculate_cond(r1));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), get_gpr_dw0(r2));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ get_gpr_dw0(r2));
}
}
if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
always_goto(mkexpr(op2addr));
} else {
assign(cond, s390_call_calculate_cond(r1));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op2addr));
}
}
if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
{
put_gpr_w1(r1, binop(Iop_Sub32, get_gpr_w1(r1), mkU32(1)));
if (r2 != 0) {
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, get_gpr_w1(r1), mkU32(0)
- ), get_gpr_dw0(r2));
+ if_condition_goto_computed(binop(Iop_CmpNE32, get_gpr_w1(r1), mkU32(0)),
+ get_gpr_dw0(r2));
}
return "bctr";
{
put_gpr_dw0(r1, binop(Iop_Sub64, get_gpr_dw0(r1), mkU64(1)));
if (r2 != 0) {
- if_not_condition_goto_computed(binop(Iop_CmpEQ64, get_gpr_dw0(r1),
- mkU64(0)), get_gpr_dw0(r2));
+ if_condition_goto_computed(binop(Iop_CmpNE64, get_gpr_dw0(r1), mkU64(0)),
+ get_gpr_dw0(r2));
}
return "bctgr";
s390_irgen_BCT(UChar r1, IRTemp op2addr)
{
put_gpr_w1(r1, binop(Iop_Sub32, get_gpr_w1(r1), mkU32(1)));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, get_gpr_w1(r1), mkU32(0)),
- mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, get_gpr_w1(r1), mkU32(0)),
+ mkexpr(op2addr));
return "bct";
}
s390_irgen_BCTG(UChar r1, IRTemp op2addr)
{
put_gpr_dw0(r1, binop(Iop_Sub64, get_gpr_dw0(r1), mkU64(1)));
- if_not_condition_goto_computed(binop(Iop_CmpEQ64, get_gpr_dw0(r1), mkU64(0)),
- mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpNE64, get_gpr_dw0(r1), mkU64(0)),
+ mkexpr(op2addr));
return "bctg";
}
assign(value, get_gpr_w1(r3 | 1));
put_gpr_w1(r1, binop(Iop_Add32, get_gpr_w1(r1), get_gpr_w1(r3)));
- if_not_condition_goto_computed(binop(Iop_CmpLE32S, get_gpr_w1(r1),
- mkexpr(value)), mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpLT32S, mkexpr(value),
+ get_gpr_w1(r1)), mkexpr(op2addr));
return "bxh";
}
assign(value, get_gpr_dw0(r3 | 1));
put_gpr_dw0(r1, binop(Iop_Add64, get_gpr_dw0(r1), get_gpr_dw0(r3)));
- if_not_condition_goto_computed(binop(Iop_CmpLE64S, get_gpr_dw0(r1),
- mkexpr(value)), mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpLT64S, mkexpr(value),
+ get_gpr_dw0(r1)), mkexpr(op2addr));
return "bxhg";
}
assign(value, get_gpr_w1(r3 | 1));
put_gpr_w1(r1, binop(Iop_Add32, get_gpr_w1(r1), get_gpr_w1(r3)));
- if_not_condition_goto_computed(binop(Iop_CmpLT32S, mkexpr(value),
- get_gpr_w1(r1)), mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpLE32S, get_gpr_w1(r1),
+ mkexpr(value)), mkexpr(op2addr));
return "bxle";
}
assign(value, get_gpr_dw0(r3 | 1));
put_gpr_dw0(r1, binop(Iop_Add64, get_gpr_dw0(r1), get_gpr_dw0(r3)));
- if_not_condition_goto_computed(binop(Iop_CmpLT64S, mkexpr(value),
- get_gpr_dw0(r1)), mkexpr(op2addr));
+ if_condition_goto_computed(binop(Iop_CmpLE64S, get_gpr_dw0(r1),
+ mkexpr(value)), mkexpr(op2addr));
return "bxleg";
}
assign(op2, get_gpr_w1(r2));
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_SIGNED_COMPARE,
op1, op2));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond),
+ mkU32(0)), mkexpr(op4addr));
}
}
assign(op2, get_gpr_dw0(r2));
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_SIGNED_COMPARE,
op1, op2));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond),
+ mkU32(0)), mkexpr(op4addr));
}
}
op2 = (Int)(Char)i2;
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_SIGNED_COMPARE, op1,
mktemp(Ity_I32, mkU32((UInt)op2))));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}
op2 = (Long)(Char)i2;
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_SIGNED_COMPARE, op1,
mktemp(Ity_I64, mkU64((ULong)op2))));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}
assign(op2, get_gpr_w1(r2));
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_UNSIGNED_COMPARE,
op1, op2));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}
assign(op2, get_gpr_dw0(r2));
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_UNSIGNED_COMPARE,
op1, op2));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}
op2 = (UInt)i2;
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_UNSIGNED_COMPARE, op1,
mktemp(Ity_I32, mkU32(op2))));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}
op2 = (ULong)i2;
assign(cond, s390_call_calculate_icc(m3, S390_CC_OP_UNSIGNED_COMPARE, op1,
mktemp(Ity_I64, mkU64(op2))));
- if_not_condition_goto_computed(binop(Iop_CmpEQ32, mkexpr(cond),
- mkU32(0)), mkexpr(op4addr));
+ if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
+ mkexpr(op4addr));
}
}