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

Side by Side Diff: runtime/vm/intrinsifier_x64.cc

Issue 10875030: Add support for XMM registers in SSA code generation pipeline. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix a bug pointed out by Florian Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/locations.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 case Token::kSUB: __ subsd(XMM0, XMM1); break; 978 case Token::kSUB: __ subsd(XMM0, XMM1); break;
979 case Token::kMUL: __ mulsd(XMM0, XMM1); break; 979 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
980 case Token::kDIV: __ divsd(XMM0, XMM1); break; 980 case Token::kDIV: __ divsd(XMM0, XMM1); break;
981 default: UNREACHABLE(); 981 default: UNREACHABLE();
982 } 982 }
983 const Class& double_class = Class::Handle( 983 const Class& double_class = Class::Handle(
984 Isolate::Current()->object_store()->double_class()); 984 Isolate::Current()->object_store()->double_class());
985 AssemblerMacros::TryAllocate(assembler, 985 AssemblerMacros::TryAllocate(assembler,
986 double_class, 986 double_class,
987 &fall_through, 987 &fall_through,
988 Assembler::kNearJump,
988 RAX); // Result register. 989 RAX); // Result register.
989 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); 990 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
990 __ ret(); 991 __ ret();
991 __ Bind(&fall_through); 992 __ Bind(&fall_through);
992 return false; 993 return false;
993 } 994 }
994 995
995 996
996 bool Intrinsifier::Double_add(Assembler* assembler) { 997 bool Intrinsifier::Double_add(Assembler* assembler) {
997 return DoubleArithmeticOperations(assembler, Token::kADD); 998 return DoubleArithmeticOperations(assembler, Token::kADD);
(...skipping 25 matching lines...) Expand all
1023 __ SmiUntag(RAX); 1024 __ SmiUntag(RAX);
1024 __ cvtsi2sd(XMM1, RAX); 1025 __ cvtsi2sd(XMM1, RAX);
1025 __ movq(RAX, Address(RSP, + 2 * kWordSize)); 1026 __ movq(RAX, Address(RSP, + 2 * kWordSize));
1026 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); 1027 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset()));
1027 __ mulsd(XMM0, XMM1); 1028 __ mulsd(XMM0, XMM1);
1028 const Class& double_class = Class::Handle( 1029 const Class& double_class = Class::Handle(
1029 Isolate::Current()->object_store()->double_class()); 1030 Isolate::Current()->object_store()->double_class());
1030 AssemblerMacros::TryAllocate(assembler, 1031 AssemblerMacros::TryAllocate(assembler,
1031 double_class, 1032 double_class,
1032 &fall_through, 1033 &fall_through,
1034 Assembler::kNearJump,
1033 RAX); // Result register. 1035 RAX); // Result register.
1034 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); 1036 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
1035 __ ret(); 1037 __ ret();
1036 __ Bind(&fall_through); 1038 __ Bind(&fall_through);
1037 return false; 1039 return false;
1038 } 1040 }
1039 1041
1040 1042
1041 // Left is double right is integer (Bigint, Mint or Smi) 1043 // Left is double right is integer (Bigint, Mint or Smi)
1042 bool Intrinsifier::Double_fromInteger(Assembler* assembler) { 1044 bool Intrinsifier::Double_fromInteger(Assembler* assembler) {
1043 Label fall_through; 1045 Label fall_through;
1044 __ movq(RAX, Address(RSP, +1 * kWordSize)); 1046 __ movq(RAX, Address(RSP, +1 * kWordSize));
1045 __ testq(RAX, Immediate(kSmiTagMask)); 1047 __ testq(RAX, Immediate(kSmiTagMask));
1046 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 1048 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
1047 // Is Smi. 1049 // Is Smi.
1048 __ SmiUntag(RAX); 1050 __ SmiUntag(RAX);
1049 __ cvtsi2sd(XMM0, RAX); 1051 __ cvtsi2sd(XMM0, RAX);
1050 const Class& double_class = Class::Handle( 1052 const Class& double_class = Class::Handle(
1051 Isolate::Current()->object_store()->double_class()); 1053 Isolate::Current()->object_store()->double_class());
1052 AssemblerMacros::TryAllocate(assembler, 1054 AssemblerMacros::TryAllocate(assembler,
1053 double_class, 1055 double_class,
1054 &fall_through, 1056 &fall_through,
1057 Assembler::kNearJump,
1055 RAX); // Result register. 1058 RAX); // Result register.
1056 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); 1059 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
1057 __ ret(); 1060 __ ret();
1058 __ Bind(&fall_through); 1061 __ Bind(&fall_through);
1059 return false; 1062 return false;
1060 } 1063 }
1061 1064
1062 1065
1063 bool Intrinsifier::Double_isNaN(Assembler* assembler) { 1066 bool Intrinsifier::Double_isNaN(Assembler* assembler) {
1064 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 1067 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 case kCosine: __ fcos(); break; 1125 case kCosine: __ fcos(); break;
1123 default: 1126 default:
1124 UNREACHABLE(); 1127 UNREACHABLE();
1125 } 1128 }
1126 const Class& double_class = Class::Handle( 1129 const Class& double_class = Class::Handle(
1127 Isolate::Current()->object_store()->double_class()); 1130 Isolate::Current()->object_store()->double_class());
1128 Label alloc_failed; 1131 Label alloc_failed;
1129 AssemblerMacros::TryAllocate(assembler, 1132 AssemblerMacros::TryAllocate(assembler,
1130 double_class, 1133 double_class,
1131 &alloc_failed, 1134 &alloc_failed,
1135 Assembler::kNearJump,
1132 RAX); // Result register. 1136 RAX); // Result register.
1133 __ fstpl(FieldAddress(RAX, Double::value_offset())); 1137 __ fstpl(FieldAddress(RAX, Double::value_offset()));
1134 __ ret(); 1138 __ ret();
1135 1139
1136 __ Bind(&is_smi); // smi -> double. 1140 __ Bind(&is_smi); // smi -> double.
1137 __ SmiUntag(RAX); 1141 __ SmiUntag(RAX);
1138 __ pushq(RAX); 1142 __ pushq(RAX);
1139 __ fildl(Address(RSP, 0)); 1143 __ fildl(Address(RSP, 0));
1140 __ popq(RAX); 1144 __ popq(RAX);
1141 __ jmp(&double_op); 1145 __ jmp(&double_op);
(...skipping 11 matching lines...) Expand all
1153 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); 1157 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through);
1154 // Argument is double and is in RAX. 1158 // Argument is double and is in RAX.
1155 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); 1159 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset()));
1156 __ Bind(&double_op); 1160 __ Bind(&double_op);
1157 __ sqrtsd(XMM0, XMM1); 1161 __ sqrtsd(XMM0, XMM1);
1158 const Class& double_class = Class::Handle( 1162 const Class& double_class = Class::Handle(
1159 Isolate::Current()->object_store()->double_class()); 1163 Isolate::Current()->object_store()->double_class());
1160 AssemblerMacros::TryAllocate(assembler, 1164 AssemblerMacros::TryAllocate(assembler,
1161 double_class, 1165 double_class,
1162 &fall_through, 1166 &fall_through,
1167 Assembler::kNearJump,
1163 RAX); // Result register. 1168 RAX); // Result register.
1164 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); 1169 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
1165 __ ret(); 1170 __ ret();
1166 __ Bind(&is_smi); 1171 __ Bind(&is_smi);
1167 __ SmiUntag(RAX); 1172 __ SmiUntag(RAX);
1168 __ cvtsi2sd(XMM1, RAX); 1173 __ cvtsi2sd(XMM1, RAX);
1169 __ jmp(&double_op); 1174 __ jmp(&double_op);
1170 __ Bind(&fall_through); 1175 __ Bind(&fall_through);
1171 return false; 1176 return false;
1172 } 1177 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 __ LoadObject(RAX, bool_true); 1356 __ LoadObject(RAX, bool_true);
1352 __ ret(); 1357 __ ret();
1353 return true; 1358 return true;
1354 } 1359 }
1355 1360
1356 #undef __ 1361 #undef __
1357 1362
1358 } // namespace dart 1363 } // namespace dart
1359 1364
1360 #endif // defined TARGET_ARCH_X64 1365 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/locations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698