| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <assert.h> | 5 #include <assert.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
| 10 | 10 |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 } else if (third_byte == 0x14) { | 1675 } else if (third_byte == 0x14) { |
| 1676 get_modrm(*current, &mod, ®op, &rm); | 1676 get_modrm(*current, &mod, ®op, &rm); |
| 1677 AppendToBuffer("pextrb "); // reg/m32, xmm, imm8 | 1677 AppendToBuffer("pextrb "); // reg/m32, xmm, imm8 |
| 1678 current += PrintRightOperand(current); | 1678 current += PrintRightOperand(current); |
| 1679 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 3); | 1679 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 3); |
| 1680 current += 1; | 1680 current += 1; |
| 1681 } else if (third_byte == 0x15) { | 1681 } else if (third_byte == 0x15) { |
| 1682 get_modrm(*current, &mod, ®op, &rm); | 1682 get_modrm(*current, &mod, ®op, &rm); |
| 1683 AppendToBuffer("pextrw "); // reg/m32, xmm, imm8 | 1683 AppendToBuffer("pextrw "); // reg/m32, xmm, imm8 |
| 1684 current += PrintRightOperand(current); | 1684 current += PrintRightOperand(current); |
| 1685 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 3); | 1685 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 7); |
| 1686 current += 1; | 1686 current += 1; |
| 1687 } else if (third_byte == 0x16) { | 1687 } else if (third_byte == 0x16) { |
| 1688 get_modrm(*current, &mod, ®op, &rm); | 1688 get_modrm(*current, &mod, ®op, &rm); |
| 1689 AppendToBuffer("pextrd "); // reg/m32, xmm, imm8 | 1689 AppendToBuffer("pextrd "); // reg/m32, xmm, imm8 |
| 1690 current += PrintRightOperand(current); | 1690 current += PrintRightOperand(current); |
| 1691 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 3); | 1691 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), (*current) & 3); |
| 1692 current += 1; | 1692 current += 1; |
| 1693 } else if (third_byte == 0x20) { | 1693 } else if (third_byte == 0x20) { |
| 1694 get_modrm(*current, &mod, ®op, &rm); | 1694 get_modrm(*current, &mod, ®op, &rm); |
| 1695 AppendToBuffer("pinsrd "); // xmm, reg/m32, imm8 | 1695 AppendToBuffer("pinsrd "); // xmm, reg/m32, imm8 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 AppendToBuffer("ps%sd %s,%d", sf_str[regop / 2], NameOfXMMRegister(rm), | 1781 AppendToBuffer("ps%sd %s,%d", sf_str[regop / 2], NameOfXMMRegister(rm), |
| 1782 *current & 0x7f); | 1782 *current & 0x7f); |
| 1783 current += 1; | 1783 current += 1; |
| 1784 } else if (opcode == 0x73) { | 1784 } else if (opcode == 0x73) { |
| 1785 current += 1; | 1785 current += 1; |
| 1786 AppendToBuffer("ps%sq %s,%d", sf_str[regop / 2], NameOfXMMRegister(rm), | 1786 AppendToBuffer("ps%sq %s,%d", sf_str[regop / 2], NameOfXMMRegister(rm), |
| 1787 *current & 0x7f); | 1787 *current & 0x7f); |
| 1788 current += 1; | 1788 current += 1; |
| 1789 } else if (opcode == 0xB1) { | 1789 } else if (opcode == 0xB1) { |
| 1790 current += PrintOperands("cmpxchg", OPER_REG_OP_ORDER, current); | 1790 current += PrintOperands("cmpxchg", OPER_REG_OP_ORDER, current); |
| 1791 } else if (opcode == 0xC4) { |
| 1792 AppendToBuffer("pinsrw %s,", NameOfXMMRegister(regop)); |
| 1793 current += PrintRightOperand(current); |
| 1794 AppendToBuffer(",0x%x", (*current) & 7); |
| 1795 current += 1; |
| 1791 } else { | 1796 } else { |
| 1792 const char* mnemonic = "?"; | 1797 const char* mnemonic = "?"; |
| 1793 if (opcode == 0x54) { | 1798 if (opcode == 0x54) { |
| 1794 mnemonic = "andpd"; | 1799 mnemonic = "andpd"; |
| 1795 } else if (opcode == 0x56) { | 1800 } else if (opcode == 0x56) { |
| 1796 mnemonic = "orpd"; | 1801 mnemonic = "orpd"; |
| 1797 } else if (opcode == 0x57) { | 1802 } else if (opcode == 0x57) { |
| 1798 mnemonic = "xorpd"; | 1803 mnemonic = "xorpd"; |
| 1799 } else if (opcode == 0x5B) { | 1804 } else if (opcode == 0x5B) { |
| 1800 mnemonic = "cvtps2dq"; | 1805 mnemonic = "cvtps2dq"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1817 } else if (opcode == 0x62) { | 1822 } else if (opcode == 0x62) { |
| 1818 mnemonic = "punpckldq"; | 1823 mnemonic = "punpckldq"; |
| 1819 } else if (opcode == 0x63) { | 1824 } else if (opcode == 0x63) { |
| 1820 mnemonic = "packsswb"; | 1825 mnemonic = "packsswb"; |
| 1821 } else if (opcode == 0x67) { | 1826 } else if (opcode == 0x67) { |
| 1822 mnemonic = "packuswb"; | 1827 mnemonic = "packuswb"; |
| 1823 } else if (opcode == 0x6A) { | 1828 } else if (opcode == 0x6A) { |
| 1824 mnemonic = "punpckhdq"; | 1829 mnemonic = "punpckhdq"; |
| 1825 } else if (opcode == 0x6B) { | 1830 } else if (opcode == 0x6B) { |
| 1826 mnemonic = "packssdw"; | 1831 mnemonic = "packssdw"; |
| 1827 } else if (opcode == 0xC4) { | |
| 1828 mnemonic = "pinsrw"; | |
| 1829 } else if (opcode == 0xC5) { | |
| 1830 mnemonic = "pextrw"; | |
| 1831 } else if (opcode == 0xD1) { | 1832 } else if (opcode == 0xD1) { |
| 1832 mnemonic = "psrlw"; | 1833 mnemonic = "psrlw"; |
| 1833 } else if (opcode == 0xD2) { | 1834 } else if (opcode == 0xD2) { |
| 1834 mnemonic = "psrld"; | 1835 mnemonic = "psrld"; |
| 1835 } else if (opcode == 0xD5) { | 1836 } else if (opcode == 0xD5) { |
| 1836 mnemonic = "pmullw"; | 1837 mnemonic = "pmullw"; |
| 1837 } else if (opcode == 0xD7) { | 1838 } else if (opcode == 0xD7) { |
| 1838 mnemonic = "pmovmskb"; | 1839 mnemonic = "pmovmskb"; |
| 1839 } else if (opcode == 0xD8) { | 1840 } else if (opcode == 0xD8) { |
| 1840 mnemonic = "psubusb"; | 1841 mnemonic = "psubusb"; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 get_modrm(*current, &mod, ®op, &rm); | 1935 get_modrm(*current, &mod, ®op, &rm); |
| 1935 AppendToBuffer("cvtsd2si%c %s,", | 1936 AppendToBuffer("cvtsd2si%c %s,", |
| 1936 operand_size_code(), NameOfCPURegister(regop)); | 1937 operand_size_code(), NameOfCPURegister(regop)); |
| 1937 current += PrintRightXMMOperand(current); | 1938 current += PrintRightXMMOperand(current); |
| 1938 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { | 1939 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { |
| 1939 // XMM arithmetic. Mnemonic was retrieved at the start of this function. | 1940 // XMM arithmetic. Mnemonic was retrieved at the start of this function. |
| 1940 int mod, regop, rm; | 1941 int mod, regop, rm; |
| 1941 get_modrm(*current, &mod, ®op, &rm); | 1942 get_modrm(*current, &mod, ®op, &rm); |
| 1942 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1943 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
| 1943 current += PrintRightXMMOperand(current); | 1944 current += PrintRightXMMOperand(current); |
| 1945 } else if (opcode == 0x70) { |
| 1946 int mod, regop, rm; |
| 1947 get_modrm(*current, &mod, ®op, &rm); |
| 1948 AppendToBuffer("pshuflw %s, ", NameOfXMMRegister(regop)); |
| 1949 current += PrintRightXMMOperand(current); |
| 1950 AppendToBuffer(", %d", (*current) & 7); |
| 1951 current += 1; |
| 1944 } else if (opcode == 0xC2) { | 1952 } else if (opcode == 0xC2) { |
| 1945 // Intel manual 2A, Table 3-18. | 1953 // Intel manual 2A, Table 3-18. |
| 1946 int mod, regop, rm; | 1954 int mod, regop, rm; |
| 1947 get_modrm(*current, &mod, ®op, &rm); | 1955 get_modrm(*current, &mod, ®op, &rm); |
| 1948 const char* const pseudo_op[] = { | 1956 const char* const pseudo_op[] = { |
| 1949 "cmpeqsd", | 1957 "cmpeqsd", |
| 1950 "cmpltsd", | 1958 "cmpltsd", |
| 1951 "cmplesd", | 1959 "cmplesd", |
| 1952 "cmpunordsd", | 1960 "cmpunordsd", |
| 1953 "cmpneqsd", | 1961 "cmpneqsd", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1997 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
| 1990 current += PrintRightOperand(current); | 1998 current += PrintRightOperand(current); |
| 1991 } else if (opcode == 0x2C) { | 1999 } else if (opcode == 0x2C) { |
| 1992 // CVTTSS2SI: | 2000 // CVTTSS2SI: |
| 1993 // Convert with truncation scalar single-precision FP to dword integer. | 2001 // Convert with truncation scalar single-precision FP to dword integer. |
| 1994 int mod, regop, rm; | 2002 int mod, regop, rm; |
| 1995 get_modrm(*current, &mod, ®op, &rm); | 2003 get_modrm(*current, &mod, ®op, &rm); |
| 1996 AppendToBuffer("cvttss2si%c %s,", | 2004 AppendToBuffer("cvttss2si%c %s,", |
| 1997 operand_size_code(), NameOfCPURegister(regop)); | 2005 operand_size_code(), NameOfCPURegister(regop)); |
| 1998 current += PrintRightXMMOperand(current); | 2006 current += PrintRightXMMOperand(current); |
| 2007 } else if (opcode == 0x70) { |
| 2008 int mod, regop, rm; |
| 2009 get_modrm(*current, &mod, ®op, &rm); |
| 2010 AppendToBuffer("pshufhw %s, ", NameOfXMMRegister(regop)); |
| 2011 current += PrintRightXMMOperand(current); |
| 2012 AppendToBuffer(", %d", (*current) & 7); |
| 2013 current += 1; |
| 1999 } else if (opcode == 0x7E) { | 2014 } else if (opcode == 0x7E) { |
| 2000 int mod, regop, rm; | 2015 int mod, regop, rm; |
| 2001 get_modrm(*current, &mod, ®op, &rm); | 2016 get_modrm(*current, &mod, ®op, &rm); |
| 2002 AppendToBuffer("movq %s,", NameOfXMMRegister(regop)); | 2017 AppendToBuffer("movq %s,", NameOfXMMRegister(regop)); |
| 2003 current += PrintRightXMMOperand(current); | 2018 current += PrintRightXMMOperand(current); |
| 2004 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { | 2019 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { |
| 2005 // XMM arithmetic. Mnemonic was retrieved at the start of this function. | 2020 // XMM arithmetic. Mnemonic was retrieved at the start of this function. |
| 2006 int mod, regop, rm; | 2021 int mod, regop, rm; |
| 2007 get_modrm(*current, &mod, ®op, &rm); | 2022 get_modrm(*current, &mod, ®op, &rm); |
| 2008 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 2023 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 2818 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
| 2804 fprintf(f, " "); | 2819 fprintf(f, " "); |
| 2805 } | 2820 } |
| 2806 fprintf(f, " %s\n", buffer.start()); | 2821 fprintf(f, " %s\n", buffer.start()); |
| 2807 } | 2822 } |
| 2808 } | 2823 } |
| 2809 | 2824 |
| 2810 } // namespace disasm | 2825 } // namespace disasm |
| 2811 | 2826 |
| 2812 #endif // V8_TARGET_ARCH_X64 | 2827 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |