Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 1005123002: MIPS64: Unify and improve Word32 compares to use same instructions as Word64 compares. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/mips64/instruction-codes-mips64.h » ('j') | test/cctest/compiler/call-tester.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips64/code-generator-mips64.cc
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc
index a9f99614c55f2c63a1c9913f705de311b5f366d2..85b2ffb38f951ed7a1c8fd316b384a14854c5275 100644
--- a/src/compiler/mips64/code-generator-mips64.cc
+++ b/src/compiler/mips64/code-generator-mips64.cc
@@ -586,11 +586,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ Dror(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
break;
case kMips64Tst:
- case kMips64Tst32:
// Pseudo-instruction used for cmp/branch. No opcode emitted here.
break;
case kMips64Cmp:
- case kMips64Cmp32:
// Pseudo-instruction used for cmp/branch. No opcode emitted here.
break;
case kMips64Mov:
@@ -826,25 +824,13 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
// implemented differently than on the other arch's. The compare operations
// emit mips psuedo-instructions, which are handled here by branch
paul.l... 2015/03/13 17:05:31 nit: Here is another place I misspelled pseudo, pl
// instructions that do the actual comparison. Essential that the input
- // registers to compare psuedo-op are not modified before this branch op, as
+ // registers to compare pseudo-op are not modified before this branch op, as
// they are tested here.
- // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were
- // not separated by other instructions.
if (instr->arch_opcode() == kMips64Tst) {
cc = FlagsConditionToConditionTst(branch->condition);
__ And(at, i.InputRegister(0), i.InputOperand(1));
__ Branch(tlabel, cc, at, Operand(zero_reg));
- } else if (instr->arch_opcode() == kMips64Tst32) {
- cc = FlagsConditionToConditionTst(branch->condition);
- // Zero-extend registers on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- // This is a disadvantage to perform 32-bit operation on MIPS64.
- // Try to force globally in front-end Word64 representation to be preferred
- // for MIPS64 even for Word32.
- __ And(at, i.InputRegister(0), i.InputOperand(1));
- __ Dext(at, at, 0, 32);
- __ Branch(tlabel, cc, at, Operand(zero_reg));
} else if (instr->arch_opcode() == kMips64Dadd ||
instr->arch_opcode() == kMips64Dsub) {
cc = FlagsConditionToConditionOvf(branch->condition);
@@ -857,42 +843,6 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
__ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
-
- } else if (instr->arch_opcode() == kMips64Cmp32) {
- cc = FlagsConditionToConditionCmp(branch->condition);
-
- switch (branch->condition) {
- case kEqual:
- case kNotEqual:
- case kSignedLessThan:
- case kSignedGreaterThanOrEqual:
- case kSignedLessThanOrEqual:
- case kSignedGreaterThan:
- // Sign-extend registers on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- __ sll(i.InputRegister(0), i.InputRegister(0), 0);
- if (instr->InputAt(1)->IsRegister()) {
- __ sll(i.InputRegister(1), i.InputRegister(1), 0);
- }
- break;
- case kUnsignedLessThan:
- case kUnsignedGreaterThanOrEqual:
- case kUnsignedLessThanOrEqual:
- case kUnsignedGreaterThan:
- // Zero-extend registers on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- __ Dext(i.InputRegister(0), i.InputRegister(0), 0, 32);
- if (instr->InputAt(1)->IsRegister()) {
- __ Dext(i.InputRegister(1), i.InputRegister(1), 0, 32);
- }
- break;
- default:
- UNSUPPORTED_COND(kMips64Cmp, branch->condition);
- break;
- }
- __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
-
- if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMips64CmpD) {
// TODO(dusmil) optimize unordered checks to use less instructions
// even if we have to unfold BranchF macro.
@@ -966,14 +916,6 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
__ And(at, i.InputRegister(0), i.InputOperand(1));
__ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg));
__ li(result, Operand(1)); // In delay slot.
- } else if (instr->arch_opcode() == kMips64Tst32) {
- cc = FlagsConditionToConditionTst(condition);
- // Zero-extend register on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- __ And(at, i.InputRegister(0), i.InputOperand(1));
- __ Dext(at, at, 0, 32);
- __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg));
- __ li(result, Operand(1)); // In delay slot.
} else if (instr->arch_opcode() == kMips64Dadd ||
instr->arch_opcode() == kMips64Dsub) {
cc = FlagsConditionToConditionOvf(condition);
@@ -987,42 +929,6 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
cc = FlagsConditionToConditionCmp(condition);
__ Branch(USE_DELAY_SLOT, &done, cc, left, right);
__ li(result, Operand(1)); // In delay slot.
- } else if (instr->arch_opcode() == kMips64Cmp32) {
- Register left = i.InputRegister(0);
- Operand right = i.InputOperand(1);
- cc = FlagsConditionToConditionCmp(condition);
-
- switch (condition) {
- case kEqual:
- case kNotEqual:
- case kSignedLessThan:
- case kSignedGreaterThanOrEqual:
- case kSignedLessThanOrEqual:
- case kSignedGreaterThan:
- // Sign-extend registers on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- __ sll(left, left, 0);
- if (instr->InputAt(1)->IsRegister()) {
- __ sll(i.InputRegister(1), i.InputRegister(1), 0);
- }
- break;
- case kUnsignedLessThan:
- case kUnsignedGreaterThanOrEqual:
- case kUnsignedLessThanOrEqual:
- case kUnsignedGreaterThan:
- // Zero-extend registers on MIPS64 only 64-bit operand
- // branch and compare op. is available.
- __ Dext(left, left, 0, 32);
- if (instr->InputAt(1)->IsRegister()) {
- __ Dext(i.InputRegister(1), i.InputRegister(1), 0, 32);
- }
- break;
- default:
- UNSUPPORTED_COND(kMips64Cmp32, condition);
- break;
- }
- __ Branch(USE_DELAY_SLOT, &done, cc, left, right);
- __ li(result, Operand(1)); // In delay slot.
} else if (instr->arch_opcode() == kMips64CmpD) {
FPURegister left = i.InputDoubleRegister(0);
FPURegister right = i.InputDoubleRegister(1);
« no previous file with comments | « no previous file | src/compiler/mips64/instruction-codes-mips64.h » ('j') | test/cctest/compiler/call-tester.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698