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

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 2477453005: MIPS[64]: Optimize kMips[64]Tst in code-generator-mips[64].cc (Closed)
Patch Set: Address code review remarks Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 Label false_value; 1709 Label false_value;
1710 DCHECK_NE(0u, instr->OutputCount()); 1710 DCHECK_NE(0u, instr->OutputCount());
1711 Register result = i.OutputRegister(instr->OutputCount() - 1); 1711 Register result = i.OutputRegister(instr->OutputCount() - 1);
1712 Condition cc = kNoCondition; 1712 Condition cc = kNoCondition;
1713 // MIPS does not have condition code flags, so compare and branch are 1713 // MIPS does not have condition code flags, so compare and branch are
1714 // implemented differently than on the other arch's. The compare operations 1714 // implemented differently than on the other arch's. The compare operations
1715 // emit mips psuedo-instructions, which are checked and handled here. 1715 // emit mips psuedo-instructions, which are checked and handled here.
1716 1716
1717 if (instr->arch_opcode() == kMipsTst) { 1717 if (instr->arch_opcode() == kMipsTst) {
1718 cc = FlagsConditionToConditionTst(condition); 1718 cc = FlagsConditionToConditionTst(condition);
1719 __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1)); 1719 if (instr->InputAt(1)->IsImmediate() &&
1720 __ Sltu(result, zero_reg, kScratchReg); 1720 base::bits::IsPowerOfTwo32(i.InputOperand(1).immediate())) {
1721 uint16_t pos =
1722 base::bits::CountTrailingZeros32(i.InputOperand(1).immediate());
1723 __ Ext(result, i.InputRegister(0), pos, 1);
1724 } else {
1725 __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1));
1726 __ Sltu(result, zero_reg, kScratchReg);
1727 }
1721 if (cc == eq) { 1728 if (cc == eq) {
1722 // Sltu produces 0 for equality, invert the result. 1729 // Sltu produces 0 for equality, invert the result.
1723 __ xori(result, result, 1); 1730 __ xori(result, result, 1);
1724 } 1731 }
1725 return; 1732 return;
1726 } else if (instr->arch_opcode() == kMipsAddOvf || 1733 } else if (instr->arch_opcode() == kMipsAddOvf ||
1727 instr->arch_opcode() == kMipsSubOvf || 1734 instr->arch_opcode() == kMipsSubOvf ||
1728 instr->arch_opcode() == kMipsMulOvf) { 1735 instr->arch_opcode() == kMipsMulOvf) {
1729 Label flabel, tlabel; 1736 Label flabel, tlabel;
1730 switch (instr->arch_opcode()) { 1737 switch (instr->arch_opcode()) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 padding_size -= v8::internal::Assembler::kInstrSize; 2275 padding_size -= v8::internal::Assembler::kInstrSize;
2269 } 2276 }
2270 } 2277 }
2271 } 2278 }
2272 2279
2273 #undef __ 2280 #undef __
2274 2281
2275 } // namespace compiler 2282 } // namespace compiler
2276 } // namespace internal 2283 } // namespace internal
2277 } // namespace v8 2284 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips/instruction-selector-mips.cc » ('j') | src/mips64/macro-assembler-mips64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698