| 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/base/adapters.h" | 5 #include "src/base/adapters.h" |
| 6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
| 7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 | 10 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 InstructionOperand left_operand = g.UseRegister(m.left().node()); | 319 InstructionOperand left_operand = g.UseRegister(m.left().node()); |
| 320 InstructionOperand right_operand = g.UseRegister(m.right().node()); | 320 InstructionOperand right_operand = g.UseRegister(m.right().node()); |
| 321 EmitDiv(selector, div_opcode, f64i32_opcode, i32f64_opcode, div_operand, | 321 EmitDiv(selector, div_opcode, f64i32_opcode, i32f64_opcode, div_operand, |
| 322 left_operand, right_operand); | 322 left_operand, right_operand); |
| 323 if (selector->IsSupported(ARMv7)) { | 323 if (selector->IsSupported(ARMv7)) { |
| 324 selector->Emit(kArmMls, result_operand, div_operand, right_operand, | 324 selector->Emit(kArmMls, result_operand, div_operand, right_operand, |
| 325 left_operand); | 325 left_operand); |
| 326 } else { | 326 } else { |
| 327 InstructionOperand mul_operand = g.TempRegister(); | 327 InstructionOperand mul_operand = g.TempRegister(); |
| 328 selector->Emit(kArmMul, mul_operand, div_operand, right_operand); | 328 selector->Emit(kArmMul, mul_operand, div_operand, right_operand); |
| 329 selector->Emit(kArmSub, result_operand, left_operand, mul_operand); | 329 selector->Emit(kArmSub | AddressingModeField::encode(kMode_Operand2_R), |
| 330 result_operand, left_operand, mul_operand); |
| 330 } | 331 } |
| 331 } | 332 } |
| 332 | 333 |
| 333 } // namespace | 334 } // namespace |
| 334 | 335 |
| 335 | 336 |
| 336 void InstructionSelector::VisitLoad(Node* node) { | 337 void InstructionSelector::VisitLoad(Node* node) { |
| 337 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); | 338 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
| 338 ArmOperandGenerator g(this); | 339 ArmOperandGenerator g(this); |
| 339 Node* base = node->InputAt(0); | 340 Node* base = node->InputAt(0); |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 inputs[input_count++] = g.UseUniqueRegister(base); | 1945 inputs[input_count++] = g.UseUniqueRegister(base); |
| 1945 inputs[input_count++] = g.UseUniqueRegister(index); | 1946 inputs[input_count++] = g.UseUniqueRegister(index); |
| 1946 inputs[input_count++] = g.UseUniqueRegister(value); | 1947 inputs[input_count++] = g.UseUniqueRegister(value); |
| 1947 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | 1948 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
| 1948 Emit(code, 0, nullptr, input_count, inputs); | 1949 Emit(code, 0, nullptr, input_count, inputs); |
| 1949 } | 1950 } |
| 1950 | 1951 |
| 1951 // static | 1952 // static |
| 1952 MachineOperatorBuilder::Flags | 1953 MachineOperatorBuilder::Flags |
| 1953 InstructionSelector::SupportedMachineOperatorFlags() { | 1954 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1954 MachineOperatorBuilder::Flags flags = | 1955 MachineOperatorBuilder::Flags flags; |
| 1955 MachineOperatorBuilder::kInt32DivIsSafe | | 1956 if (CpuFeatures::IsSupported(SUDIV)) { |
| 1956 MachineOperatorBuilder::kUint32DivIsSafe; | 1957 // The sdiv and udiv instructions correctly return 0 if the divisor is 0, |
| 1958 // but the fall-back implementation does not. |
| 1959 flags |= MachineOperatorBuilder::kInt32DivIsSafe | |
| 1960 MachineOperatorBuilder::kUint32DivIsSafe; |
| 1961 } |
| 1957 if (CpuFeatures::IsSupported(ARMv7)) { | 1962 if (CpuFeatures::IsSupported(ARMv7)) { |
| 1958 flags |= MachineOperatorBuilder::kWord32ReverseBits; | 1963 flags |= MachineOperatorBuilder::kWord32ReverseBits; |
| 1959 } | 1964 } |
| 1960 if (CpuFeatures::IsSupported(ARMv8)) { | 1965 if (CpuFeatures::IsSupported(ARMv8)) { |
| 1961 flags |= MachineOperatorBuilder::kFloat32RoundDown | | 1966 flags |= MachineOperatorBuilder::kFloat32RoundDown | |
| 1962 MachineOperatorBuilder::kFloat64RoundDown | | 1967 MachineOperatorBuilder::kFloat64RoundDown | |
| 1963 MachineOperatorBuilder::kFloat32RoundUp | | 1968 MachineOperatorBuilder::kFloat32RoundUp | |
| 1964 MachineOperatorBuilder::kFloat64RoundUp | | 1969 MachineOperatorBuilder::kFloat64RoundUp | |
| 1965 MachineOperatorBuilder::kFloat32RoundTruncate | | 1970 MachineOperatorBuilder::kFloat32RoundTruncate | |
| 1966 MachineOperatorBuilder::kFloat64RoundTruncate | | 1971 MachineOperatorBuilder::kFloat64RoundTruncate | |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1980 // static | 1985 // static |
| 1981 MachineOperatorBuilder::AlignmentRequirements | 1986 MachineOperatorBuilder::AlignmentRequirements |
| 1982 InstructionSelector::AlignmentRequirements() { | 1987 InstructionSelector::AlignmentRequirements() { |
| 1983 return MachineOperatorBuilder::AlignmentRequirements:: | 1988 return MachineOperatorBuilder::AlignmentRequirements:: |
| 1984 FullUnalignedAccessSupport(); | 1989 FullUnalignedAccessSupport(); |
| 1985 } | 1990 } |
| 1986 | 1991 |
| 1987 } // namespace compiler | 1992 } // namespace compiler |
| 1988 } // namespace internal | 1993 } // namespace internal |
| 1989 } // namespace v8 | 1994 } // namespace v8 |
| OLD | NEW |