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_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 | 10 |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 NameOfXMMRegister(vvvv)); \ | 810 NameOfXMMRegister(vvvv)); \ |
811 current += PrintRightXMMOperand(current); \ | 811 current += PrintRightXMMOperand(current); \ |
812 break; \ | 812 break; \ |
813 } | 813 } |
814 | 814 |
815 SSE4_INSTRUCTION_LIST(DECLARE_SSE_AVX_DIS_CASE) | 815 SSE4_INSTRUCTION_LIST(DECLARE_SSE_AVX_DIS_CASE) |
816 #undef DECLARE_SSE_AVX_DIS_CASE | 816 #undef DECLARE_SSE_AVX_DIS_CASE |
817 default: | 817 default: |
818 UnimplementedInstruction(); | 818 UnimplementedInstruction(); |
819 } | 819 } |
| 820 } else if (vex_66() && vex_0f3a()) { |
| 821 int mod, regop, rm, vvvv = vex_vreg(); |
| 822 get_modrm(*current, &mod, ®op, &rm); |
| 823 switch (opcode) { |
| 824 case 0x16: |
| 825 AppendToBuffer("vpextrd "); |
| 826 current += PrintRightOperand(current); |
| 827 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), |
| 828 *reinterpret_cast<int8_t*>(current)); |
| 829 current++; |
| 830 break; |
| 831 case 0x22: |
| 832 AppendToBuffer("vpinsrd %s,%s,", NameOfXMMRegister(regop), |
| 833 NameOfXMMRegister(vvvv)); |
| 834 current += PrintRightOperand(current); |
| 835 AppendToBuffer(",%d", *reinterpret_cast<int8_t*>(current)); |
| 836 current++; |
| 837 break; |
| 838 default: |
| 839 UnimplementedInstruction(); |
| 840 } |
820 } else if (vex_f2() && vex_0f()) { | 841 } else if (vex_f2() && vex_0f()) { |
821 int mod, regop, rm, vvvv = vex_vreg(); | 842 int mod, regop, rm, vvvv = vex_vreg(); |
822 get_modrm(*current, &mod, ®op, &rm); | 843 get_modrm(*current, &mod, ®op, &rm); |
823 switch (opcode) { | 844 switch (opcode) { |
824 case 0x58: | 845 case 0x58: |
825 AppendToBuffer("vaddsd %s,%s,", NameOfXMMRegister(regop), | 846 AppendToBuffer("vaddsd %s,%s,", NameOfXMMRegister(regop), |
826 NameOfXMMRegister(vvvv)); | 847 NameOfXMMRegister(vvvv)); |
827 current += PrintRightXMMOperand(current); | 848 current += PrintRightXMMOperand(current); |
828 break; | 849 break; |
829 case 0x59: | 850 case 0x59: |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 case 0x5E: | 1115 case 0x5E: |
1095 AppendToBuffer("vdivpd %s,%s,", NameOfXMMRegister(regop), | 1116 AppendToBuffer("vdivpd %s,%s,", NameOfXMMRegister(regop), |
1096 NameOfXMMRegister(vvvv)); | 1117 NameOfXMMRegister(vvvv)); |
1097 current += PrintRightXMMOperand(current); | 1118 current += PrintRightXMMOperand(current); |
1098 break; | 1119 break; |
1099 case 0x5F: | 1120 case 0x5F: |
1100 AppendToBuffer("vmaxpd %s,%s,", NameOfXMMRegister(regop), | 1121 AppendToBuffer("vmaxpd %s,%s,", NameOfXMMRegister(regop), |
1101 NameOfXMMRegister(vvvv)); | 1122 NameOfXMMRegister(vvvv)); |
1102 current += PrintRightXMMOperand(current); | 1123 current += PrintRightXMMOperand(current); |
1103 break; | 1124 break; |
| 1125 case 0x6E: |
| 1126 AppendToBuffer("vmovd %s,", NameOfXMMRegister(regop)); |
| 1127 current += PrintRightOperand(current); |
| 1128 break; |
| 1129 case 0x70: |
| 1130 AppendToBuffer("vpshufd %s,", NameOfXMMRegister(regop)); |
| 1131 current += PrintRightXMMOperand(current); |
| 1132 AppendToBuffer(",%d", *reinterpret_cast<int8_t*>(current)); |
| 1133 current++; |
| 1134 break; |
1104 case 0x71: | 1135 case 0x71: |
1105 AppendToBuffer("vps%sw %s,%s", sf_str[regop / 2], | 1136 AppendToBuffer("vps%sw %s,%s", sf_str[regop / 2], |
1106 NameOfXMMRegister(vvvv), NameOfXMMRegister(rm)); | 1137 NameOfXMMRegister(vvvv), NameOfXMMRegister(rm)); |
1107 current++; | 1138 current++; |
1108 AppendToBuffer(",%u", *current++); | 1139 AppendToBuffer(",%u", *current++); |
1109 break; | 1140 break; |
1110 case 0x72: | 1141 case 0x72: |
1111 AppendToBuffer("vps%sd %s,%s", sf_str[regop / 2], | 1142 AppendToBuffer("vps%sd %s,%s", sf_str[regop / 2], |
1112 NameOfXMMRegister(vvvv), NameOfXMMRegister(rm)); | 1143 NameOfXMMRegister(vvvv), NameOfXMMRegister(rm)); |
1113 current++; | 1144 current++; |
1114 AppendToBuffer(",%u", *current++); | 1145 AppendToBuffer(",%u", *current++); |
1115 break; | 1146 break; |
| 1147 case 0x7E: |
| 1148 AppendToBuffer("vmovd "); |
| 1149 current += PrintRightOperand(current); |
| 1150 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
| 1151 break; |
1116 #define DECLARE_SSE_AVX_DIS_CASE(instruction, notUsed1, notUsed2, opcode) \ | 1152 #define DECLARE_SSE_AVX_DIS_CASE(instruction, notUsed1, notUsed2, opcode) \ |
1117 case 0x##opcode: { \ | 1153 case 0x##opcode: { \ |
1118 AppendToBuffer("v" #instruction " %s,%s,", NameOfXMMRegister(regop), \ | 1154 AppendToBuffer("v" #instruction " %s,%s,", NameOfXMMRegister(regop), \ |
1119 NameOfXMMRegister(vvvv)); \ | 1155 NameOfXMMRegister(vvvv)); \ |
1120 current += PrintRightXMMOperand(current); \ | 1156 current += PrintRightXMMOperand(current); \ |
1121 break; \ | 1157 break; \ |
1122 } | 1158 } |
1123 | 1159 |
1124 SSE2_INSTRUCTION_LIST(DECLARE_SSE_AVX_DIS_CASE) | 1160 SSE2_INSTRUCTION_LIST(DECLARE_SSE_AVX_DIS_CASE) |
1125 #undef DECLARE_SSE_AVX_DIS_CASE | 1161 #undef DECLARE_SSE_AVX_DIS_CASE |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 get_modrm(*data, &mod, ®op, &rm); | 1879 get_modrm(*data, &mod, ®op, &rm); |
1844 int8_t imm8 = static_cast<int8_t>(data[1]); | 1880 int8_t imm8 = static_cast<int8_t>(data[1]); |
1845 AppendToBuffer("roundsd %s,%s,%d", | 1881 AppendToBuffer("roundsd %s,%s,%d", |
1846 NameOfXMMRegister(regop), | 1882 NameOfXMMRegister(regop), |
1847 NameOfXMMRegister(rm), | 1883 NameOfXMMRegister(rm), |
1848 static_cast<int>(imm8)); | 1884 static_cast<int>(imm8)); |
1849 data += 2; | 1885 data += 2; |
1850 } else if (*data == 0x16) { | 1886 } else if (*data == 0x16) { |
1851 data++; | 1887 data++; |
1852 int mod, regop, rm; | 1888 int mod, regop, rm; |
1853 get_modrm(*data, &mod, &rm, ®op); | 1889 get_modrm(*data, &mod, ®op, &rm); |
1854 int8_t imm8 = static_cast<int8_t>(data[1]); | 1890 AppendToBuffer("pextrd "); |
1855 AppendToBuffer("pextrd %s,%s,%d", | 1891 data += PrintRightOperand(data); |
1856 NameOfCPURegister(regop), | 1892 AppendToBuffer(",%s,%d", NameOfXMMRegister(regop), |
1857 NameOfXMMRegister(rm), | 1893 *reinterpret_cast<int8_t*>(data)); |
1858 static_cast<int>(imm8)); | 1894 data++; |
1859 data += 2; | |
1860 } else if (*data == 0x17) { | 1895 } else if (*data == 0x17) { |
1861 data++; | 1896 data++; |
1862 int mod, regop, rm; | 1897 int mod, regop, rm; |
1863 get_modrm(*data, &mod, ®op, &rm); | 1898 get_modrm(*data, &mod, ®op, &rm); |
1864 int8_t imm8 = static_cast<int8_t>(data[1]); | 1899 int8_t imm8 = static_cast<int8_t>(data[1]); |
1865 AppendToBuffer("extractps %s,%s,%d", | 1900 AppendToBuffer("extractps %s,%s,%d", |
1866 NameOfCPURegister(rm), | 1901 NameOfCPURegister(rm), |
1867 NameOfXMMRegister(regop), | 1902 NameOfXMMRegister(regop), |
1868 static_cast<int>(imm8)); | 1903 static_cast<int>(imm8)); |
1869 data += 2; | 1904 data += 2; |
1870 } else if (*data == 0x22) { | 1905 } else if (*data == 0x22) { |
1871 data++; | 1906 data++; |
1872 int mod, regop, rm; | 1907 int mod, regop, rm; |
1873 get_modrm(*data, &mod, ®op, &rm); | 1908 get_modrm(*data, &mod, ®op, &rm); |
1874 int8_t imm8 = static_cast<int8_t>(data[1]); | 1909 AppendToBuffer("pinsrd %s,", NameOfXMMRegister(regop)); |
1875 AppendToBuffer("pinsrd %s,%s,%d", | 1910 data += PrintRightOperand(data); |
1876 NameOfXMMRegister(regop), | 1911 AppendToBuffer(",%d", *reinterpret_cast<int8_t*>(data)); |
1877 NameOfCPURegister(rm), | 1912 data++; |
1878 static_cast<int>(imm8)); | |
1879 data += 2; | |
1880 } else { | 1913 } else { |
1881 UnimplementedInstruction(); | 1914 UnimplementedInstruction(); |
1882 } | 1915 } |
1883 } else if (*data == 0x2E || *data == 0x2F) { | 1916 } else if (*data == 0x2E || *data == 0x2F) { |
1884 const char* mnem = (*data == 0x2E) ? "ucomisd" : "comisd"; | 1917 const char* mnem = (*data == 0x2E) ? "ucomisd" : "comisd"; |
1885 data++; | 1918 data++; |
1886 int mod, regop, rm; | 1919 int mod, regop, rm; |
1887 get_modrm(*data, &mod, ®op, &rm); | 1920 get_modrm(*data, &mod, ®op, &rm); |
1888 if (mod == 0x3) { | 1921 if (mod == 0x3) { |
1889 AppendToBuffer("%s %s,%s", mnem, | 1922 AppendToBuffer("%s %s,%s", mnem, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 } else if (*data == 0x6F) { | 1968 } else if (*data == 0x6F) { |
1936 data++; | 1969 data++; |
1937 int mod, regop, rm; | 1970 int mod, regop, rm; |
1938 get_modrm(*data, &mod, ®op, &rm); | 1971 get_modrm(*data, &mod, ®op, &rm); |
1939 AppendToBuffer("movdqa %s,", NameOfXMMRegister(regop)); | 1972 AppendToBuffer("movdqa %s,", NameOfXMMRegister(regop)); |
1940 data += PrintRightXMMOperand(data); | 1973 data += PrintRightXMMOperand(data); |
1941 } else if (*data == 0x70) { | 1974 } else if (*data == 0x70) { |
1942 data++; | 1975 data++; |
1943 int mod, regop, rm; | 1976 int mod, regop, rm; |
1944 get_modrm(*data, &mod, ®op, &rm); | 1977 get_modrm(*data, &mod, ®op, &rm); |
1945 int8_t imm8 = static_cast<int8_t>(data[1]); | 1978 AppendToBuffer("pshufd %s,", NameOfXMMRegister(regop)); |
1946 AppendToBuffer("pshufd %s,%s,%d", | 1979 data += PrintRightXMMOperand(data); |
1947 NameOfXMMRegister(regop), | 1980 AppendToBuffer(",%d", *reinterpret_cast<int8_t*>(data)); |
1948 NameOfXMMRegister(rm), | 1981 data++; |
1949 static_cast<int>(imm8)); | |
1950 data += 2; | |
1951 } else if (*data == 0x90) { | 1982 } else if (*data == 0x90) { |
1952 data++; | 1983 data++; |
1953 AppendToBuffer("nop"); // 2 byte nop. | 1984 AppendToBuffer("nop"); // 2 byte nop. |
1954 } else if (*data == 0xF3) { | 1985 } else if (*data == 0xF3) { |
1955 data++; | 1986 data++; |
1956 int mod, regop, rm; | 1987 int mod, regop, rm; |
1957 get_modrm(*data, &mod, ®op, &rm); | 1988 get_modrm(*data, &mod, ®op, &rm); |
1958 AppendToBuffer("psllq %s,%s", | 1989 AppendToBuffer("psllq %s,%s", |
1959 NameOfXMMRegister(regop), | 1990 NameOfXMMRegister(regop), |
1960 NameOfXMMRegister(rm)); | 1991 NameOfXMMRegister(rm)); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 fprintf(f, " "); | 2479 fprintf(f, " "); |
2449 } | 2480 } |
2450 fprintf(f, " %s\n", buffer.start()); | 2481 fprintf(f, " %s\n", buffer.start()); |
2451 } | 2482 } |
2452 } | 2483 } |
2453 | 2484 |
2454 | 2485 |
2455 } // namespace disasm | 2486 } // namespace disasm |
2456 | 2487 |
2457 #endif // V8_TARGET_ARCH_IA32 | 2488 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |