return; \
if (inst->inst_i1->opcode == OP_ICONST) { \
inst->opcode = OP_ICONST; \
- inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0; \
+ inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0); \
} \
return;
if (inst->inst_i0->opcode == OP_ICONST) {\
if (inst->inst_i1->opcode == OP_ICONST) { \
inst->opcode = OP_ICONST; \
- inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0; \
+ inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0); \
return; \
} else { \
MonoInst *tmp = inst->inst_i0; \
return; \
if (inst->inst_i0->inst_i1->opcode == OP_ICONST) { \
if ((cast)inst->inst_i0->inst_i0->inst_c0 op (cast)inst->inst_i0->inst_i1->inst_c0) \
- inst->opcode = CEE_BR; \
+ inst->opcode = OP_BR; \
else \
- inst->opcode = CEE_NOP; \
+ inst->opcode = OP_NOP; \
} \
return;
* If the arguments to the cond branch are constants, eval and
* return BRANCH_NOT_TAKEN for not taken, BRANCH_TAKEN for taken,
* BRANCH_UNDEF otherwise.
+ * If this code is changed to handle also non-const values, make sure
+ * side effects are handled in optimize_branches() in mini.c, by
+ * inserting pop instructions.
*/
int
mono_eval_cond_branch (MonoInst *ins)