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

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

Issue 2014413003: Bump the C stack pointer when building Dart frames to maintain the ARM64 ABI requirements without g… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: assembler test Created 4 years, 6 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
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/constants_arm64.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 384
385 ASSEMBLER_TEST_RUN(WordOverflow, test) { 385 ASSEMBLER_TEST_RUN(WordOverflow, test) {
386 typedef int64_t (*Int64Return)() DART_UNUSED; 386 typedef int64_t (*Int64Return)() DART_UNUSED;
387 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 387 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
388 } 388 }
389 389
390 390
391 // Loads and Stores. 391 // Loads and Stores.
392 ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) { 392 ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) {
393 __ SetupDartSP(kTestStackSpace); 393 __ SetupDartSP();
394 __ movz(R0, Immediate(43), 0); 394 __ movz(R0, Immediate(43), 0);
395 __ movz(R1, Immediate(42), 0); 395 __ movz(R1, Immediate(42), 0);
396 __ str(R1, Address(SP, -1*kWordSize, Address::PreIndex)); 396 __ str(R1, Address(SP, -1*kWordSize, Address::PreIndex));
397 __ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex)); 397 __ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex));
398 __ mov(CSP, SP); 398 __ RestoreCSP();
399 __ ret(); 399 __ ret();
400 } 400 }
401 401
402 402
403 ASSEMBLER_TEST_RUN(SimpleLoadStore, test) { 403 ASSEMBLER_TEST_RUN(SimpleLoadStore, test) {
404 typedef int64_t (*Int64Return)() DART_UNUSED; 404 typedef int64_t (*Int64Return)() DART_UNUSED;
405 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 405 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
406 } 406 }
407 407
408 408
409 ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) { 409 ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) {
410 __ SetupDartSP(kTestStackSpace); 410 __ SetupDartSP();
411 __ movz(R0, Immediate(43), 0); 411 __ movz(R0, Immediate(43), 0);
412 __ movz(R1, Immediate(42), 0); 412 __ movz(R1, Immediate(42), 0);
413 __ add(R2, SP, Operand(1)); 413 __ add(R2, SP, Operand(1));
414 __ str(R1, Address(R2, -1)); 414 __ str(R1, Address(R2, -1));
415 __ ldr(R0, Address(R2, -1)); 415 __ ldr(R0, Address(R2, -1));
416 __ mov(CSP, SP); 416 __ RestoreCSP();
417 __ ret(); 417 __ ret();
418 } 418 }
419 419
420 420
421 ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) { 421 ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) {
422 typedef int64_t (*Int64Return)() DART_UNUSED; 422 typedef int64_t (*Int64Return)() DART_UNUSED;
423 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 423 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
424 } 424 }
425 425
426 426
427 ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) { 427 ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) {
428 __ SetupDartSP(kTestStackSpace); 428 __ SetupDartSP();
429 __ movz(R0, Immediate(43), 0); 429 __ movz(R0, Immediate(43), 0);
430 __ movz(R1, Immediate(42), 0); 430 __ movz(R1, Immediate(42), 0);
431 // Largest negative offset that can fit in the signed 9-bit immediate field. 431 // Largest negative offset that can fit in the signed 9-bit immediate field.
432 __ str(R1, Address(SP, -32*kWordSize, Address::PreIndex)); 432 __ str(R1, Address(SP, -32*kWordSize, Address::PreIndex));
433 // Largest positive kWordSize aligned offset that we can fit. 433 // Largest positive kWordSize aligned offset that we can fit.
434 __ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex)); 434 __ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex));
435 // Correction. 435 // Correction.
436 __ add(SP, SP, Operand(kWordSize)); // Restore SP. 436 __ add(SP, SP, Operand(kWordSize)); // Restore SP.
437 __ mov(CSP, SP); 437 __ RestoreCSP();
438 __ ret(); 438 __ ret();
439 } 439 }
440 440
441 441
442 ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) { 442 ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) {
443 typedef int64_t (*Int64Return)() DART_UNUSED; 443 typedef int64_t (*Int64Return)() DART_UNUSED;
444 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 444 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
445 } 445 }
446 446
447 447
448 ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) { 448 ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) {
449 __ SetupDartSP(kTestStackSpace); 449 __ SetupDartSP();
450 __ movz(R0, Immediate(43), 0); 450 __ movz(R0, Immediate(43), 0);
451 __ movz(R1, Immediate(42), 0); 451 __ movz(R1, Immediate(42), 0);
452 __ sub(SP, SP, Operand(512*kWordSize)); 452 __ sub(SP, SP, Operand(512*kWordSize));
453 __ str(R1, Address(SP, 512*kWordSize, Address::Offset)); 453 __ str(R1, Address(SP, 512*kWordSize, Address::Offset));
454 __ add(SP, SP, Operand(512*kWordSize)); 454 __ add(SP, SP, Operand(512*kWordSize));
455 __ ldr(R0, Address(SP)); 455 __ ldr(R0, Address(SP));
456 __ mov(CSP, SP); 456 __ RestoreCSP();
457 __ ret(); 457 __ ret();
458 } 458 }
459 459
460 460
461 ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) { 461 ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) {
462 typedef int64_t (*Int64Return)() DART_UNUSED; 462 typedef int64_t (*Int64Return)() DART_UNUSED;
463 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 463 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
464 } 464 }
465 465
466 466
467 ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) { 467 ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) {
468 __ SetupDartSP(kTestStackSpace); 468 __ SetupDartSP();
469 __ movz(R0, Immediate(43), 0); 469 __ movz(R0, Immediate(43), 0);
470 __ movz(R1, Immediate(42), 0); 470 __ movz(R1, Immediate(42), 0);
471 __ movz(R2, Immediate(0xfff8), 0); 471 __ movz(R2, Immediate(0xfff8), 0);
472 __ movk(R2, Immediate(0xffff), 1); // R2 <- -8 (int32_t). 472 __ movk(R2, Immediate(0xffff), 1); // R2 <- -8 (int32_t).
473 // This should sign extend R2, and add to SP to get address, 473 // This should sign extend R2, and add to SP to get address,
474 // i.e. SP - kWordSize. 474 // i.e. SP - kWordSize.
475 __ str(R1, Address(SP, R2, SXTW)); 475 __ str(R1, Address(SP, R2, SXTW));
476 __ sub(SP, SP, Operand(kWordSize)); 476 __ sub(SP, SP, Operand(kWordSize));
477 __ ldr(R0, Address(SP)); 477 __ ldr(R0, Address(SP));
478 __ add(SP, SP, Operand(kWordSize)); 478 __ add(SP, SP, Operand(kWordSize));
479 __ mov(CSP, SP); 479 __ RestoreCSP();
480 __ ret(); 480 __ ret();
481 } 481 }
482 482
483 483
484 ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) { 484 ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) {
485 typedef int64_t (*Int64Return)() DART_UNUSED; 485 typedef int64_t (*Int64Return)() DART_UNUSED;
486 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 486 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
487 } 487 }
488 488
489 489
490 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { 490 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) {
491 __ SetupDartSP(kTestStackSpace); 491 __ SetupDartSP();
492 __ movz(R0, Immediate(43), 0); 492 __ movz(R0, Immediate(43), 0);
493 __ movz(R1, Immediate(42), 0); 493 __ movz(R1, Immediate(42), 0);
494 __ movz(R2, Immediate(10), 0); 494 __ movz(R2, Immediate(10), 0);
495 __ sub(SP, SP, Operand(10*kWordSize)); 495 __ sub(SP, SP, Operand(10*kWordSize));
496 // Store R1 into SP + R2 * kWordSize. 496 // Store R1 into SP + R2 * kWordSize.
497 __ str(R1, Address(SP, R2, UXTX, Address::Scaled)); 497 __ str(R1, Address(SP, R2, UXTX, Address::Scaled));
498 __ ldr(R0, Address(SP, R2, UXTX, Address::Scaled)); 498 __ ldr(R0, Address(SP, R2, UXTX, Address::Scaled));
499 __ add(SP, SP, Operand(10*kWordSize)); 499 __ add(SP, SP, Operand(10*kWordSize));
500 __ mov(CSP, SP); 500 __ RestoreCSP();
501 __ ret(); 501 __ ret();
502 } 502 }
503 503
504 504
505 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { 505 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) {
506 typedef int64_t (*Int64Return)() DART_UNUSED; 506 typedef int64_t (*Int64Return)() DART_UNUSED;
507 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 507 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
508 } 508 }
509 509
510 510
511 ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) { 511 ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) {
512 __ SetupDartSP(kTestStackSpace); 512 __ SetupDartSP();
513 __ LoadImmediate(R1, 0xffffffff); 513 __ LoadImmediate(R1, 0xffffffff);
514 __ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord); 514 __ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord);
515 __ ldr(R0, Address(SP), kWord); 515 __ ldr(R0, Address(SP), kWord);
516 __ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord); 516 __ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord);
517 __ mov(CSP, SP); 517 __ RestoreCSP();
518 __ ret(); 518 __ ret();
519 } 519 }
520 520
521 521
522 ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) { 522 ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) {
523 typedef int64_t (*Int64Return)() DART_UNUSED; 523 typedef int64_t (*Int64Return)() DART_UNUSED;
524 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 524 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
525 } 525 }
526 526
527 527
528 ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) { 528 ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) {
529 __ SetupDartSP(kTestStackSpace); 529 __ SetupDartSP();
530 __ LoadImmediate(R2, 43); 530 __ LoadImmediate(R2, 43);
531 __ LoadImmediate(R3, 42); 531 __ LoadImmediate(R3, 42);
532 __ stp(R2, R3, Address(SP, -2*kWordSize, Address::PairPreIndex)); 532 __ stp(R2, R3, Address(SP, -2*kWordSize, Address::PairPreIndex));
533 __ ldp(R0, R1, Address(SP, 2*kWordSize, Address::PairPostIndex)); 533 __ ldp(R0, R1, Address(SP, 2*kWordSize, Address::PairPostIndex));
534 __ sub(R0, R0, Operand(R1)); 534 __ sub(R0, R0, Operand(R1));
535 __ mov(CSP, SP); 535 __ RestoreCSP();
536 __ ret(); 536 __ ret();
537 } 537 }
538 538
539 539
540 ASSEMBLER_TEST_RUN(SimpleLoadStorePair, test) { 540 ASSEMBLER_TEST_RUN(SimpleLoadStorePair, test) {
541 typedef int64_t (*Int64Return)() DART_UNUSED; 541 typedef int64_t (*Int64Return)() DART_UNUSED;
542 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 542 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
543 } 543 }
544 544
545 545
546 ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) { 546 ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) {
547 __ SetupDartSP(kTestStackSpace); 547 __ SetupDartSP();
548 __ LoadImmediate(R2, 43); 548 __ LoadImmediate(R2, 43);
549 __ LoadImmediate(R3, 42); 549 __ LoadImmediate(R3, 42);
550 __ sub(SP, SP, Operand(4 * kWordSize)); 550 __ sub(SP, SP, Operand(4 * kWordSize));
551 __ stp(R2, R3, Address::Pair(SP, 2 * kWordSize)); 551 __ stp(R2, R3, Address::Pair(SP, 2 * kWordSize));
552 __ ldp(R0, R1, Address::Pair(SP, 2 * kWordSize)); 552 __ ldp(R0, R1, Address::Pair(SP, 2 * kWordSize));
553 __ add(SP, SP, Operand(4 * kWordSize)); 553 __ add(SP, SP, Operand(4 * kWordSize));
554 __ sub(R0, R0, Operand(R1)); 554 __ sub(R0, R0, Operand(R1));
555 __ mov(CSP, SP); 555 __ RestoreCSP();
556 __ ret(); 556 __ ret();
557 } 557 }
558 558
559 559
560 ASSEMBLER_TEST_RUN(LoadStorePairOffset, test) { 560 ASSEMBLER_TEST_RUN(LoadStorePairOffset, test) {
561 typedef int64_t (*Int64Return)() DART_UNUSED; 561 typedef int64_t (*Int64Return)() DART_UNUSED;
562 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 562 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
563 } 563 }
564 564
565 565
566 ASSEMBLER_TEST_GENERATE(Semaphore, assembler) { 566 ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
567 __ SetupDartSP(kTestStackSpace); 567 __ SetupDartSP();
568 __ movz(R0, Immediate(40), 0); 568 __ movz(R0, Immediate(40), 0);
569 __ movz(R1, Immediate(42), 0); 569 __ movz(R1, Immediate(42), 0);
570 __ Push(R0); 570 __ Push(R0);
571 Label retry; 571 Label retry;
572 __ Bind(&retry); 572 __ Bind(&retry);
573 __ ldxr(R0, SP); 573 __ ldxr(R0, SP);
574 __ stxr(TMP, R1, SP); // IP == 0, success 574 __ stxr(TMP, R1, SP); // IP == 0, success
575 __ cmp(TMP, Operand(0)); 575 __ cmp(TMP, Operand(0));
576 __ b(&retry, NE); // NE if context switch occurred between ldrex and strex. 576 __ b(&retry, NE); // NE if context switch occurred between ldrex and strex.
577 __ Pop(R0); // 42 577 __ Pop(R0); // 42
578 __ mov(CSP, SP); 578 __ RestoreCSP();
579 __ ret(); 579 __ ret();
580 } 580 }
581 581
582 582
583 ASSEMBLER_TEST_RUN(Semaphore, test) { 583 ASSEMBLER_TEST_RUN(Semaphore, test) {
584 EXPECT(test != NULL); 584 EXPECT(test != NULL);
585 typedef int (*Semaphore)() DART_UNUSED; 585 typedef int (*Semaphore)() DART_UNUSED;
586 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Semaphore, test->entry())); 586 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Semaphore, test->entry()));
587 } 587 }
588 588
589 589
590 ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { 590 ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
591 __ SetupDartSP(kTestStackSpace); 591 __ SetupDartSP();
592 __ movz(R0, Immediate(40), 0); 592 __ movz(R0, Immediate(40), 0);
593 __ movz(R1, Immediate(42), 0); 593 __ movz(R1, Immediate(42), 0);
594 __ Push(R0); 594 __ Push(R0);
595 __ ldxr(R0, SP); 595 __ ldxr(R0, SP);
596 __ clrex(); // Simulate a context switch. 596 __ clrex(); // Simulate a context switch.
597 __ stxr(TMP, R1, SP); // IP == 1, failure 597 __ stxr(TMP, R1, SP); // IP == 1, failure
598 __ Pop(R0); // 40 598 __ Pop(R0); // 40
599 __ add(R0, R0, Operand(TMP)); 599 __ add(R0, R0, Operand(TMP));
600 __ mov(CSP, SP); 600 __ RestoreCSP();
601 __ ret(); 601 __ ret();
602 } 602 }
603 603
604 604
605 ASSEMBLER_TEST_RUN(FailedSemaphore, test) { 605 ASSEMBLER_TEST_RUN(FailedSemaphore, test) {
606 EXPECT(test != NULL); 606 EXPECT(test != NULL);
607 typedef int (*FailedSemaphore)() DART_UNUSED; 607 typedef int (*FailedSemaphore)() DART_UNUSED;
608 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT64(FailedSemaphore, test->entry())); 608 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT64(FailedSemaphore, test->entry()));
609 } 609 }
610 610
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 __ ret(); 716 __ ret();
717 } 717 }
718 718
719 719
720 ASSEMBLER_TEST_RUN(AndImm, test) { 720 ASSEMBLER_TEST_RUN(AndImm, test) {
721 typedef int64_t (*Int64Return)() DART_UNUSED; 721 typedef int64_t (*Int64Return)() DART_UNUSED;
722 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 722 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
723 } 723 }
724 724
725 725
726 ASSEMBLER_TEST_GENERATE(AndImmCsp, assembler) {
727 // Note we must maintain the ARM64 ABI invariants on CSP here.
728 __ mov(TMP, CSP);
729 __ sub(TMP2, CSP, Operand(31));
730 __ andi(CSP, TMP2, Immediate(~15));
731 __ mov(R0, CSP);
732 __ sub(R0, TMP, Operand(R0));
733 __ mov(CSP, TMP);
734 __ ret();
735 }
736
737
738 ASSEMBLER_TEST_RUN(AndImmCsp, test) {
739 typedef int64_t (*Int64Return)() DART_UNUSED;
740 EXPECT_EQ(32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
741 }
742
743
726 ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) { 744 ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) {
727 __ movz(R1, Immediate(43), 0); 745 __ movz(R1, Immediate(43), 0);
728 __ andi(R0, R1, Immediate(1)); 746 __ andi(R0, R1, Immediate(1));
729 __ ret(); 747 __ ret();
730 } 748 }
731 749
732 750
733 ASSEMBLER_TEST_RUN(AndOneImm, test) { 751 ASSEMBLER_TEST_RUN(AndOneImm, test) {
734 typedef int64_t (*Int64Return)() DART_UNUSED; 752 typedef int64_t (*Int64Return)() DART_UNUSED;
735 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 753 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 static void LeaveTestFrame(Assembler* assembler) { 1700 static void LeaveTestFrame(Assembler* assembler) {
1683 __ PopAndUntagPP(); 1701 __ PopAndUntagPP();
1684 __ Pop(THR); 1702 __ Pop(THR);
1685 __ Pop(CODE_REG); 1703 __ Pop(CODE_REG);
1686 __ LeaveFrame(); 1704 __ LeaveFrame();
1687 } 1705 }
1688 1706
1689 1707
1690 // Loading immediate values with the object pool. 1708 // Loading immediate values with the object pool.
1691 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { 1709 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) {
1692 __ SetupDartSP(kTestStackSpace); 1710 __ SetupDartSP();
1693 EnterTestFrame(assembler); 1711 EnterTestFrame(assembler);
1694 __ LoadImmediate(R0, 42); 1712 __ LoadImmediate(R0, 42);
1695 LeaveTestFrame(assembler); 1713 LeaveTestFrame(assembler);
1696 __ mov(CSP, SP); 1714 __ RestoreCSP();
1697 __ ret(); 1715 __ ret();
1698 } 1716 }
1699 1717
1700 1718
1701 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { 1719 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) {
1702 EXPECT_EQ(42, test->InvokeWithCodeAndThread<int64_t>()); 1720 EXPECT_EQ(42, test->InvokeWithCodeAndThread<int64_t>());
1703 } 1721 }
1704 1722
1705 1723
1706 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { 1724 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) {
1707 __ SetupDartSP(kTestStackSpace); 1725 __ SetupDartSP();
1708 EnterTestFrame(assembler); 1726 EnterTestFrame(assembler);
1709 __ LoadImmediate(R0, 0xf1234123); 1727 __ LoadImmediate(R0, 0xf1234123);
1710 LeaveTestFrame(assembler); 1728 LeaveTestFrame(assembler);
1711 __ mov(CSP, SP); 1729 __ RestoreCSP();
1712 __ ret(); 1730 __ ret();
1713 } 1731 }
1714 1732
1715 1733
1716 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { 1734 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) {
1717 EXPECT_EQ(0xf1234123, test->InvokeWithCodeAndThread<int64_t>()); 1735 EXPECT_EQ(0xf1234123, test->InvokeWithCodeAndThread<int64_t>());
1718 } 1736 }
1719 1737
1720 1738
1721 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { 1739 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) {
1722 __ SetupDartSP(kTestStackSpace); 1740 __ SetupDartSP();
1723 EnterTestFrame(assembler); 1741 EnterTestFrame(assembler);
1724 __ LoadImmediate(R0, 0x4321f1234124); 1742 __ LoadImmediate(R0, 0x4321f1234124);
1725 LeaveTestFrame(assembler); 1743 LeaveTestFrame(assembler);
1726 __ mov(CSP, SP); 1744 __ RestoreCSP();
1727 __ ret(); 1745 __ ret();
1728 } 1746 }
1729 1747
1730 1748
1731 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { 1749 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) {
1732 EXPECT_EQ(0x4321f1234124, test->InvokeWithCodeAndThread<int64_t>()); 1750 EXPECT_EQ(0x4321f1234124, test->InvokeWithCodeAndThread<int64_t>());
1733 } 1751 }
1734 1752
1735 1753
1736 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { 1754 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) {
1737 __ SetupDartSP(kTestStackSpace); 1755 __ SetupDartSP();
1738 EnterTestFrame(assembler); 1756 EnterTestFrame(assembler);
1739 __ LoadImmediate(R0, 0x9287436598237465); 1757 __ LoadImmediate(R0, 0x9287436598237465);
1740 LeaveTestFrame(assembler); 1758 LeaveTestFrame(assembler);
1741 __ mov(CSP, SP); 1759 __ RestoreCSP();
1742 __ ret(); 1760 __ ret();
1743 } 1761 }
1744 1762
1745 1763
1746 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { 1764 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
1747 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), 1765 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465),
1748 test->InvokeWithCodeAndThread<int64_t>()); 1766 test->InvokeWithCodeAndThread<int64_t>());
1749 } 1767 }
1750 1768
1751 1769
1752 // LoadObject null. 1770 // LoadObject null.
1753 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { 1771 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
1754 __ SetupDartSP(kTestStackSpace); 1772 __ SetupDartSP();
1755 EnterTestFrame(assembler); 1773 EnterTestFrame(assembler);
1756 __ LoadObject(R0, Object::null_object()); 1774 __ LoadObject(R0, Object::null_object());
1757 LeaveTestFrame(assembler); 1775 LeaveTestFrame(assembler);
1758 __ mov(CSP, SP); 1776 __ RestoreCSP();
1759 __ ret(); 1777 __ ret();
1760 } 1778 }
1761 1779
1762 1780
1763 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { 1781 ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
1764 EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread<RawObject*>()); 1782 EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread<RawObject*>());
1765 } 1783 }
1766 1784
1767 1785
1768 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { 1786 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
1769 __ SetupDartSP(kTestStackSpace); 1787 __ SetupDartSP();
1770 EnterTestFrame(assembler); 1788 EnterTestFrame(assembler);
1771 __ LoadObject(R0, Bool::True()); 1789 __ LoadObject(R0, Bool::True());
1772 LeaveTestFrame(assembler); 1790 LeaveTestFrame(assembler);
1773 __ mov(CSP, SP); 1791 __ RestoreCSP();
1774 __ ret(); 1792 __ ret();
1775 } 1793 }
1776 1794
1777 1795
1778 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { 1796 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
1779 EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread<RawObject*>()); 1797 EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread<RawObject*>());
1780 } 1798 }
1781 1799
1782 1800
1783 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { 1801 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
1784 __ SetupDartSP(kTestStackSpace); 1802 __ SetupDartSP();
1785 EnterTestFrame(assembler); 1803 EnterTestFrame(assembler);
1786 __ LoadObject(R0, Bool::False()); 1804 __ LoadObject(R0, Bool::False());
1787 LeaveTestFrame(assembler); 1805 LeaveTestFrame(assembler);
1788 __ mov(CSP, SP); 1806 __ RestoreCSP();
1789 __ ret(); 1807 __ ret();
1790 } 1808 }
1791 1809
1792 1810
1793 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { 1811 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
1794 EXPECT_EQ(Bool::False().raw(), test->InvokeWithCodeAndThread<RawObject*>()); 1812 EXPECT_EQ(Bool::False().raw(), test->InvokeWithCodeAndThread<RawObject*>());
1795 } 1813 }
1796 1814
1797 1815
1798 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { 1816 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 } 1951 }
1934 1952
1935 1953
1936 ASSEMBLER_TEST_RUN(Fmovdr, test) { 1954 ASSEMBLER_TEST_RUN(Fmovdr, test) {
1937 typedef double (*DoubleReturn)() DART_UNUSED; 1955 typedef double (*DoubleReturn)() DART_UNUSED;
1938 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 1956 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
1939 } 1957 }
1940 1958
1941 1959
1942 ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) { 1960 ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) {
1943 __ SetupDartSP(kTestStackSpace); 1961 __ SetupDartSP();
1944 __ LoadDImmediate(V1, 42.0); 1962 __ LoadDImmediate(V1, 42.0);
1945 __ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex)); 1963 __ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex));
1946 __ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex)); 1964 __ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex));
1947 __ mov(CSP, SP); 1965 __ RestoreCSP();
1948 __ ret(); 1966 __ ret();
1949 } 1967 }
1950 1968
1951 1969
1952 ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) { 1970 ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) {
1953 typedef double (*DoubleReturn)() DART_UNUSED; 1971 typedef double (*DoubleReturn)() DART_UNUSED;
1954 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 1972 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
1955 } 1973 }
1956 1974
1957 1975
1958 ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) { 1976 ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) {
1959 __ SetupDartSP(kTestStackSpace); 1977 __ SetupDartSP();
1960 __ LoadDImmediate(V1, 42.0); 1978 __ LoadDImmediate(V1, 42.0);
1961 __ fcvtsd(V2, V1); 1979 __ fcvtsd(V2, V1);
1962 __ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex)); 1980 __ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex));
1963 __ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex)); 1981 __ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex));
1964 __ fcvtds(V0, V3); 1982 __ fcvtds(V0, V3);
1965 __ mov(CSP, SP); 1983 __ RestoreCSP();
1966 __ ret(); 1984 __ ret();
1967 } 1985 }
1968 1986
1969 1987
1970 ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) { 1988 ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) {
1971 typedef double (*DoubleReturn)() DART_UNUSED; 1989 typedef double (*DoubleReturn)() DART_UNUSED;
1972 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 1990 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
1973 } 1991 }
1974 1992
1975 1993
1976 ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) { 1994 ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) {
1977 __ SetupDartSP(kTestStackSpace); 1995 __ SetupDartSP();
1978 __ LoadDImmediate(V1, 21.0); 1996 __ LoadDImmediate(V1, 21.0);
1979 __ LoadDImmediate(V2, 21.0); 1997 __ LoadDImmediate(V2, 21.0);
1980 __ LoadImmediate(R1, 42); 1998 __ LoadImmediate(R1, 42);
1981 __ Push(R1); 1999 __ Push(R1);
1982 __ PushDouble(V1); 2000 __ PushDouble(V1);
1983 __ PushDouble(V2); 2001 __ PushDouble(V2);
1984 __ fldrq(V3, Address(SP, 2 * kWordSize, Address::PostIndex)); 2002 __ fldrq(V3, Address(SP, 2 * kWordSize, Address::PostIndex));
1985 __ Pop(R0); 2003 __ Pop(R0);
1986 __ fstrq(V3, Address(SP, -2 * kWordSize, Address::PreIndex)); 2004 __ fstrq(V3, Address(SP, -2 * kWordSize, Address::PreIndex));
1987 __ PopDouble(V0); 2005 __ PopDouble(V0);
1988 __ PopDouble(V1); 2006 __ PopDouble(V1);
1989 __ faddd(V0, V0, V1); 2007 __ faddd(V0, V0, V1);
1990 __ mov(CSP, SP); 2008 __ RestoreCSP();
1991 __ ret(); 2009 __ ret();
1992 } 2010 }
1993 2011
1994 2012
1995 ASSEMBLER_TEST_RUN(FldrqFstrqPrePostIndex, test) { 2013 ASSEMBLER_TEST_RUN(FldrqFstrqPrePostIndex, test) {
1996 typedef double (*DoubleReturn)() DART_UNUSED; 2014 typedef double (*DoubleReturn)() DART_UNUSED;
1997 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2015 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
1998 } 2016 }
1999 2017
2000 2018
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 } 2171 }
2154 2172
2155 2173
2156 ASSEMBLER_TEST_RUN(Fsubd, test) { 2174 ASSEMBLER_TEST_RUN(Fsubd, test) {
2157 typedef double (*DoubleReturn)() DART_UNUSED; 2175 typedef double (*DoubleReturn)() DART_UNUSED;
2158 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2176 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2159 } 2177 }
2160 2178
2161 2179
2162 ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) { 2180 ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) {
2163 __ SetupDartSP(kTestStackSpace); 2181 __ SetupDartSP();
2164 __ LoadDImmediate(V0, 43.0); 2182 __ LoadDImmediate(V0, 43.0);
2165 __ LoadDImmediate(V1, 42.0); 2183 __ LoadDImmediate(V1, 42.0);
2166 __ AddImmediate(SP, SP, -1 * kWordSize); 2184 __ AddImmediate(SP, SP, -1 * kWordSize);
2167 __ add(R2, SP, Operand(1)); 2185 __ add(R2, SP, Operand(1));
2168 __ fstrd(V1, Address(R2, -1)); 2186 __ fstrd(V1, Address(R2, -1));
2169 __ fldrd(V0, Address(R2, -1)); 2187 __ fldrd(V0, Address(R2, -1));
2170 __ AddImmediate(SP, SP, 1 * kWordSize); 2188 __ AddImmediate(SP, SP, 1 * kWordSize);
2171 __ mov(CSP, SP); 2189 __ RestoreCSP();
2172 __ ret(); 2190 __ ret();
2173 } 2191 }
2174 2192
2175 2193
2176 ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) { 2194 ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) {
2177 typedef double (*DoubleReturn)() DART_UNUSED; 2195 typedef double (*DoubleReturn)() DART_UNUSED;
2178 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2196 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2179 } 2197 }
2180 2198
2181 2199
2182 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) { 2200 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) {
2183 __ SetupDartSP(kTestStackSpace); 2201 __ SetupDartSP();
2184 __ LoadDImmediate(V0, 43.0); 2202 __ LoadDImmediate(V0, 43.0);
2185 __ LoadDImmediate(V1, 42.0); 2203 __ LoadDImmediate(V1, 42.0);
2186 // Largest negative offset that can fit in the signed 9-bit immediate field. 2204 // Largest negative offset that can fit in the signed 9-bit immediate field.
2187 __ fstrd(V1, Address(SP, -32*kWordSize, Address::PreIndex)); 2205 __ fstrd(V1, Address(SP, -32*kWordSize, Address::PreIndex));
2188 // Largest positive kWordSize aligned offset that we can fit. 2206 // Largest positive kWordSize aligned offset that we can fit.
2189 __ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex)); 2207 __ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex));
2190 // Correction. 2208 // Correction.
2191 __ add(SP, SP, Operand(kWordSize)); // Restore SP. 2209 __ add(SP, SP, Operand(kWordSize)); // Restore SP.
2192 __ mov(CSP, SP); 2210 __ RestoreCSP();
2193 __ ret(); 2211 __ ret();
2194 } 2212 }
2195 2213
2196 2214
2197 ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) { 2215 ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) {
2198 typedef double (*DoubleReturn)() DART_UNUSED; 2216 typedef double (*DoubleReturn)() DART_UNUSED;
2199 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2217 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2200 } 2218 }
2201 2219
2202 2220
2203 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) { 2221 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) {
2204 __ SetupDartSP(kTestStackSpace); 2222 __ SetupDartSP();
2205 __ LoadDImmediate(V0, 43.0); 2223 __ LoadDImmediate(V0, 43.0);
2206 __ LoadDImmediate(V1, 42.0); 2224 __ LoadDImmediate(V1, 42.0);
2207 __ sub(SP, SP, Operand(512*kWordSize)); 2225 __ sub(SP, SP, Operand(512*kWordSize));
2208 __ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset)); 2226 __ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset));
2209 __ add(SP, SP, Operand(512*kWordSize)); 2227 __ add(SP, SP, Operand(512*kWordSize));
2210 __ fldrd(V0, Address(SP)); 2228 __ fldrd(V0, Address(SP));
2211 __ mov(CSP, SP); 2229 __ RestoreCSP();
2212 __ ret(); 2230 __ ret();
2213 } 2231 }
2214 2232
2215 2233
2216 ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) { 2234 ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) {
2217 typedef double (*DoubleReturn)() DART_UNUSED; 2235 typedef double (*DoubleReturn)() DART_UNUSED;
2218 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2236 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2219 } 2237 }
2220 2238
2221 2239
2222 ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) { 2240 ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) {
2223 __ SetupDartSP(kTestStackSpace); 2241 __ SetupDartSP();
2224 __ LoadDImmediate(V0, 43.0); 2242 __ LoadDImmediate(V0, 43.0);
2225 __ LoadDImmediate(V1, 42.0); 2243 __ LoadDImmediate(V1, 42.0);
2226 __ movz(R2, Immediate(0xfff8), 0); 2244 __ movz(R2, Immediate(0xfff8), 0);
2227 __ movk(R2, Immediate(0xffff), 1); // R2 <- -8 (int32_t). 2245 __ movk(R2, Immediate(0xffff), 1); // R2 <- -8 (int32_t).
2228 // This should sign extend R2, and add to SP to get address, 2246 // This should sign extend R2, and add to SP to get address,
2229 // i.e. SP - kWordSize. 2247 // i.e. SP - kWordSize.
2230 __ fstrd(V1, Address(SP, R2, SXTW)); 2248 __ fstrd(V1, Address(SP, R2, SXTW));
2231 __ sub(SP, SP, Operand(kWordSize)); 2249 __ sub(SP, SP, Operand(kWordSize));
2232 __ fldrd(V0, Address(SP)); 2250 __ fldrd(V0, Address(SP));
2233 __ add(SP, SP, Operand(kWordSize)); 2251 __ add(SP, SP, Operand(kWordSize));
2234 __ mov(CSP, SP); 2252 __ RestoreCSP();
2235 __ ret(); 2253 __ ret();
2236 } 2254 }
2237 2255
2238 2256
2239 ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) { 2257 ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) {
2240 typedef double (*DoubleReturn)() DART_UNUSED; 2258 typedef double (*DoubleReturn)() DART_UNUSED;
2241 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2259 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2242 } 2260 }
2243 2261
2244 2262
2245 ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) { 2263 ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) {
2246 __ SetupDartSP(kTestStackSpace); 2264 __ SetupDartSP();
2247 __ LoadDImmediate(V0, 43.0); 2265 __ LoadDImmediate(V0, 43.0);
2248 __ LoadDImmediate(V1, 42.0); 2266 __ LoadDImmediate(V1, 42.0);
2249 __ movz(R2, Immediate(10), 0); 2267 __ movz(R2, Immediate(10), 0);
2250 __ sub(SP, SP, Operand(10*kWordSize)); 2268 __ sub(SP, SP, Operand(10*kWordSize));
2251 // Store V1 into SP + R2 * kWordSize. 2269 // Store V1 into SP + R2 * kWordSize.
2252 __ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled)); 2270 __ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled));
2253 __ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled)); 2271 __ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled));
2254 __ add(SP, SP, Operand(10*kWordSize)); 2272 __ add(SP, SP, Operand(10*kWordSize));
2255 __ mov(CSP, SP); 2273 __ RestoreCSP();
2256 __ ret(); 2274 __ ret();
2257 } 2275 }
2258 2276
2259 2277
2260 ASSEMBLER_TEST_RUN(FldrdFstrdScaledReg, test) { 2278 ASSEMBLER_TEST_RUN(FldrdFstrdScaledReg, test) {
2261 typedef double (*DoubleReturn)() DART_UNUSED; 2279 typedef double (*DoubleReturn)() DART_UNUSED;
2262 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2280 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2263 } 2281 }
2264 2282
2265 2283
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 } 2718 }
2701 2719
2702 2720
2703 ASSEMBLER_TEST_RUN(Vdivd, test) { 2721 ASSEMBLER_TEST_RUN(Vdivd, test) {
2704 typedef double (*DoubleReturn)() DART_UNUSED; 2722 typedef double (*DoubleReturn)() DART_UNUSED;
2705 EXPECT_EQ(2.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2723 EXPECT_EQ(2.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2706 } 2724 }
2707 2725
2708 2726
2709 ASSEMBLER_TEST_GENERATE(Vdupd, assembler) { 2727 ASSEMBLER_TEST_GENERATE(Vdupd, assembler) {
2710 __ SetupDartSP(kTestStackSpace); 2728 __ SetupDartSP();
2711 __ LoadDImmediate(V0, 21.0); 2729 __ LoadDImmediate(V0, 21.0);
2712 __ vdupd(V1, V0, 0); 2730 __ vdupd(V1, V0, 0);
2713 2731
2714 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); 2732 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord);
2715 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); 2733 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord);
2716 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); 2734 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex));
2717 2735
2718 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); 2736 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex));
2719 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); 2737 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
2720 2738
2721 __ faddd(V0, V2, V3); 2739 __ faddd(V0, V2, V3);
2722 __ mov(CSP, SP); 2740 __ RestoreCSP();
2723 __ ret(); 2741 __ ret();
2724 } 2742 }
2725 2743
2726 2744
2727 ASSEMBLER_TEST_RUN(Vdupd, test) { 2745 ASSEMBLER_TEST_RUN(Vdupd, test) {
2728 typedef double (*DoubleReturn)() DART_UNUSED; 2746 typedef double (*DoubleReturn)() DART_UNUSED;
2729 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2747 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2730 } 2748 }
2731 2749
2732 2750
2733 ASSEMBLER_TEST_GENERATE(Vdups, assembler) { 2751 ASSEMBLER_TEST_GENERATE(Vdups, assembler) {
2734 __ SetupDartSP(kTestStackSpace); 2752 __ SetupDartSP();
2735 __ LoadDImmediate(V0, 21.0); 2753 __ LoadDImmediate(V0, 21.0);
2736 __ fcvtsd(V0, V0); 2754 __ fcvtsd(V0, V0);
2737 __ vdups(V1, V0, 0); 2755 __ vdups(V1, V0, 0);
2738 2756
2739 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); 2757 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord);
2740 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); 2758 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord);
2741 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); 2759 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex));
2742 2760
2743 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2761 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex));
2744 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2762 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex));
2745 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2763 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex));
2746 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2764 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex));
2747 2765
2748 __ fcvtds(V0, V0); 2766 __ fcvtds(V0, V0);
2749 __ fcvtds(V1, V1); 2767 __ fcvtds(V1, V1);
2750 __ fcvtds(V2, V2); 2768 __ fcvtds(V2, V2);
2751 __ fcvtds(V3, V3); 2769 __ fcvtds(V3, V3);
2752 2770
2753 __ faddd(V0, V1, V1); 2771 __ faddd(V0, V1, V1);
2754 __ faddd(V0, V0, V2); 2772 __ faddd(V0, V0, V2);
2755 __ faddd(V0, V0, V3); 2773 __ faddd(V0, V0, V3);
2756 __ mov(CSP, SP); 2774 __ RestoreCSP();
2757 __ ret(); 2775 __ ret();
2758 } 2776 }
2759 2777
2760 2778
2761 ASSEMBLER_TEST_RUN(Vdups, test) { 2779 ASSEMBLER_TEST_RUN(Vdups, test) {
2762 typedef double (*DoubleReturn)() DART_UNUSED; 2780 typedef double (*DoubleReturn)() DART_UNUSED;
2763 EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2781 EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2764 } 2782 }
2765 2783
2766 2784
2767 ASSEMBLER_TEST_GENERATE(Vinsd, assembler) { 2785 ASSEMBLER_TEST_GENERATE(Vinsd, assembler) {
2768 __ SetupDartSP(kTestStackSpace); 2786 __ SetupDartSP();
2769 __ LoadDImmediate(V5, 42.0); 2787 __ LoadDImmediate(V5, 42.0);
2770 __ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0]. 2788 __ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0].
2771 2789
2772 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); 2790 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord);
2773 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); 2791 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord);
2774 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); 2792 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex));
2775 2793
2776 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); 2794 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex));
2777 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); 2795 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
2778 2796
2779 __ fmovdd(V0, V3); 2797 __ fmovdd(V0, V3);
2780 __ mov(CSP, SP); 2798 __ RestoreCSP();
2781 __ ret(); 2799 __ ret();
2782 } 2800 }
2783 2801
2784 2802
2785 ASSEMBLER_TEST_RUN(Vinsd, test) { 2803 ASSEMBLER_TEST_RUN(Vinsd, test) {
2786 typedef double (*DoubleReturn)() DART_UNUSED; 2804 typedef double (*DoubleReturn)() DART_UNUSED;
2787 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2805 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2788 } 2806 }
2789 2807
2790 2808
2791 ASSEMBLER_TEST_GENERATE(Vinss, assembler) { 2809 ASSEMBLER_TEST_GENERATE(Vinss, assembler) {
2792 __ SetupDartSP(kTestStackSpace); 2810 __ SetupDartSP();
2793 __ LoadDImmediate(V0, 21.0); 2811 __ LoadDImmediate(V0, 21.0);
2794 __ fcvtsd(V0, V0); 2812 __ fcvtsd(V0, V0);
2795 __ vinss(V1, 3, V0, 0); 2813 __ vinss(V1, 3, V0, 0);
2796 __ vinss(V1, 1, V0, 0); 2814 __ vinss(V1, 1, V0, 0);
2797 2815
2798 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); 2816 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord);
2799 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); 2817 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord);
2800 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); 2818 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex));
2801 2819
2802 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2820 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex));
2803 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2821 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex));
2804 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2822 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex));
2805 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); 2823 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex));
2806 2824
2807 __ fcvtds(V0, V0); 2825 __ fcvtds(V0, V0);
2808 __ fcvtds(V1, V1); 2826 __ fcvtds(V1, V1);
2809 __ fcvtds(V2, V2); 2827 __ fcvtds(V2, V2);
2810 __ fcvtds(V3, V3); 2828 __ fcvtds(V3, V3);
2811 2829
2812 __ faddd(V0, V0, V1); 2830 __ faddd(V0, V0, V1);
2813 __ faddd(V0, V0, V2); 2831 __ faddd(V0, V0, V2);
2814 __ faddd(V0, V0, V3); 2832 __ faddd(V0, V0, V3);
2815 __ mov(CSP, SP); 2833 __ RestoreCSP();
2816 __ ret(); 2834 __ ret();
2817 } 2835 }
2818 2836
2819 2837
2820 ASSEMBLER_TEST_RUN(Vinss, test) { 2838 ASSEMBLER_TEST_RUN(Vinss, test) {
2821 typedef double (*DoubleReturn)() DART_UNUSED; 2839 typedef double (*DoubleReturn)() DART_UNUSED;
2822 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); 2840 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
2823 } 2841 }
2824 2842
2825 2843
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 EXPECT_FLOAT_EQ(1.0/sqrt(147000.0), res, 0.0001); 3612 EXPECT_FLOAT_EQ(1.0/sqrt(147000.0), res, 0.0001);
3595 } 3613 }
3596 3614
3597 3615
3598 // Called from assembler_test.cc. 3616 // Called from assembler_test.cc.
3599 // LR: return address. 3617 // LR: return address.
3600 // R0: value. 3618 // R0: value.
3601 // R1: growable array. 3619 // R1: growable array.
3602 // R2: current thread. 3620 // R2: current thread.
3603 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 3621 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
3604 __ SetupDartSP(kTestStackSpace); 3622 __ SetupDartSP();
3605 __ Push(CODE_REG); 3623 __ Push(CODE_REG);
3606 __ Push(THR); 3624 __ Push(THR);
3607 __ Push(LR); 3625 __ Push(LR);
3608 __ mov(THR, R2); 3626 __ mov(THR, R2);
3609 __ StoreIntoObject(R1, 3627 __ StoreIntoObject(R1,
3610 FieldAddress(R1, GrowableObjectArray::data_offset()), 3628 FieldAddress(R1, GrowableObjectArray::data_offset()),
3611 R0); 3629 R0);
3612 __ Pop(LR); 3630 __ Pop(LR);
3613 __ Pop(THR); 3631 __ Pop(THR);
3614 __ Pop(CODE_REG); 3632 __ Pop(CODE_REG);
3615 __ mov(CSP, SP); 3633 __ RestoreCSP();
3616 __ ret(); 3634 __ ret();
3617 } 3635 }
3618 3636
3619 3637
3620 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { 3638 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
3621 __ SetupDartSP(kTestStackSpace); 3639 __ SetupDartSP();
3622 EnterTestFrame(assembler); 3640 EnterTestFrame(assembler);
3623 Label miss, done; 3641 Label miss, done;
3624 __ ComputeRange(R0, R2, R3, &miss); 3642 __ ComputeRange(R0, R2, R3, &miss);
3625 __ b(&done); 3643 __ b(&done);
3626 3644
3627 __ Bind(&miss); 3645 __ Bind(&miss);
3628 __ LoadImmediate(R0, -1); 3646 __ LoadImmediate(R0, -1);
3629 3647
3630 __ Bind(&done); 3648 __ Bind(&done);
3631 LeaveTestFrame(assembler); 3649 LeaveTestFrame(assembler);
3632 __ mov(CSP, SP); 3650 __ RestoreCSP();
3633 __ ret(); 3651 __ ret();
3634 } 3652 }
3635 3653
3636 3654
3637 ASSEMBLER_TEST_RUN(ComputeRange, test) { 3655 ASSEMBLER_TEST_RUN(ComputeRange, test) {
3638 #define RANGE_OF(arg_type, v) \ 3656 #define RANGE_OF(arg_type, v) \
3639 test->InvokeWithCodeAndThread<intptr_t, arg_type>(v) 3657 test->InvokeWithCodeAndThread<intptr_t, arg_type>(v)
3640 3658
3641 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0))); 3659 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0)));
3642 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1))); 3660 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1)));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 3692
3675 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw())); 3693 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw()));
3676 3694
3677 #undef RANGE_OF 3695 #undef RANGE_OF
3678 } 3696 }
3679 3697
3680 3698
3681 } // namespace dart 3699 } // namespace dart
3682 3700
3683 #endif // defined(TARGET_ARCH_ARM64) 3701 #endif // defined(TARGET_ARCH_ARM64)
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698