| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
| 7 | 7 |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 __ lr(result, r1); // Move quotient to result register | 1280 __ lr(result, r1); // Move quotient to result register |
| 1281 | 1281 |
| 1282 Label done; | 1282 Label done; |
| 1283 Register scratch = scratch0(); | 1283 Register scratch = scratch0(); |
| 1284 // If both operands have the same sign then we are done. | 1284 // If both operands have the same sign then we are done. |
| 1285 __ Xor(scratch, dividend, divisor); | 1285 __ Xor(scratch, dividend, divisor); |
| 1286 __ ltr(scratch, scratch); // use 32 bit version LoadAndTestRR even in 64 bit | 1286 __ ltr(scratch, scratch); // use 32 bit version LoadAndTestRR even in 64 bit |
| 1287 __ bge(&done, Label::kNear); | 1287 __ bge(&done, Label::kNear); |
| 1288 | 1288 |
| 1289 // If there is no remainder then we are done. | 1289 // If there is no remainder then we are done. |
| 1290 __ lr(scratch, result); | 1290 if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) { |
| 1291 __ msr(scratch, divisor); | 1291 __ msrkc(scratch, result, divisor); |
| 1292 } else { |
| 1293 __ lr(scratch, result); |
| 1294 __ msr(scratch, divisor); |
| 1295 } |
| 1292 __ Cmp32(dividend, scratch); | 1296 __ Cmp32(dividend, scratch); |
| 1293 __ beq(&done, Label::kNear); | 1297 __ beq(&done, Label::kNear); |
| 1294 | 1298 |
| 1295 // We performed a truncating division. Correct the result. | 1299 // We performed a truncating division. Correct the result. |
| 1296 __ Sub32(result, result, Operand(1)); | 1300 __ Sub32(result, result, Operand(1)); |
| 1297 __ bind(&done); | 1301 __ bind(&done); |
| 1298 } | 1302 } |
| 1299 | 1303 |
| 1300 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { | 1304 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { |
| 1301 DoubleRegister addend = ToDoubleRegister(instr->addend()); | 1305 DoubleRegister addend = ToDoubleRegister(instr->addend()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 __ Move(result, left); | 1416 __ Move(result, left); |
| 1413 __ MulP(result, Operand(constant)); | 1417 __ MulP(result, Operand(constant)); |
| 1414 } | 1418 } |
| 1415 } | 1419 } |
| 1416 | 1420 |
| 1417 } else { | 1421 } else { |
| 1418 DCHECK(right_op->IsRegister()); | 1422 DCHECK(right_op->IsRegister()); |
| 1419 Register right = ToRegister(right_op); | 1423 Register right = ToRegister(right_op); |
| 1420 | 1424 |
| 1421 if (can_overflow) { | 1425 if (can_overflow) { |
| 1426 if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) { |
| 1427 // result = left * right. |
| 1428 if (instr->hydrogen()->representation().IsSmi()) { |
| 1429 __ SmiUntag(scratch, right); |
| 1430 __ MulPWithCondition(result, left, scratch); |
| 1431 } else { |
| 1432 __ msrkc(result, left, right); |
| 1433 __ LoadW(result, result); |
| 1434 } |
| 1435 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); |
| 1436 } else { |
| 1422 #if V8_TARGET_ARCH_S390X | 1437 #if V8_TARGET_ARCH_S390X |
| 1423 // result = left * right. | 1438 // result = left * right. |
| 1424 if (instr->hydrogen()->representation().IsSmi()) { | 1439 if (instr->hydrogen()->representation().IsSmi()) { |
| 1425 __ SmiUntag(result, left); | 1440 __ SmiUntag(result, left); |
| 1426 __ SmiUntag(scratch, right); | 1441 __ SmiUntag(scratch, right); |
| 1427 __ msgr(result, scratch); | 1442 __ msgr(result, scratch); |
| 1428 } else { | 1443 } else { |
| 1429 __ LoadRR(result, left); | 1444 __ LoadRR(result, left); |
| 1430 __ msgr(result, right); | 1445 __ msgr(result, right); |
| 1446 } |
| 1447 __ TestIfInt32(result, r0); |
| 1448 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); |
| 1449 if (instr->hydrogen()->representation().IsSmi()) { |
| 1450 __ SmiTag(result); |
| 1451 } |
| 1452 #else |
| 1453 // r0:scratch = scratch * right |
| 1454 if (instr->hydrogen()->representation().IsSmi()) { |
| 1455 __ SmiUntag(scratch, left); |
| 1456 __ mr_z(r0, right); |
| 1457 __ LoadRR(result, scratch); |
| 1458 } else { |
| 1459 // r0:scratch = scratch * right |
| 1460 __ LoadRR(scratch, left); |
| 1461 __ mr_z(r0, right); |
| 1462 __ LoadRR(result, scratch); |
| 1463 } |
| 1464 __ TestIfInt32(r0, result, scratch); |
| 1465 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); |
| 1466 #endif |
| 1431 } | 1467 } |
| 1432 __ TestIfInt32(result, r0); | |
| 1433 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); | |
| 1434 if (instr->hydrogen()->representation().IsSmi()) { | |
| 1435 __ SmiTag(result); | |
| 1436 } | |
| 1437 #else | |
| 1438 // r0:scratch = scratch * right | |
| 1439 if (instr->hydrogen()->representation().IsSmi()) { | |
| 1440 __ SmiUntag(scratch, left); | |
| 1441 __ mr_z(r0, right); | |
| 1442 __ LoadRR(result, scratch); | |
| 1443 } else { | |
| 1444 // r0:scratch = scratch * right | |
| 1445 __ LoadRR(scratch, left); | |
| 1446 __ mr_z(r0, right); | |
| 1447 __ LoadRR(result, scratch); | |
| 1448 } | |
| 1449 __ TestIfInt32(r0, result, scratch); | |
| 1450 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); | |
| 1451 #endif | |
| 1452 } else { | 1468 } else { |
| 1453 if (instr->hydrogen()->representation().IsSmi()) { | 1469 if (instr->hydrogen()->representation().IsSmi()) { |
| 1454 __ SmiUntag(result, left); | 1470 __ SmiUntag(result, left); |
| 1455 __ Mul(result, result, right); | 1471 __ Mul(result, result, right); |
| 1456 } else { | 1472 } else { |
| 1457 __ Mul(result, left, right); | 1473 __ Mul(result, left, right); |
| 1458 } | 1474 } |
| 1459 } | 1475 } |
| 1460 | 1476 |
| 1461 if (bailout_on_minus_zero) { | 1477 if (bailout_on_minus_zero) { |
| (...skipping 4137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5599 __ LoadP(result, | 5615 __ LoadP(result, |
| 5600 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5616 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
| 5601 __ bind(deferred->exit()); | 5617 __ bind(deferred->exit()); |
| 5602 __ bind(&done); | 5618 __ bind(&done); |
| 5603 } | 5619 } |
| 5604 | 5620 |
| 5605 #undef __ | 5621 #undef __ |
| 5606 | 5622 |
| 5607 } // namespace internal | 5623 } // namespace internal |
| 5608 } // namespace v8 | 5624 } // namespace v8 |
| OLD | NEW |