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

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: 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() &&
dusan.simicic 2016/11/09 12:40:49 I think this can be generalised for all 2^n consta
1720 __ Sltu(result, zero_reg, kScratchReg); 1720 i.InputOperand(1).immediate() == 1) {
1721 __ Ext(result, i.InputRegister(0), 0, 1);
1722 } else {
1723 __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1));
1724 __ Sltu(result, zero_reg, kScratchReg);
1725 }
1721 if (cc == eq) { 1726 if (cc == eq) {
1722 // Sltu produces 0 for equality, invert the result. 1727 // Sltu produces 0 for equality, invert the result.
1723 __ xori(result, result, 1); 1728 __ xori(result, result, 1);
1724 } 1729 }
1725 return; 1730 return;
1726 } else if (instr->arch_opcode() == kMipsAddOvf || 1731 } else if (instr->arch_opcode() == kMipsAddOvf ||
1727 instr->arch_opcode() == kMipsSubOvf || 1732 instr->arch_opcode() == kMipsSubOvf ||
1728 instr->arch_opcode() == kMipsMulOvf) { 1733 instr->arch_opcode() == kMipsMulOvf) {
1729 Label flabel, tlabel; 1734 Label flabel, tlabel;
1730 switch (instr->arch_opcode()) { 1735 switch (instr->arch_opcode()) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 padding_size -= v8::internal::Assembler::kInstrSize; 2273 padding_size -= v8::internal::Assembler::kInstrSize;
2269 } 2274 }
2270 } 2275 }
2271 } 2276 }
2272 2277
2273 #undef __ 2278 #undef __
2274 2279
2275 } // namespace compiler 2280 } // namespace compiler
2276 } // namespace internal 2281 } // namespace internal
2277 } // namespace v8 2282 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | src/compiler/mips64/code-generator-mips64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698