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/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 __ isel(overflow, result, dividend, result, cr0); | 1133 __ isel(overflow, result, dividend, result, cr0); |
1134 } else { | 1134 } else { |
1135 Label no_overflow_possible; | 1135 Label no_overflow_possible; |
1136 __ bnooverflow(&no_overflow_possible, cr0); | 1136 __ bnooverflow(&no_overflow_possible, cr0); |
1137 __ mr(result, dividend); | 1137 __ mr(result, dividend); |
1138 __ bind(&no_overflow_possible); | 1138 __ bind(&no_overflow_possible); |
1139 } | 1139 } |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
| 1143 #if V8_TARGET_ARCH_PPC64 |
| 1144 __ extsw(result, result); |
| 1145 #endif |
| 1146 |
1143 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { | 1147 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { |
1144 // Deoptimize if remainder is not 0. | 1148 // Deoptimize if remainder is not 0. |
1145 Register scratch = scratch0(); | 1149 Register scratch = scratch0(); |
1146 __ mullw(scratch, divisor, result); | 1150 __ mullw(scratch, divisor, result); |
1147 __ cmpw(dividend, scratch); | 1151 __ cmpw(dividend, scratch); |
1148 DeoptimizeIf(ne, instr, Deoptimizer::kLostPrecision); | 1152 DeoptimizeIf(ne, instr, Deoptimizer::kLostPrecision); |
1149 } | 1153 } |
1150 } | 1154 } |
1151 | 1155 |
1152 | 1156 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 #endif | 1330 #endif |
1327 | 1331 |
1328 // If there is no remainder then we are done. | 1332 // If there is no remainder then we are done. |
1329 __ mullw(scratch, divisor, result); | 1333 __ mullw(scratch, divisor, result); |
1330 __ cmpw(dividend, scratch); | 1334 __ cmpw(dividend, scratch); |
1331 __ beq(&done); | 1335 __ beq(&done); |
1332 | 1336 |
1333 // We performed a truncating division. Correct the result. | 1337 // We performed a truncating division. Correct the result. |
1334 __ subi(result, result, Operand(1)); | 1338 __ subi(result, result, Operand(1)); |
1335 __ bind(&done); | 1339 __ bind(&done); |
| 1340 #if V8_TARGET_ARCH_PPC64 |
| 1341 __ extsw(result, result); |
| 1342 #endif |
1336 } | 1343 } |
1337 | 1344 |
1338 | 1345 |
1339 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { | 1346 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { |
1340 DoubleRegister addend = ToDoubleRegister(instr->addend()); | 1347 DoubleRegister addend = ToDoubleRegister(instr->addend()); |
1341 DoubleRegister multiplier = ToDoubleRegister(instr->multiplier()); | 1348 DoubleRegister multiplier = ToDoubleRegister(instr->multiplier()); |
1342 DoubleRegister multiplicand = ToDoubleRegister(instr->multiplicand()); | 1349 DoubleRegister multiplicand = ToDoubleRegister(instr->multiplicand()); |
1343 DoubleRegister result = ToDoubleRegister(instr->result()); | 1350 DoubleRegister result = ToDoubleRegister(instr->result()); |
1344 | 1351 |
1345 __ fmadd(result, multiplier, multiplicand, addend); | 1352 __ fmadd(result, multiplier, multiplicand, addend); |
(...skipping 4466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5812 __ LoadP(result, | 5819 __ LoadP(result, |
5813 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5820 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5814 __ bind(deferred->exit()); | 5821 __ bind(deferred->exit()); |
5815 __ bind(&done); | 5822 __ bind(&done); |
5816 } | 5823 } |
5817 | 5824 |
5818 #undef __ | 5825 #undef __ |
5819 | 5826 |
5820 } // namespace internal | 5827 } // namespace internal |
5821 } // namespace v8 | 5828 } // namespace v8 |
OLD | NEW |