Commit 686e3abf authored by dusan.milosavljevic's avatar dusan.milosavljevic Committed by Commit bot

MIPS: Fix missing Float32 case in AssembleArchBoolean.

TEST=mjsunit/asm/embenchen/box2d
BUG=

Review URL: https://codereview.chromium.org/1234533004

Cr-Commit-Position: refs/heads/master@{#29608}
parent 79a3cb2e
...@@ -263,8 +263,8 @@ Condition FlagsConditionToConditionOvf(FlagsCondition condition) { ...@@ -263,8 +263,8 @@ Condition FlagsConditionToConditionOvf(FlagsCondition condition) {
return kNoCondition; return kNoCondition;
} }
FPUCondition FlagsConditionToConditionCmpD(bool& predicate, FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
FlagsCondition condition) { FlagsCondition condition) {
switch (condition) { switch (condition) {
case kEqual: case kEqual:
predicate = true; predicate = true;
...@@ -992,22 +992,33 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, ...@@ -992,22 +992,33 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
__ Branch(USE_DELAY_SLOT, &done, cc, left, right); __ Branch(USE_DELAY_SLOT, &done, cc, left, right);
__ li(result, Operand(1)); // In delay slot. __ li(result, Operand(1)); // In delay slot.
} else if (instr->arch_opcode() == kMipsCmpD) { } else if (instr->arch_opcode() == kMipsCmpD ||
instr->arch_opcode() == kMipsCmpS) {
FPURegister left = i.InputDoubleRegister(0); FPURegister left = i.InputDoubleRegister(0);
FPURegister right = i.InputDoubleRegister(1); FPURegister right = i.InputDoubleRegister(1);
bool predicate; bool predicate;
FPUCondition cc = FlagsConditionToConditionCmpD(predicate, condition); FPUCondition cc = FlagsConditionToConditionCmpFPU(predicate, condition);
if (!IsMipsArchVariant(kMips32r6)) { if (!IsMipsArchVariant(kMips32r6)) {
__ li(result, Operand(1)); __ li(result, Operand(1));
__ c(cc, D, left, right); if (instr->arch_opcode() == kMipsCmpD) {
__ c(cc, D, left, right);
} else {
DCHECK(instr->arch_opcode() == kMipsCmpS);
__ c(cc, S, left, right);
}
if (predicate) { if (predicate) {
__ Movf(result, zero_reg); __ Movf(result, zero_reg);
} else { } else {
__ Movt(result, zero_reg); __ Movt(result, zero_reg);
} }
} else { } else {
__ cmp(cc, L, kDoubleCompareReg, left, right); if (instr->arch_opcode() == kMipsCmpD) {
__ cmp(cc, L, kDoubleCompareReg, left, right);
} else {
DCHECK(instr->arch_opcode() == kMipsCmpS);
__ cmp(cc, W, kDoubleCompareReg, left, right);
}
__ mfc1(at, kDoubleCompareReg); __ mfc1(at, kDoubleCompareReg);
__ srl(result, at, 31); // Cmp returns all 1s for true. __ srl(result, at, 31); // Cmp returns all 1s for true.
if (!predicate) // Toggle result for not equal. if (!predicate) // Toggle result for not equal.
......
...@@ -264,8 +264,8 @@ Condition FlagsConditionToConditionOvf(FlagsCondition condition) { ...@@ -264,8 +264,8 @@ Condition FlagsConditionToConditionOvf(FlagsCondition condition) {
} }
FPUCondition FlagsConditionToConditionCmpD(bool& predicate, FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
FlagsCondition condition) { FlagsCondition condition) {
switch (condition) { switch (condition) {
case kEqual: case kEqual:
predicate = true; predicate = true;
...@@ -1061,22 +1061,33 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, ...@@ -1061,22 +1061,33 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
cc = FlagsConditionToConditionCmp(condition); cc = FlagsConditionToConditionCmp(condition);
__ Branch(USE_DELAY_SLOT, &done, cc, left, right); __ Branch(USE_DELAY_SLOT, &done, cc, left, right);
__ li(result, Operand(1)); // In delay slot. __ li(result, Operand(1)); // In delay slot.
} else if (instr->arch_opcode() == kMips64CmpD) { } else if (instr->arch_opcode() == kMips64CmpD ||
instr->arch_opcode() == kMips64CmpS) {
FPURegister left = i.InputDoubleRegister(0); FPURegister left = i.InputDoubleRegister(0);
FPURegister right = i.InputDoubleRegister(1); FPURegister right = i.InputDoubleRegister(1);
bool predicate; bool predicate;
FPUCondition cc = FlagsConditionToConditionCmpD(predicate, condition); FPUCondition cc = FlagsConditionToConditionCmpFPU(predicate, condition);
if (kArchVariant != kMips64r6) { if (kArchVariant != kMips64r6) {
__ li(result, Operand(1)); __ li(result, Operand(1));
__ c(cc, D, left, right); if (instr->arch_opcode() == kMips64CmpD) {
__ c(cc, D, left, right);
} else {
DCHECK(instr->arch_opcode() == kMips64CmpS);
__ c(cc, S, left, right);
}
if (predicate) { if (predicate) {
__ Movf(result, zero_reg); __ Movf(result, zero_reg);
} else { } else {
__ Movt(result, zero_reg); __ Movt(result, zero_reg);
} }
} else { } else {
__ cmp(cc, L, kDoubleCompareReg, left, right); if (instr->arch_opcode() == kMips64CmpD) {
__ cmp(cc, L, kDoubleCompareReg, left, right);
} else {
DCHECK(instr->arch_opcode() == kMips64CmpS);
__ cmp(cc, W, kDoubleCompareReg, left, right);
}
__ dmfc1(at, kDoubleCompareReg); __ dmfc1(at, kDoubleCompareReg);
__ dsrl32(result, at, 31); // Cmp returns all 1s for true. __ dsrl32(result, at, 31); // Cmp returns all 1s for true.
if (!predicate) // Toggle result for not equal. if (!predicate) // Toggle result for not equal.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment