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