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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 1387 matching lines...) Loading... |
1398 vss(0x5d, dst, src1, src2); | 1398 vss(0x5d, dst, src1, src2); |
1399 } | 1399 } |
1400 void vminss(XMMRegister dst, XMMRegister src1, const Operand& src2) { | 1400 void vminss(XMMRegister dst, XMMRegister src1, const Operand& src2) { |
1401 vss(0x5d, dst, src1, src2); | 1401 vss(0x5d, dst, src1, src2); |
1402 } | 1402 } |
1403 void vucomiss(XMMRegister dst, XMMRegister src); | 1403 void vucomiss(XMMRegister dst, XMMRegister src); |
1404 void vucomiss(XMMRegister dst, const Operand& src); | 1404 void vucomiss(XMMRegister dst, const Operand& src); |
1405 void vss(byte op, XMMRegister dst, XMMRegister src1, XMMRegister src2); | 1405 void vss(byte op, XMMRegister dst, XMMRegister src1, XMMRegister src2); |
1406 void vss(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); | 1406 void vss(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); |
1407 | 1407 |
| 1408 // BMI instruction |
| 1409 void andnq(Register dst, Register src1, Register src2) { |
| 1410 bmi1q(0xf2, dst, src1, src2); |
| 1411 } |
| 1412 void andnq(Register dst, Register src1, const Operand& src2) { |
| 1413 bmi1q(0xf2, dst, src1, src2); |
| 1414 } |
| 1415 void andnl(Register dst, Register src1, Register src2) { |
| 1416 bmi1l(0xf2, dst, src1, src2); |
| 1417 } |
| 1418 void andnl(Register dst, Register src1, const Operand& src2) { |
| 1419 bmi1l(0xf2, dst, src1, src2); |
| 1420 } |
| 1421 void bextrq(Register dst, Register src1, Register src2) { |
| 1422 bmi1q(0xf7, dst, src2, src1); |
| 1423 } |
| 1424 void bextrq(Register dst, const Operand& src1, Register src2) { |
| 1425 bmi1q(0xf7, dst, src2, src1); |
| 1426 } |
| 1427 void bextrl(Register dst, Register src1, Register src2) { |
| 1428 bmi1l(0xf7, dst, src2, src1); |
| 1429 } |
| 1430 void bextrl(Register dst, const Operand& src1, Register src2) { |
| 1431 bmi1l(0xf7, dst, src2, src1); |
| 1432 } |
| 1433 void blsiq(Register dst, Register src) { |
| 1434 Register ireg = {3}; |
| 1435 bmi1q(0xf3, ireg, dst, src); |
| 1436 } |
| 1437 void blsiq(Register dst, const Operand& src) { |
| 1438 Register ireg = {3}; |
| 1439 bmi1q(0xf3, ireg, dst, src); |
| 1440 } |
| 1441 void blsil(Register dst, Register src) { |
| 1442 Register ireg = {3}; |
| 1443 bmi1l(0xf3, ireg, dst, src); |
| 1444 } |
| 1445 void blsil(Register dst, const Operand& src) { |
| 1446 Register ireg = {3}; |
| 1447 bmi1l(0xf3, ireg, dst, src); |
| 1448 } |
| 1449 void blsmskq(Register dst, Register src) { |
| 1450 Register ireg = {2}; |
| 1451 bmi1q(0xf3, ireg, dst, src); |
| 1452 } |
| 1453 void blsmskq(Register dst, const Operand& src) { |
| 1454 Register ireg = {2}; |
| 1455 bmi1q(0xf3, ireg, dst, src); |
| 1456 } |
| 1457 void blsmskl(Register dst, Register src) { |
| 1458 Register ireg = {2}; |
| 1459 bmi1l(0xf3, ireg, dst, src); |
| 1460 } |
| 1461 void blsmskl(Register dst, const Operand& src) { |
| 1462 Register ireg = {2}; |
| 1463 bmi1l(0xf3, ireg, dst, src); |
| 1464 } |
| 1465 void blsrq(Register dst, Register src) { |
| 1466 Register ireg = {1}; |
| 1467 bmi1q(0xf3, ireg, dst, src); |
| 1468 } |
| 1469 void blsrq(Register dst, const Operand& src) { |
| 1470 Register ireg = {1}; |
| 1471 bmi1q(0xf3, ireg, dst, src); |
| 1472 } |
| 1473 void blsrl(Register dst, Register src) { |
| 1474 Register ireg = {1}; |
| 1475 bmi1l(0xf3, ireg, dst, src); |
| 1476 } |
| 1477 void blsrl(Register dst, const Operand& src) { |
| 1478 Register ireg = {1}; |
| 1479 bmi1l(0xf3, ireg, dst, src); |
| 1480 } |
| 1481 void tzcntq(Register dst, Register src); |
| 1482 void tzcntq(Register dst, const Operand& src); |
| 1483 void tzcntl(Register dst, Register src); |
| 1484 void tzcntl(Register dst, const Operand& src); |
| 1485 |
| 1486 void lzcntq(Register dst, Register src); |
| 1487 void lzcntq(Register dst, const Operand& src); |
| 1488 void lzcntl(Register dst, Register src); |
| 1489 void lzcntl(Register dst, const Operand& src); |
| 1490 |
| 1491 void popcntq(Register dst, Register src); |
| 1492 void popcntq(Register dst, const Operand& src); |
| 1493 void popcntl(Register dst, Register src); |
| 1494 void popcntl(Register dst, const Operand& src); |
| 1495 |
| 1496 void bzhiq(Register dst, Register src1, Register src2) { |
| 1497 bmi2q(kNone, 0xf5, dst, src2, src1); |
| 1498 } |
| 1499 void bzhiq(Register dst, const Operand& src1, Register src2) { |
| 1500 bmi2q(kNone, 0xf5, dst, src2, src1); |
| 1501 } |
| 1502 void bzhil(Register dst, Register src1, Register src2) { |
| 1503 bmi2l(kNone, 0xf5, dst, src2, src1); |
| 1504 } |
| 1505 void bzhil(Register dst, const Operand& src1, Register src2) { |
| 1506 bmi2l(kNone, 0xf5, dst, src2, src1); |
| 1507 } |
| 1508 void mulxq(Register dst1, Register dst2, Register src) { |
| 1509 bmi2q(kF2, 0xf6, dst1, dst2, src); |
| 1510 } |
| 1511 void mulxq(Register dst1, Register dst2, const Operand& src) { |
| 1512 bmi2q(kF2, 0xf6, dst1, dst2, src); |
| 1513 } |
| 1514 void mulxl(Register dst1, Register dst2, Register src) { |
| 1515 bmi2l(kF2, 0xf6, dst1, dst2, src); |
| 1516 } |
| 1517 void mulxl(Register dst1, Register dst2, const Operand& src) { |
| 1518 bmi2l(kF2, 0xf6, dst1, dst2, src); |
| 1519 } |
| 1520 void pdepq(Register dst, Register src1, Register src2) { |
| 1521 bmi2q(kF2, 0xf5, dst, src1, src2); |
| 1522 } |
| 1523 void pdepq(Register dst, Register src1, const Operand& src2) { |
| 1524 bmi2q(kF2, 0xf5, dst, src1, src2); |
| 1525 } |
| 1526 void pdepl(Register dst, Register src1, Register src2) { |
| 1527 bmi2l(kF2, 0xf5, dst, src1, src2); |
| 1528 } |
| 1529 void pdepl(Register dst, Register src1, const Operand& src2) { |
| 1530 bmi2l(kF2, 0xf5, dst, src1, src2); |
| 1531 } |
| 1532 void pextq(Register dst, Register src1, Register src2) { |
| 1533 bmi2q(kF3, 0xf5, dst, src1, src2); |
| 1534 } |
| 1535 void pextq(Register dst, Register src1, const Operand& src2) { |
| 1536 bmi2q(kF3, 0xf5, dst, src1, src2); |
| 1537 } |
| 1538 void pextl(Register dst, Register src1, Register src2) { |
| 1539 bmi2l(kF3, 0xf5, dst, src1, src2); |
| 1540 } |
| 1541 void pextl(Register dst, Register src1, const Operand& src2) { |
| 1542 bmi2l(kF3, 0xf5, dst, src1, src2); |
| 1543 } |
| 1544 void sarxq(Register dst, Register src1, Register src2) { |
| 1545 bmi2q(kF3, 0xf7, dst, src2, src1); |
| 1546 } |
| 1547 void sarxq(Register dst, const Operand& src1, Register src2) { |
| 1548 bmi2q(kF3, 0xf7, dst, src2, src1); |
| 1549 } |
| 1550 void sarxl(Register dst, Register src1, Register src2) { |
| 1551 bmi2l(kF3, 0xf7, dst, src2, src1); |
| 1552 } |
| 1553 void sarxl(Register dst, const Operand& src1, Register src2) { |
| 1554 bmi2l(kF3, 0xf7, dst, src2, src1); |
| 1555 } |
| 1556 void shlxq(Register dst, Register src1, Register src2) { |
| 1557 bmi2q(k66, 0xf7, dst, src2, src1); |
| 1558 } |
| 1559 void shlxq(Register dst, const Operand& src1, Register src2) { |
| 1560 bmi2q(k66, 0xf7, dst, src2, src1); |
| 1561 } |
| 1562 void shlxl(Register dst, Register src1, Register src2) { |
| 1563 bmi2l(k66, 0xf7, dst, src2, src1); |
| 1564 } |
| 1565 void shlxl(Register dst, const Operand& src1, Register src2) { |
| 1566 bmi2l(k66, 0xf7, dst, src2, src1); |
| 1567 } |
| 1568 void shrxq(Register dst, Register src1, Register src2) { |
| 1569 bmi2q(kF2, 0xf7, dst, src2, src1); |
| 1570 } |
| 1571 void shrxq(Register dst, const Operand& src1, Register src2) { |
| 1572 bmi2q(kF2, 0xf7, dst, src2, src1); |
| 1573 } |
| 1574 void shrxl(Register dst, Register src1, Register src2) { |
| 1575 bmi2l(kF2, 0xf7, dst, src2, src1); |
| 1576 } |
| 1577 void shrxl(Register dst, const Operand& src1, Register src2) { |
| 1578 bmi2l(kF2, 0xf7, dst, src2, src1); |
| 1579 } |
| 1580 void rorxq(Register dst, Register src, byte imm8); |
| 1581 void rorxq(Register dst, const Operand& src, byte imm8); |
| 1582 void rorxl(Register dst, Register src, byte imm8); |
| 1583 void rorxl(Register dst, const Operand& src, byte imm8); |
| 1584 |
1408 // Debugging | 1585 // Debugging |
1409 void Print(); | 1586 void Print(); |
1410 | 1587 |
1411 // Check the code size generated from label to here. | 1588 // Check the code size generated from label to here. |
1412 int SizeOfCodeGeneratedSince(Label* label) { | 1589 int SizeOfCodeGeneratedSince(Label* label) { |
1413 return pc_offset() - label->pos(); | 1590 return pc_offset() - label->pos(); |
1414 } | 1591 } |
1415 | 1592 |
1416 // Mark address of the ExitJSFrame code. | 1593 // Mark address of the ExitJSFrame code. |
1417 void RecordJSReturn(); | 1594 void RecordJSReturn(); |
(...skipping 177 matching lines...) Loading... |
1595 if (size == kInt64Size) { | 1772 if (size == kInt64Size) { |
1596 emit_rex_64(p1, p2); | 1773 emit_rex_64(p1, p2); |
1597 } else { | 1774 } else { |
1598 DCHECK(size == kInt32Size); | 1775 DCHECK(size == kInt32Size); |
1599 emit_optional_rex_32(p1, p2); | 1776 emit_optional_rex_32(p1, p2); |
1600 } | 1777 } |
1601 } | 1778 } |
1602 | 1779 |
1603 // Emit vex prefix | 1780 // Emit vex prefix |
1604 enum SIMDPrefix { kNone = 0x0, k66 = 0x1, kF3 = 0x2, kF2 = 0x3 }; | 1781 enum SIMDPrefix { kNone = 0x0, k66 = 0x1, kF3 = 0x2, kF2 = 0x3 }; |
1605 enum VectorLength { kL128 = 0x0, kL256 = 0x4, kLIG = kL128 }; | 1782 enum VectorLength { kL128 = 0x0, kL256 = 0x4, kLIG = kL128, kLZ = kL128 }; |
1606 enum VexW { kW0 = 0x0, kW1 = 0x80, kWIG = kW0 }; | 1783 enum VexW { kW0 = 0x0, kW1 = 0x80, kWIG = kW0 }; |
1607 enum LeadingOpcode { k0F = 0x1, k0F38 = 0x2, k0F3A = 0x2 }; | 1784 enum LeadingOpcode { k0F = 0x1, k0F38 = 0x2, k0F3A = 0x3 }; |
1608 | 1785 |
1609 void emit_vex2_byte0() { emit(0xc5); } | 1786 void emit_vex2_byte0() { emit(0xc5); } |
1610 inline void emit_vex2_byte1(XMMRegister reg, XMMRegister v, VectorLength l, | 1787 inline void emit_vex2_byte1(XMMRegister reg, XMMRegister v, VectorLength l, |
1611 SIMDPrefix pp); | 1788 SIMDPrefix pp); |
1612 void emit_vex3_byte0() { emit(0xc4); } | 1789 void emit_vex3_byte0() { emit(0xc4); } |
1613 inline void emit_vex3_byte1(XMMRegister reg, XMMRegister rm, LeadingOpcode m); | 1790 inline void emit_vex3_byte1(XMMRegister reg, XMMRegister rm, LeadingOpcode m); |
1614 inline void emit_vex3_byte1(XMMRegister reg, const Operand& rm, | 1791 inline void emit_vex3_byte1(XMMRegister reg, const Operand& rm, |
1615 LeadingOpcode m); | 1792 LeadingOpcode m); |
1616 inline void emit_vex3_byte2(VexW w, XMMRegister v, VectorLength l, | 1793 inline void emit_vex3_byte2(VexW w, XMMRegister v, VectorLength l, |
1617 SIMDPrefix pp); | 1794 SIMDPrefix pp); |
1618 inline void emit_vex_prefix(XMMRegister reg, XMMRegister v, XMMRegister rm, | 1795 inline void emit_vex_prefix(XMMRegister reg, XMMRegister v, XMMRegister rm, |
1619 VectorLength l, SIMDPrefix pp, LeadingOpcode m, | 1796 VectorLength l, SIMDPrefix pp, LeadingOpcode m, |
1620 VexW w); | 1797 VexW w); |
| 1798 inline void emit_vex_prefix(Register reg, Register v, Register rm, |
| 1799 VectorLength l, SIMDPrefix pp, LeadingOpcode m, |
| 1800 VexW w); |
1621 inline void emit_vex_prefix(XMMRegister reg, XMMRegister v, const Operand& rm, | 1801 inline void emit_vex_prefix(XMMRegister reg, XMMRegister v, const Operand& rm, |
1622 VectorLength l, SIMDPrefix pp, LeadingOpcode m, | 1802 VectorLength l, SIMDPrefix pp, LeadingOpcode m, |
1623 VexW w); | 1803 VexW w); |
| 1804 inline void emit_vex_prefix(Register reg, Register v, const Operand& rm, |
| 1805 VectorLength l, SIMDPrefix pp, LeadingOpcode m, |
| 1806 VexW w); |
1624 | 1807 |
1625 // Emit the ModR/M byte, and optionally the SIB byte and | 1808 // Emit the ModR/M byte, and optionally the SIB byte and |
1626 // 1- or 4-byte offset for a memory operand. Also encodes | 1809 // 1- or 4-byte offset for a memory operand. Also encodes |
1627 // the second operand of the operation, a register or operation | 1810 // the second operand of the operation, a register or operation |
1628 // subcode, into the reg field of the ModR/M byte. | 1811 // subcode, into the reg field of the ModR/M byte. |
1629 void emit_operand(Register reg, const Operand& adr) { | 1812 void emit_operand(Register reg, const Operand& adr) { |
1630 emit_operand(reg.low_bits(), adr); | 1813 emit_operand(reg.low_bits(), adr); |
1631 } | 1814 } |
1632 | 1815 |
1633 // Emit the ModR/M byte, and optionally the SIB byte and | 1816 // Emit the ModR/M byte, and optionally the SIB byte and |
(...skipping 254 matching lines...) Loading... |
1888 } | 2071 } |
1889 | 2072 |
1890 void emit_xor(const Operand& dst, Immediate src, int size) { | 2073 void emit_xor(const Operand& dst, Immediate src, int size) { |
1891 immediate_arithmetic_op(0x6, dst, src, size); | 2074 immediate_arithmetic_op(0x6, dst, src, size); |
1892 } | 2075 } |
1893 | 2076 |
1894 void emit_xor(const Operand& dst, Register src, int size) { | 2077 void emit_xor(const Operand& dst, Register src, int size) { |
1895 arithmetic_op(0x31, src, dst, size); | 2078 arithmetic_op(0x31, src, dst, size); |
1896 } | 2079 } |
1897 | 2080 |
| 2081 // Most BMI instructions are similiar. |
| 2082 void bmi1q(byte op, Register reg, Register vreg, Register rm); |
| 2083 void bmi1q(byte op, Register reg, Register vreg, const Operand& rm); |
| 2084 void bmi1l(byte op, Register reg, Register vreg, Register rm); |
| 2085 void bmi1l(byte op, Register reg, Register vreg, const Operand& rm); |
| 2086 void bmi2q(SIMDPrefix pp, byte op, Register reg, Register vreg, Register rm); |
| 2087 void bmi2q(SIMDPrefix pp, byte op, Register reg, Register vreg, |
| 2088 const Operand& rm); |
| 2089 void bmi2l(SIMDPrefix pp, byte op, Register reg, Register vreg, Register rm); |
| 2090 void bmi2l(SIMDPrefix pp, byte op, Register reg, Register vreg, |
| 2091 const Operand& rm); |
| 2092 |
1898 friend class CodePatcher; | 2093 friend class CodePatcher; |
1899 friend class EnsureSpace; | 2094 friend class EnsureSpace; |
1900 friend class RegExpMacroAssemblerX64; | 2095 friend class RegExpMacroAssemblerX64; |
1901 | 2096 |
1902 // code generation | 2097 // code generation |
1903 RelocInfoWriter reloc_info_writer; | 2098 RelocInfoWriter reloc_info_writer; |
1904 | 2099 |
1905 // Internal reference positions, required for (potential) patching in | 2100 // Internal reference positions, required for (potential) patching in |
1906 // GrowBuffer(); contains only those internal references whose labels | 2101 // GrowBuffer(); contains only those internal references whose labels |
1907 // are already bound. | 2102 // are already bound. |
(...skipping 29 matching lines...) Loading... |
1937 private: | 2132 private: |
1938 Assembler* assembler_; | 2133 Assembler* assembler_; |
1939 #ifdef DEBUG | 2134 #ifdef DEBUG |
1940 int space_before_; | 2135 int space_before_; |
1941 #endif | 2136 #endif |
1942 }; | 2137 }; |
1943 | 2138 |
1944 } } // namespace v8::internal | 2139 } } // namespace v8::internal |
1945 | 2140 |
1946 #endif // V8_X64_ASSEMBLER_X64_H_ | 2141 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |