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 |
11 #include "src/base/compiler-specific.h" | 11 #include "src/base/compiler-specific.h" |
12 #include "src/disasm.h" | 12 #include "src/disasm.h" |
| 13 #include "src/ia32/sse-instr.h" |
13 | 14 |
14 namespace disasm { | 15 namespace disasm { |
15 | 16 |
16 enum OperandOrder { | 17 enum OperandOrder { |
17 UNSET_OP_ORDER = 0, | 18 UNSET_OP_ORDER = 0, |
18 REG_OPER_OP_ORDER, | 19 REG_OPER_OP_ORDER, |
19 OPER_REG_OP_ORDER | 20 OPER_REG_OP_ORDER |
20 }; | 21 }; |
21 | 22 |
22 | 23 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 case 0x54: | 996 case 0x54: |
996 AppendToBuffer("vandpd %s,%s,", NameOfXMMRegister(regop), | 997 AppendToBuffer("vandpd %s,%s,", NameOfXMMRegister(regop), |
997 NameOfXMMRegister(vvvv)); | 998 NameOfXMMRegister(vvvv)); |
998 current += PrintRightXMMOperand(current); | 999 current += PrintRightXMMOperand(current); |
999 break; | 1000 break; |
1000 case 0x57: | 1001 case 0x57: |
1001 AppendToBuffer("vxorpd %s,%s,", NameOfXMMRegister(regop), | 1002 AppendToBuffer("vxorpd %s,%s,", NameOfXMMRegister(regop), |
1002 NameOfXMMRegister(vvvv)); | 1003 NameOfXMMRegister(vvvv)); |
1003 current += PrintRightXMMOperand(current); | 1004 current += PrintRightXMMOperand(current); |
1004 break; | 1005 break; |
| 1006 #define DECLARE_SSE_AVX_DIS_CASE(instruction, notUsed1, notUsed2, opcode) \ |
| 1007 case 0x##opcode: { \ |
| 1008 AppendToBuffer("v" #instruction " %s,%s,", NameOfXMMRegister(regop), \ |
| 1009 NameOfXMMRegister(vvvv)); \ |
| 1010 current += PrintRightXMMOperand(current); \ |
| 1011 break; \ |
| 1012 } |
| 1013 |
| 1014 SSE2_INSTRUCTION_LIST(DECLARE_SSE_AVX_DIS_CASE) |
| 1015 #undef DECLARE_SSE_AVX_DIS_CASE |
1005 default: | 1016 default: |
1006 UnimplementedInstruction(); | 1017 UnimplementedInstruction(); |
1007 } | 1018 } |
1008 } else { | 1019 } else { |
1009 UnimplementedInstruction(); | 1020 UnimplementedInstruction(); |
1010 } | 1021 } |
1011 | 1022 |
1012 return static_cast<int>(current - data); | 1023 return static_cast<int>(current - data); |
1013 } | 1024 } |
1014 | 1025 |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 get_modrm(*data, &mod, ®op, &rm); | 1899 get_modrm(*data, &mod, ®op, &rm); |
1889 data += PrintRightXMMOperand(data); | 1900 data += PrintRightXMMOperand(data); |
1890 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1901 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1891 } else if (*data == 0x7E) { | 1902 } else if (*data == 0x7E) { |
1892 data++; | 1903 data++; |
1893 int mod, regop, rm; | 1904 int mod, regop, rm; |
1894 get_modrm(*data, &mod, ®op, &rm); | 1905 get_modrm(*data, &mod, ®op, &rm); |
1895 AppendToBuffer("movd "); | 1906 AppendToBuffer("movd "); |
1896 data += PrintRightOperand(data); | 1907 data += PrintRightOperand(data); |
1897 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1908 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
| 1909 } else if (*data == 0xC4) { |
| 1910 data++; |
| 1911 int mod, regop, rm; |
| 1912 get_modrm(*data, &mod, ®op, &rm); |
| 1913 AppendToBuffer("pinsrw %s,", NameOfXMMRegister(regop)); |
| 1914 data += PrintRightOperand(data); |
| 1915 AppendToBuffer(",%d", *reinterpret_cast<int8_t*>(data)); |
| 1916 data++; |
1898 } else if (*data == 0xDB) { | 1917 } else if (*data == 0xDB) { |
1899 data++; | 1918 data++; |
1900 int mod, regop, rm; | 1919 int mod, regop, rm; |
1901 get_modrm(*data, &mod, ®op, &rm); | 1920 get_modrm(*data, &mod, ®op, &rm); |
1902 AppendToBuffer("pand %s,%s", | 1921 AppendToBuffer("pand %s,%s", |
1903 NameOfXMMRegister(regop), | 1922 NameOfXMMRegister(regop), |
1904 NameOfXMMRegister(rm)); | 1923 NameOfXMMRegister(rm)); |
1905 data++; | 1924 data++; |
1906 } else if (*data == 0xE7) { | 1925 } else if (*data == 0xE7) { |
1907 data++; | 1926 data++; |
(...skipping 14 matching lines...) Expand all Loading... |
1922 NameOfXMMRegister(rm)); | 1941 NameOfXMMRegister(rm)); |
1923 data++; | 1942 data++; |
1924 } else if (*data == 0xEB) { | 1943 } else if (*data == 0xEB) { |
1925 data++; | 1944 data++; |
1926 int mod, regop, rm; | 1945 int mod, regop, rm; |
1927 get_modrm(*data, &mod, ®op, &rm); | 1946 get_modrm(*data, &mod, ®op, &rm); |
1928 AppendToBuffer("por %s,%s", | 1947 AppendToBuffer("por %s,%s", |
1929 NameOfXMMRegister(regop), | 1948 NameOfXMMRegister(regop), |
1930 NameOfXMMRegister(rm)); | 1949 NameOfXMMRegister(rm)); |
1931 data++; | 1950 data++; |
| 1951 } else if (*data == 0xFA) { |
| 1952 data++; |
| 1953 int mod, regop, rm; |
| 1954 get_modrm(*data, &mod, ®op, &rm); |
| 1955 AppendToBuffer("psubd %s,", NameOfXMMRegister(regop)); |
| 1956 data += PrintRightXMMOperand(data); |
| 1957 } else if (*data == 0xFE) { |
| 1958 data++; |
| 1959 int mod, regop, rm; |
| 1960 get_modrm(*data, &mod, ®op, &rm); |
| 1961 AppendToBuffer("paddd %s,", NameOfXMMRegister(regop)); |
| 1962 data += PrintRightXMMOperand(data); |
1932 } else if (*data == 0xB1) { | 1963 } else if (*data == 0xB1) { |
1933 data++; | 1964 data++; |
1934 data += PrintOperands("cmpxchg_w", OPER_REG_OP_ORDER, data); | 1965 data += PrintOperands("cmpxchg_w", OPER_REG_OP_ORDER, data); |
1935 } else { | 1966 } else { |
1936 UnimplementedInstruction(); | 1967 UnimplementedInstruction(); |
1937 } | 1968 } |
1938 } else { | 1969 } else { |
1939 UnimplementedInstruction(); | 1970 UnimplementedInstruction(); |
1940 } | 1971 } |
1941 break; | 1972 break; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 fprintf(f, " "); | 2366 fprintf(f, " "); |
2336 } | 2367 } |
2337 fprintf(f, " %s\n", buffer.start()); | 2368 fprintf(f, " %s\n", buffer.start()); |
2338 } | 2369 } |
2339 } | 2370 } |
2340 | 2371 |
2341 | 2372 |
2342 } // namespace disasm | 2373 } // namespace disasm |
2343 | 2374 |
2344 #endif // V8_TARGET_ARCH_IA32 | 2375 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |