Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: src/x64/disasm-x64.cc

Issue 764863002: [x64] introduce vex prefix version of float64 arithmetic binop (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 byte checked = vex_byte0_ == VEX3_PREFIX ? vex_byte2_ : vex_byte1_; 376 byte checked = vex_byte0_ == VEX3_PREFIX ? vex_byte2_ : vex_byte1_;
377 return (checked & 3) == 3; 377 return (checked & 3) == 3;
378 } 378 }
379 379
380 bool vex_0f() { 380 bool vex_0f() {
381 if (vex_byte0_ == VEX2_PREFIX) return true; 381 if (vex_byte0_ == VEX2_PREFIX) return true;
382 return (vex_byte1_ & 3) == 1; 382 return (vex_byte1_ & 3) == 1;
383 } 383 }
384 384
385 bool vex_0f38() { 385 bool vex_0f38() {
386 DCHECK(vex_byte0_ == VEX3_PREFIX); 386 if (vex_byte0_ == VEX2_PREFIX) return false;
387 return (vex_byte1_ & 3) == 2; 387 return (vex_byte1_ & 3) == 2;
388 } 388 }
389 389
390 bool vex_0f3a() { 390 bool vex_0f3a() {
391 DCHECK(vex_byte0_ == VEX3_PREFIX); 391 if (vex_byte0_ == VEX2_PREFIX) return false;
392 return (vex_byte1_ & 3) == 3; 392 return (vex_byte1_ & 3) == 3;
393 } 393 }
394 394
395 int vex_vreg() { 395 int vex_vreg() {
396 DCHECK(vex_byte0_ == VEX3_PREFIX || vex_byte0_ == VEX2_PREFIX); 396 DCHECK(vex_byte0_ == VEX3_PREFIX || vex_byte0_ == VEX2_PREFIX);
397 byte checked = vex_byte0_ == VEX3_PREFIX ? vex_byte2_ : vex_byte1_; 397 byte checked = vex_byte0_ == VEX3_PREFIX ? vex_byte2_ : vex_byte1_;
398 return ~(checked >> 3) & 0xf; 398 return ~(checked >> 3) & 0xf;
399 } 399 }
400 400
401 OperandSize operand_size() { 401 OperandSize operand_size() {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 const char* mnem = conditional_code_suffix[cond]; 863 const char* mnem = conditional_code_suffix[cond];
864 AppendToBuffer("set%s%c ", mnem, operand_size_code()); 864 AppendToBuffer("set%s%c ", mnem, operand_size_code());
865 PrintRightByteOperand(data + 2); 865 PrintRightByteOperand(data + 2);
866 return 3; // includes 0x0F 866 return 3; // includes 0x0F
867 } 867 }
868 868
869 869
870 int DisassemblerX64::AVXInstruction(byte* data) { 870 int DisassemblerX64::AVXInstruction(byte* data) {
871 byte opcode = *data; 871 byte opcode = *data;
872 byte* current = data + 1; 872 byte* current = data + 1;
873 if (vex_byte0_ == VEX3_PREFIX) { 873 if (vex_66() && vex_0f38()) {
874 if (vex_128()) { 874 int mod, regop, rm, vvvv = vex_vreg();
875 if (vex_66() && vex_0f38()) { 875 get_modrm(*current, &mod, &regop, &rm);
876 int mod, regop, rm, vvvv = vex_vreg(); 876 switch (opcode) {
877 get_modrm(*current, &mod, &regop, &rm); 877 case 0x99:
878 switch (opcode) { 878 AppendToBuffer("vfmadd132s%c %s,%s,", float_size_code(),
879 case 0x99: 879 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
880 AppendToBuffer("vfmadd132s%c %s,%s,", float_size_code(), 880 current += PrintRightXMMOperand(current);
881 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 881 break;
882 current += PrintRightXMMOperand(current); 882 case 0xa9:
883 break; 883 AppendToBuffer("vfmadd213s%c %s,%s,", float_size_code(),
884 case 0xa9: 884 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
885 AppendToBuffer("vfmadd213s%c %s,%s,", float_size_code(), 885 current += PrintRightXMMOperand(current);
886 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 886 break;
887 current += PrintRightXMMOperand(current); 887 case 0xb9:
888 break; 888 AppendToBuffer("vfmadd231s%c %s,%s,", float_size_code(),
889 case 0xb9: 889 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
890 AppendToBuffer("vfmadd231s%c %s,%s,", float_size_code(), 890 current += PrintRightXMMOperand(current);
891 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 891 break;
892 current += PrintRightXMMOperand(current); 892 case 0x9b:
893 break; 893 AppendToBuffer("vfmsub132s%c %s,%s,", float_size_code(),
894 case 0x9b: 894 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
895 AppendToBuffer("vfmsub132s%c %s,%s,", float_size_code(), 895 current += PrintRightXMMOperand(current);
896 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 896 break;
897 current += PrintRightXMMOperand(current); 897 case 0xab:
898 break; 898 AppendToBuffer("vfmsub213s%c %s,%s,", float_size_code(),
899 case 0xab: 899 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
900 AppendToBuffer("vfmsub213s%c %s,%s,", float_size_code(), 900 current += PrintRightXMMOperand(current);
901 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 901 break;
902 current += PrintRightXMMOperand(current); 902 case 0xbb:
903 break; 903 AppendToBuffer("vfmsub231s%c %s,%s,", float_size_code(),
904 case 0xbb: 904 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
905 AppendToBuffer("vfmsub231s%c %s,%s,", float_size_code(), 905 current += PrintRightXMMOperand(current);
906 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 906 break;
907 current += PrintRightXMMOperand(current); 907 case 0x9d:
908 break; 908 AppendToBuffer("vfnmadd132s%c %s,%s,", float_size_code(),
909 case 0x9d: 909 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
910 AppendToBuffer("vfnmadd132s%c %s,%s,", float_size_code(), 910 current += PrintRightXMMOperand(current);
911 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 911 break;
912 current += PrintRightXMMOperand(current); 912 case 0xad:
913 break; 913 AppendToBuffer("vfnmadd213s%c %s,%s,", float_size_code(),
914 case 0xad: 914 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
915 AppendToBuffer("vfnmadd213s%c %s,%s,", float_size_code(), 915 current += PrintRightXMMOperand(current);
916 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 916 break;
917 current += PrintRightXMMOperand(current); 917 case 0xbd:
918 break; 918 AppendToBuffer("vfnmadd231s%c %s,%s,", float_size_code(),
919 case 0xbd: 919 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
920 AppendToBuffer("vfnmadd231s%c %s,%s,", float_size_code(), 920 current += PrintRightXMMOperand(current);
921 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 921 break;
922 current += PrintRightXMMOperand(current); 922 case 0x9f:
923 break; 923 AppendToBuffer("vfnmsub132s%c %s,%s,", float_size_code(),
924 case 0x9f: 924 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
925 AppendToBuffer("vfnmsub132s%c %s,%s,", float_size_code(), 925 current += PrintRightXMMOperand(current);
926 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 926 break;
927 current += PrintRightXMMOperand(current); 927 case 0xaf:
928 break; 928 AppendToBuffer("vfnmsub213s%c %s,%s,", float_size_code(),
929 case 0xaf: 929 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
930 AppendToBuffer("vfnmsub213s%c %s,%s,", float_size_code(), 930 current += PrintRightXMMOperand(current);
931 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 931 break;
932 current += PrintRightXMMOperand(current); 932 case 0xbf:
933 break; 933 AppendToBuffer("vfnmsub231s%c %s,%s,", float_size_code(),
934 case 0xbf: 934 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv));
935 AppendToBuffer("vfnmsub231s%c %s,%s,", float_size_code(), 935 current += PrintRightXMMOperand(current);
936 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); 936 break;
937 current += PrintRightXMMOperand(current); 937 default:
938 break; 938 UnimplementedInstruction();
939 default:
940 UnimplementedInstruction();
941 }
942 }
943 } else {
944 UnimplementedInstruction();
945 } 939 }
946 } else if (vex_byte0_ == VEX2_PREFIX) { 940 } else if (vex_f2() && vex_0f()) {
941 int mod, regop, rm, vvvv = vex_vreg();
942 get_modrm(*current, &mod, &regop, &rm);
943 switch (opcode) {
944 case 0x58:
945 AppendToBuffer("vaddsd %s,%s,", NameOfXMMRegister(regop),
946 NameOfXMMRegister(vvvv));
947 current += PrintRightXMMOperand(current);
948 break;
949 case 0x59:
950 AppendToBuffer("vmulsd %s,%s,", NameOfXMMRegister(regop),
951 NameOfXMMRegister(vvvv));
952 current += PrintRightXMMOperand(current);
953 break;
954 case 0x5c:
955 AppendToBuffer("vsubsd %s,%s,", NameOfXMMRegister(regop),
956 NameOfXMMRegister(vvvv));
957 current += PrintRightXMMOperand(current);
958 break;
959 case 0x5e:
960 AppendToBuffer("vdivsd %s,%s,", NameOfXMMRegister(regop),
961 NameOfXMMRegister(vvvv));
962 current += PrintRightXMMOperand(current);
963 break;
964 default:
965 UnimplementedInstruction();
966 }
967 } else {
947 UnimplementedInstruction(); 968 UnimplementedInstruction();
948 } else {
949 UNREACHABLE();
950 } 969 }
951 970
952 return static_cast<int>(current - data); 971 return static_cast<int>(current - data);
953 } 972 }
954 973
955 974
956 // Returns number of bytes used, including *data. 975 // Returns number of bytes used, including *data.
957 int DisassemblerX64::FPUInstruction(byte* data) { 976 int DisassemblerX64::FPUInstruction(byte* data) {
958 byte escape_opcode = *data; 977 byte escape_opcode = *data;
959 DCHECK_EQ(0xD8, escape_opcode & 0xF8); 978 DCHECK_EQ(0xD8, escape_opcode & 0xF8);
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { 2111 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) {
2093 fprintf(f, " "); 2112 fprintf(f, " ");
2094 } 2113 }
2095 fprintf(f, " %s\n", buffer.start()); 2114 fprintf(f, " %s\n", buffer.start());
2096 } 2115 }
2097 } 2116 }
2098 2117
2099 } // namespace disasm 2118 } // namespace disasm
2100 2119
2101 #endif // V8_TARGET_ARCH_X64 2120 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698