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

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

Issue 11099034: Slightly improved register constraints for mint add and sub. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 summary->set_out(Location::SameAsFirstInput()); 2377 summary->set_out(Location::SameAsFirstInput());
2378 return summary; 2378 return summary;
2379 } 2379 }
2380 case Token::kADD: 2380 case Token::kADD:
2381 case Token::kSUB: { 2381 case Token::kSUB: {
2382 const intptr_t kNumTemps = 2; 2382 const intptr_t kNumTemps = 2;
2383 LocationSummary* summary = 2383 LocationSummary* summary =
2384 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2384 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2385 summary->set_in(0, Location::RequiresXmmRegister()); 2385 summary->set_in(0, Location::RequiresXmmRegister());
2386 summary->set_in(1, Location::RequiresXmmRegister()); 2386 summary->set_in(1, Location::RequiresXmmRegister());
2387 summary->set_temp(0, Location::RegisterLocation(EAX)); 2387 summary->set_temp(0, Location::RequiresRegister());
2388 summary->set_temp(1, Location::RegisterLocation(EDX)); 2388 summary->set_temp(1, Location::RequiresRegister());
2389 summary->set_out(Location::SameAsFirstInput()); 2389 summary->set_out(Location::SameAsFirstInput());
2390 return summary; 2390 return summary;
2391 } 2391 }
2392 default: 2392 default:
2393 UNREACHABLE(); 2393 UNREACHABLE();
2394 return NULL; 2394 return NULL;
2395 } 2395 }
2396 } 2396 }
2397 2397
2398 2398
2399 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2399 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2400 XmmRegister left = locs()->in(0).xmm_reg(); 2400 XmmRegister left = locs()->in(0).xmm_reg();
2401 XmmRegister right = locs()->in(1).xmm_reg(); 2401 XmmRegister right = locs()->in(1).xmm_reg();
2402 2402
2403 ASSERT(locs()->out().xmm_reg() == left); 2403 ASSERT(locs()->out().xmm_reg() == left);
2404 2404
2405 switch (op_kind()) { 2405 switch (op_kind()) {
2406 case Token::kBIT_AND: __ andpd(left, right); break; 2406 case Token::kBIT_AND: __ andpd(left, right); break;
2407 case Token::kBIT_OR: __ orpd(left, right); break; 2407 case Token::kBIT_OR: __ orpd(left, right); break;
2408 case Token::kBIT_XOR: __ xorpd(left, right); break; 2408 case Token::kBIT_XOR: __ xorpd(left, right); break;
2409 case Token::kADD: 2409 case Token::kADD:
2410 case Token::kSUB: { 2410 case Token::kSUB: {
2411 Register lo = locs()->temp(0).reg();
2412 Register hi = locs()->temp(1).reg();
2411 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2413 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2412 kDeoptBinaryMintOp); 2414 kDeoptBinaryMintOp);
2413 Label done, overflow; 2415 Label done, overflow;
2414 __ pextrd(EAX, right, Immediate(0)); // Lower half left 2416 __ pextrd(lo, right, Immediate(0)); // Lower half left
2415 __ pextrd(EDX, right, Immediate(1)); // Upper half left 2417 __ pextrd(hi, right, Immediate(1)); // Upper half left
2416 __ subl(ESP, Immediate(2 * kWordSize)); 2418 __ subl(ESP, Immediate(2 * kWordSize));
2417 __ movq(Address(ESP, 0), left); 2419 __ movq(Address(ESP, 0), left);
2418 if (op_kind() == Token::kADD) { 2420 if (op_kind() == Token::kADD) {
2419 __ addl(Address(ESP, 0), EAX); 2421 __ addl(Address(ESP, 0), lo);
2420 __ adcl(Address(ESP, 1 * kWordSize), EDX); 2422 __ adcl(Address(ESP, 1 * kWordSize), hi);
2421 } else { 2423 } else {
2422 __ subl(Address(ESP, 0), EAX); 2424 __ subl(Address(ESP, 0), lo);
2423 __ sbbl(Address(ESP, 1 * kWordSize), EDX); 2425 __ sbbl(Address(ESP, 1 * kWordSize), hi);
2424 } 2426 }
2425 __ j(OVERFLOW, &overflow); 2427 __ j(OVERFLOW, &overflow);
2426 __ movq(left, Address(ESP, 0)); 2428 __ movq(left, Address(ESP, 0));
2427 __ addl(ESP, Immediate(2 * kWordSize)); 2429 __ addl(ESP, Immediate(2 * kWordSize));
2428 __ jmp(&done); 2430 __ jmp(&done);
2429 __ Bind(&overflow); 2431 __ Bind(&overflow);
2430 __ addl(ESP, Immediate(2 * kWordSize)); 2432 __ addl(ESP, Immediate(2 * kWordSize));
2431 __ jmp(deopt); 2433 __ jmp(deopt);
2432 __ Bind(&done); 2434 __ Bind(&done);
2433 break; 2435 break;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. 2527 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2526 __ pxor(value, XMM0); 2528 __ pxor(value, XMM0);
2527 } 2529 }
2528 2530
2529 2531
2530 } // namespace dart 2532 } // namespace dart
2531 2533
2532 #undef __ 2534 #undef __
2533 2535
2534 #endif // defined TARGET_ARCH_X64 2536 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698