OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 void Assembler::vldr(const DwVfpRegister dst, | 1306 void Assembler::vldr(const DwVfpRegister dst, |
1307 const Register base, | 1307 const Register base, |
1308 int offset, | 1308 int offset, |
1309 const Condition cond) { | 1309 const Condition cond) { |
1310 // Ddst = MEM(Rbase + offset). | 1310 // Ddst = MEM(Rbase + offset). |
1311 // Instruction details available in ARM DDI 0406A, A8-628. | 1311 // Instruction details available in ARM DDI 0406A, A8-628. |
1312 // cond(31-28) | 1101(27-24)| 1001(23-20) | Rbase(19-16) | | 1312 // cond(31-28) | 1101(27-24)| 1001(23-20) | Rbase(19-16) | |
1313 // Vdst(15-12) | 1011(11-8) | offset | 1313 // Vdst(15-12) | 1011(11-8) | offset |
1314 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1314 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
1315 ASSERT(offset % 4 == 0); | 1315 ASSERT(offset % 4 == 0); |
| 1316 ASSERT((offset / 4) < 256); |
1316 emit(cond | 0xD9*B20 | base.code()*B16 | dst.code()*B12 | | 1317 emit(cond | 0xD9*B20 | base.code()*B16 | dst.code()*B12 | |
1317 0xB*B8 | ((offset / 4) & 255)); | 1318 0xB*B8 | ((offset / 4) & 255)); |
1318 } | 1319 } |
1319 | 1320 |
1320 | 1321 |
| 1322 void Assembler::vldr(const SwVfpRegister dst, |
| 1323 const Register base, |
| 1324 int offset, |
| 1325 const Condition cond) { |
| 1326 // Sdst = MEM(Rbase + offset). |
| 1327 // Instruction details available in ARM DDI 0406A, A8-628. |
| 1328 // cond(31-28) | 1101(27-24)| 1001(23-20) | Rbase(19-16) | |
| 1329 // Vdst(15-12) | 1010(11-8) | offset |
| 1330 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1331 ASSERT(offset % 4 == 0); |
| 1332 ASSERT((offset / 4) < 256); |
| 1333 emit(cond | 0xD9*B20 | base.code()*B16 | dst.code()*B12 | |
| 1334 0xA*B8 | ((offset / 4) & 255)); |
| 1335 } |
| 1336 |
| 1337 |
1321 void Assembler::vstr(const DwVfpRegister src, | 1338 void Assembler::vstr(const DwVfpRegister src, |
1322 const Register base, | 1339 const Register base, |
1323 int offset, | 1340 int offset, |
1324 const Condition cond) { | 1341 const Condition cond) { |
1325 // MEM(Rbase + offset) = Dsrc. | 1342 // MEM(Rbase + offset) = Dsrc. |
1326 // Instruction details available in ARM DDI 0406A, A8-786. | 1343 // Instruction details available in ARM DDI 0406A, A8-786. |
1327 // cond(31-28) | 1101(27-24)| 1000(23-20) | | Rbase(19-16) | | 1344 // cond(31-28) | 1101(27-24)| 1000(23-20) | | Rbase(19-16) | |
1328 // Vsrc(15-12) | 1011(11-8) | (offset/4) | 1345 // Vsrc(15-12) | 1011(11-8) | (offset/4) |
1329 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1346 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
1330 ASSERT(offset % 4 == 0); | 1347 ASSERT(offset % 4 == 0); |
| 1348 ASSERT((offset / 4) < 256); |
1331 emit(cond | 0xD8*B20 | base.code()*B16 | src.code()*B12 | | 1349 emit(cond | 0xD8*B20 | base.code()*B16 | src.code()*B12 | |
1332 0xB*B8 | ((offset / 4) & 255)); | 1350 0xB*B8 | ((offset / 4) & 255)); |
1333 } | 1351 } |
1334 | 1352 |
1335 | 1353 |
1336 void Assembler::vmov(const DwVfpRegister dst, | 1354 void Assembler::vmov(const DwVfpRegister dst, |
1337 const Register src1, | 1355 const Register src1, |
1338 const Register src2, | 1356 const Register src2, |
1339 const Condition cond) { | 1357 const Condition cond) { |
1340 // Dm = <Rt,Rt2>. | 1358 // Dm = <Rt,Rt2>. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 // Instruction details available in ARM DDI 0406A, A8-642. | 1402 // Instruction details available in ARM DDI 0406A, A8-642. |
1385 // cond(31-28) | 1110(27-24)| 000(23-21) | op=1(20) | Vn(19-16) | | 1403 // cond(31-28) | 1110(27-24)| 000(23-21) | op=1(20) | Vn(19-16) | |
1386 // Rt(15-12) | 1010(11-8) | N(7)=0 | 00(6-5) | 1(4) | 0000(3-0) | 1404 // Rt(15-12) | 1010(11-8) | N(7)=0 | 00(6-5) | 1(4) | 0000(3-0) |
1387 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1405 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
1388 ASSERT(!dst.is(pc)); | 1406 ASSERT(!dst.is(pc)); |
1389 emit(cond | 0xE*B24 | B20 | (src.code() >> 1)*B16 | | 1407 emit(cond | 0xE*B24 | B20 | (src.code() >> 1)*B16 | |
1390 dst.code()*B12 | 0xA*B8 | (0x1 & src.code())*B7 | B4); | 1408 dst.code()*B12 | 0xA*B8 | (0x1 & src.code())*B7 | B4); |
1391 } | 1409 } |
1392 | 1410 |
1393 | 1411 |
1394 void Assembler::vcvt(const DwVfpRegister dst, | 1412 // Type of data to read from or write to VFP register. |
1395 const SwVfpRegister src, | 1413 // Used as specifier in generic vcvt instruction. |
1396 const Condition cond) { | 1414 enum VFPType { S32, U32, F32, F64 }; |
1397 // Dd = Sm (integer in Sm converted to IEEE 64-bit doubles in Dd). | 1415 |
1398 // Instruction details available in ARM DDI 0406A, A8-576. | 1416 |
1399 // cond(31-28) | 11101(27-23)| D=?(22) | 11(21-20) | 1(19) | opc2=000(18-16) | | 1417 static bool IsSignedVFPType(VFPType type) { |
1400 // Vd(15-12) | 101(11-9) | sz(8)=1 | op(7)=1 | 1(6) | M=?(5) | 0(4) | Vm(3-0) | 1418 switch (type) { |
1401 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1419 case S32: |
1402 emit(cond | 0xE*B24 | B23 | 0x3*B20 | B19 | | 1420 return true; |
1403 dst.code()*B12 | 0x5*B9 | B8 | B7 | B6 | | 1421 case U32: |
1404 (0x1 & src.code())*B5 | (src.code() >> 1)); | 1422 return false; |
| 1423 default: |
| 1424 UNREACHABLE(); |
| 1425 return false; |
| 1426 } |
1405 } | 1427 } |
1406 | 1428 |
1407 | 1429 |
1408 void Assembler::vcvt(const SwVfpRegister dst, | 1430 static bool IsIntegerVFPType(VFPType type) { |
1409 const DwVfpRegister src, | 1431 switch (type) { |
1410 const Condition cond) { | 1432 case S32: |
1411 // Sd = Dm (IEEE 64-bit doubles in Dm converted to 32 bit integer in Sd). | 1433 case U32: |
1412 // Instruction details available in ARM DDI 0406A, A8-576. | 1434 return true; |
1413 // cond(31-28) | 11101(27-23)| D=?(22) | 11(21-20) | 1(19) | opc2=101(18-16)| | 1435 case F32: |
1414 // Vd(15-12) | 101(11-9) | sz(8)=1 | op(7)=? | 1(6) | M=?(5) | 0(4) | Vm(3-0) | 1436 case F64: |
| 1437 return false; |
| 1438 default: |
| 1439 UNREACHABLE(); |
| 1440 return false; |
| 1441 } |
| 1442 } |
| 1443 |
| 1444 |
| 1445 static bool IsDoubleVFPType(VFPType type) { |
| 1446 switch (type) { |
| 1447 case F32: |
| 1448 return false; |
| 1449 case F64: |
| 1450 return true; |
| 1451 default: |
| 1452 UNREACHABLE(); |
| 1453 return false; |
| 1454 } |
| 1455 } |
| 1456 |
| 1457 |
| 1458 // Depending on split_last_bit split binary representation of reg_code into Vm:M |
| 1459 // or M:Vm form (where M is single bit). |
| 1460 static void SplitRegCode(bool split_last_bit, |
| 1461 int reg_code, |
| 1462 int* vm, |
| 1463 int* m) { |
| 1464 if (split_last_bit) { |
| 1465 *m = reg_code & 0x1; |
| 1466 *vm = reg_code >> 1; |
| 1467 } else { |
| 1468 *m = (reg_code & 0x10) >> 4; |
| 1469 *vm = reg_code & 0x0F; |
| 1470 } |
| 1471 } |
| 1472 |
| 1473 |
| 1474 // Encode vcvt.src_type.dst_type instruction. |
| 1475 static Instr EncodeVCVT(const VFPType dst_type, |
| 1476 const int dst_code, |
| 1477 const VFPType src_type, |
| 1478 const int src_code, |
| 1479 const Condition cond) { |
| 1480 if (IsIntegerVFPType(dst_type) || IsIntegerVFPType(src_type)) { |
| 1481 // Conversion between IEEE floating point and 32-bit integer. |
| 1482 // Instruction details available in ARM DDI 0406B, A8.6.295. |
| 1483 // cond(31-28) | 11101(27-23)| D(22) | 11(21-20) | 1(19) | opc2(18-16) | |
| 1484 // Vd(15-12) | 101(11-9) | sz(8) | op(7) | 1(6) | M(5) | 0(4) | Vm(3-0) |
| 1485 ASSERT(!IsIntegerVFPType(dst_type) || !IsIntegerVFPType(src_type)); |
| 1486 |
| 1487 int sz, opc2, D, Vd, M, Vm, op; |
| 1488 |
| 1489 if (IsIntegerVFPType(dst_type)) { |
| 1490 opc2 = IsSignedVFPType(dst_type) ? 0x5 : 0x4; |
| 1491 sz = IsDoubleVFPType(src_type) ? 0x1 : 0x0; |
| 1492 op = 1; // round towards zero |
| 1493 SplitRegCode(!IsDoubleVFPType(src_type), src_code, &Vm, &M); |
| 1494 SplitRegCode(true, dst_code, &Vd, &D); |
| 1495 } else { |
| 1496 ASSERT(IsIntegerVFPType(src_type)); |
| 1497 |
| 1498 opc2 = 0x0; |
| 1499 sz = IsDoubleVFPType(dst_type) ? 0x1 : 0x0; |
| 1500 op = IsSignedVFPType(src_type) ? 0x1 : 0x0; |
| 1501 SplitRegCode(true, src_code, &Vm, &M); |
| 1502 SplitRegCode(!IsDoubleVFPType(dst_type), dst_code, &Vd, &D); |
| 1503 } |
| 1504 |
| 1505 return (cond | 0xE*B24 | B23 | D*B22 | 0x3*B20 | B19 | opc2*B16 | |
| 1506 Vd*B12 | 0x5*B9 | sz*B8 | op*B7 | B6 | M*B5 | Vm); |
| 1507 } else { |
| 1508 // Conversion between IEEE double and single precision. |
| 1509 // Instruction details available in ARM DDI 0406B, A8.6.298. |
| 1510 // cond(31-28) | 11101(27-23)| D(22) | 11(21-20) | 0111(19-16) | |
| 1511 // Vd(15-12) | 101(11-9) | sz(8) | 1(7) | 1(6) | M(5) | 0(4) | Vm(3-0) |
| 1512 int sz, D, Vd, M, Vm; |
| 1513 |
| 1514 ASSERT(IsDoubleVFPType(dst_type) != IsDoubleVFPType(src_type)); |
| 1515 sz = IsDoubleVFPType(src_type) ? 0x1 : 0x0; |
| 1516 SplitRegCode(IsDoubleVFPType(src_type), dst_code, &Vd, &D); |
| 1517 SplitRegCode(!IsDoubleVFPType(src_type), src_code, &Vm, &M); |
| 1518 |
| 1519 return (cond | 0xE*B24 | B23 | D*B22 | 0x3*B20 | 0x7*B16 | |
| 1520 Vd*B12 | 0x5*B9 | sz*B8 | B7 | B6 | M*B5 | Vm); |
| 1521 } |
| 1522 } |
| 1523 |
| 1524 |
| 1525 void Assembler::vcvt_f64_s32(const DwVfpRegister dst, |
| 1526 const SwVfpRegister src, |
| 1527 const Condition cond) { |
1415 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1528 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
1416 emit(cond | 0xE*B24 | B23 |(0x1 & dst.code())*B22 | | 1529 emit(EncodeVCVT(F64, dst.code(), S32, src.code(), cond)); |
1417 0x3*B20 | B19 | 0x5*B16 | (dst.code() >> 1)*B12 | | 1530 } |
1418 0x5*B9 | B8 | B7 | B6 | src.code()); | 1531 |
| 1532 |
| 1533 void Assembler::vcvt_f32_s32(const SwVfpRegister dst, |
| 1534 const SwVfpRegister src, |
| 1535 const Condition cond) { |
| 1536 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1537 emit(EncodeVCVT(F32, dst.code(), S32, src.code(), cond)); |
| 1538 } |
| 1539 |
| 1540 |
| 1541 void Assembler::vcvt_f64_u32(const DwVfpRegister dst, |
| 1542 const SwVfpRegister src, |
| 1543 const Condition cond) { |
| 1544 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1545 emit(EncodeVCVT(F64, dst.code(), U32, src.code(), cond)); |
| 1546 } |
| 1547 |
| 1548 |
| 1549 void Assembler::vcvt_s32_f64(const SwVfpRegister dst, |
| 1550 const DwVfpRegister src, |
| 1551 const Condition cond) { |
| 1552 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1553 emit(EncodeVCVT(S32, dst.code(), F64, src.code(), cond)); |
| 1554 } |
| 1555 |
| 1556 |
| 1557 void Assembler::vcvt_u32_f64(const SwVfpRegister dst, |
| 1558 const DwVfpRegister src, |
| 1559 const Condition cond) { |
| 1560 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1561 emit(EncodeVCVT(U32, dst.code(), F64, src.code(), cond)); |
| 1562 } |
| 1563 |
| 1564 |
| 1565 void Assembler::vcvt_f64_f32(const DwVfpRegister dst, |
| 1566 const SwVfpRegister src, |
| 1567 const Condition cond) { |
| 1568 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1569 emit(EncodeVCVT(F64, dst.code(), F32, src.code(), cond)); |
| 1570 } |
| 1571 |
| 1572 |
| 1573 void Assembler::vcvt_f32_f64(const SwVfpRegister dst, |
| 1574 const DwVfpRegister src, |
| 1575 const Condition cond) { |
| 1576 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 1577 emit(EncodeVCVT(F32, dst.code(), F64, src.code(), cond)); |
1419 } | 1578 } |
1420 | 1579 |
1421 | 1580 |
1422 void Assembler::vadd(const DwVfpRegister dst, | 1581 void Assembler::vadd(const DwVfpRegister dst, |
1423 const DwVfpRegister src1, | 1582 const DwVfpRegister src1, |
1424 const DwVfpRegister src2, | 1583 const DwVfpRegister src2, |
1425 const Condition cond) { | 1584 const Condition cond) { |
1426 // Dd = vadd(Dn, Dm) double precision floating point addition. | 1585 // Dd = vadd(Dn, Dm) double precision floating point addition. |
1427 // Dd = D:Vd; Dm=M:Vm; Dn=N:Vm. | 1586 // Dd = D:Vd; Dm=M:Vm; Dn=N:Vm. |
1428 // Instruction details available in ARM DDI 0406A, A8-536. | 1587 // Instruction details available in ARM DDI 0406A, A8-536. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 bind(&after_pool); | 1934 bind(&after_pool); |
1776 } | 1935 } |
1777 | 1936 |
1778 // Since a constant pool was just emitted, move the check offset forward by | 1937 // Since a constant pool was just emitted, move the check offset forward by |
1779 // the standard interval. | 1938 // the standard interval. |
1780 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 1939 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
1781 } | 1940 } |
1782 | 1941 |
1783 | 1942 |
1784 } } // namespace v8::internal | 1943 } } // namespace v8::internal |
OLD | NEW |