Skip to content

Commit

Permalink
Remove premature optimization that was breaking opt builds, -1 != 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed Jun 29, 2009
1 parent 3cf635b commit 05544d8
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions rvm/src/org/jikesrvm/compilers/opt/lir2mir/ia32/BURS_Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -2834,21 +2834,10 @@ void EMIT_Compare(Instruction s, ConditionOperand cond,
*/
protected final void BOOLEAN_CMP_INT(Instruction s, RegisterOperand res, Operand val1, Operand val2,
ConditionOperand cond) {
// Peephole optimize case where carry flag is tested to use SBB rather than SETcc
if (cond.isHIGHER() && !val2.isConstant()) {
cond.flipOperands();
Operand temp = val1;
val1 = val2;
val2 = temp;
}
EMIT(CPOS(s, MIR_Compare.create(IA32_CMP, val1, val2)));
if (!cond.isLOWER()) {
RegisterOperand temp = regpool.makeTemp(TypeReference.Boolean);
EMIT(CPOS(s, MIR_Set.create(IA32_SET__B, temp, COND(cond))));
EMIT(MIR_Unary.mutate(s, IA32_MOVZX__B, res, temp.copyD2U()));
} else {
EMIT(MIR_BinaryAcc.mutate(s, IA32_SBB, res, res.copyRO()));
}
RegisterOperand temp = regpool.makeTemp(TypeReference.Boolean);
EMIT(CPOS(s, MIR_Set.create(IA32_SET__B, temp, COND(cond))));
EMIT(MIR_Unary.mutate(s, IA32_MOVZX__B, res, temp.copyD2U()));
}

/**
Expand All @@ -2860,14 +2849,9 @@ protected final void BOOLEAN_CMP_INT(Instruction s, RegisterOperand res, Operand
* @param cond the condition operand
*/
protected final void BOOLEAN_CMP_INT(Instruction s, RegisterOperand res, ConditionOperand cond) {
// Peephole optimize case where carry flag is tested to use SBB rather than SETcc
if (!cond.isLOWER()) {
RegisterOperand temp = regpool.makeTemp(TypeReference.Boolean);
EMIT(CPOS(s, MIR_Set.create(IA32_SET__B, temp, COND(cond))));
EMIT(MIR_Unary.mutate(s, IA32_MOVZX__B, res, temp.copyD2U()));
} else {
EMIT(MIR_BinaryAcc.mutate(s, IA32_SBB, res, res.copyRO()));
}
RegisterOperand temp = regpool.makeTemp(TypeReference.Boolean);
EMIT(CPOS(s, MIR_Set.create(IA32_SET__B, temp, COND(cond))));
EMIT(MIR_Unary.mutate(s, IA32_MOVZX__B, res, temp.copyD2U()));
}

/**
Expand Down

0 comments on commit 05544d8

Please sign in to comment.