OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |