}
-// Corresponds to transposing the operands of a comparison.
-inline Condition ReverseCondition(Condition cond) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cond) {
switch (cond) {
case lo:
return hi;
} else {
__ cmp(ToRegister(right), Operand(value));
}
- // We transposed the operands. Reverse the condition.
- cond = ReverseCondition(cond);
+ // We commuted the operands, so commute the condition.
+ cond = CommuteCondition(cond);
} else {
__ cmp(ToRegister(left), ToRegister(right));
}
Operand index = ToOperand(instr->index());
Register length = ToRegister(instr->length());
__ cmp(length, index);
- cc = ReverseCondition(cc);
+ cc = CommuteCondition(cc);
} else {
Register index = ToRegister(instr->index());
Operand length = ToOperand(instr->length());
return static_cast<Condition>(cond ^ 1);
}
-// Corresponds to transposing the operands of a comparison.
-inline Condition ReverseCondition(Condition cond) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cond) {
switch (cond) {
case lo:
return hi;
Operand index = ToOperand32I(instr->index());
Register length = ToRegister32(instr->length());
__ Cmp(length, index);
- cond = ReverseCondition(cond);
+ cond = CommuteCondition(cond);
} else {
Register index = ToRegister32(instr->index());
Operand length = ToOperand32I(instr->length());
__ Fcmp(ToDoubleRegister(left),
ToDouble(LConstantOperand::cast(right)));
} else if (left->IsConstantOperand()) {
- // Transpose the operands and reverse the condition.
+ // Commute the operands and the condition.
__ Fcmp(ToDoubleRegister(right),
ToDouble(LConstantOperand::cast(left)));
- cond = ReverseCondition(cond);
+ cond = CommuteCondition(cond);
} else {
__ Fcmp(ToDoubleRegister(left), ToDoubleRegister(right));
}
ToRegister32(left),
ToOperand32I(right));
} else {
- // Transpose the operands and reverse the condition.
+ // Commute the operands and the condition.
EmitCompareAndBranch(instr,
- ReverseCondition(cond),
+ CommuteCondition(cond),
ToRegister32(right),
ToOperand32I(left));
}
ToRegister(left),
Operand(Smi::FromInt(value)));
} else if (left->IsConstantOperand()) {
- // Transpose the operands and reverse the condition.
+ // Commute the operands and the condition.
int32_t value = ToInteger32(LConstantOperand::cast(left));
EmitCompareAndBranch(instr,
- ReverseCondition(cond),
+ CommuteCondition(cond),
ToRegister(right),
Operand(Smi::FromInt(value)));
} else {
}
-// Corresponds to transposing the operands of a comparison.
-inline Condition ReverseCondition(Condition cc) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cc) {
switch (cc) {
case below:
return above;
} else if (left->IsConstantOperand()) {
__ cmp(ToOperand(right),
ToImmediate(left, instr->hydrogen()->representation()));
- // We transposed the operands. Reverse the condition.
- cc = ReverseCondition(cc);
+ // We commuted the operands, so commute the condition.
+ cc = CommuteCondition(cc);
} else {
__ cmp(ToRegister(left), ToOperand(right));
}
__ cmp(ToOperand(instr->length()),
ToImmediate(LConstantOperand::cast(instr->index()),
instr->hydrogen()->length()->representation()));
- cc = ReverseCondition(cc);
+ cc = CommuteCondition(cc);
} else if (instr->length()->IsConstantOperand()) {
__ cmp(ToOperand(instr->index()),
ToImmediate(LConstantOperand::cast(instr->length()),
}
-inline Condition ReverseCondition(Condition cc) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cc) {
switch (cc) {
case Uless:
return Ugreater;
cmp_left = ToRegister(right);
cmp_right = Operand(value);
}
- // We transposed the operands. Reverse the condition.
- cond = ReverseCondition(cond);
+ // We commuted the operands, so commute the condition.
+ cond = CommuteCondition(cond);
} else {
cmp_left = ToRegister(left);
cmp_right = Operand(ToRegister(right));
if (instr->index()->IsConstantOperand()) {
operand = ToOperand(instr->index());
reg = ToRegister(instr->length());
- cc = ReverseCondition(cc);
+ cc = CommuteCondition(cc);
} else {
reg = ToRegister(instr->index());
operand = ToOperand(instr->length());
}
-// Corresponds to transposing the operands of a comparison.
-inline Condition ReverseCondition(Condition cc) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cc) {
switch (cc) {
case below:
return above;
} else {
__ cmpl(ToOperand(right), Immediate(value));
}
- // We transposed the operands. Reverse the condition.
- cc = ReverseCondition(cc);
+ // We commuted the operands, so commute the condition.
+ cc = CommuteCondition(cc);
} else if (instr->hydrogen_value()->representation().IsSmi()) {
if (right->IsRegister()) {
__ cmpp(ToRegister(left), ToRegister(right));
} else {
__ cmpl(index, Immediate(length));
}
- cc = ReverseCondition(cc);
+ cc = CommuteCondition(cc);
} else if (instr->index()->IsConstantOperand()) {
int32_t index = ToInteger32(LConstantOperand::cast(instr->index()));
if (instr->length()->IsRegister()) {
}
-// Corresponds to transposing the operands of a comparison.
-inline Condition ReverseCondition(Condition cc) {
+// Commute a condition such that a cond b == b cond' b.
+inline Condition CommuteCondition(Condition cc) {
switch (cc) {
case below:
return above;
} else if (left->IsConstantOperand()) {
__ cmp(ToOperand(right),
ToImmediate(left, instr->hydrogen()->representation()));
- // We transposed the operands. Reverse the condition.
- cc = ReverseCondition(cc);
+ // We commuted the operands, so commute the condition.
+ cc = CommuteCondition(cc);
} else {
__ cmp(ToRegister(left), ToOperand(right));
}
__ cmp(ToOperand(instr->length()),
ToImmediate(LConstantOperand::cast(instr->index()),
instr->hydrogen()->length()->representation()));
- cc = ReverseCondition(cc);
+ cc = CommuteCondition(cc);
} else if (instr->length()->IsConstantOperand()) {
__ cmp(ToOperand(instr->index()),
ToImmediate(LConstantOperand::cast(instr->length()),