| OLD | NEW |
| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 __ add(SP, SP, Operand(10*kWordSize)); | 384 __ add(SP, SP, Operand(10*kWordSize)); |
| 385 __ ret(); | 385 __ ret(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 | 388 |
| 389 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { | 389 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { |
| 390 typedef int (*SimpleCode)(); | 390 typedef int (*SimpleCode)(); |
| 391 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 391 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 392 } | 392 } |
| 393 | 393 |
| 394 |
| 395 // Logical register operations. |
| 396 ASSEMBLER_TEST_GENERATE(AndRegs, assembler) { |
| 397 __ movz(R1, 43, 0); |
| 398 __ movz(R2, 42, 0); |
| 399 __ and_(R0, R1, Operand(R2)); |
| 400 __ ret(); |
| 401 } |
| 402 |
| 403 |
| 404 ASSEMBLER_TEST_RUN(AndRegs, test) { |
| 405 typedef int (*SimpleCode)(); |
| 406 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 407 } |
| 408 |
| 409 |
| 410 ASSEMBLER_TEST_GENERATE(AndShiftRegs, assembler) { |
| 411 __ movz(R1, 42, 0); |
| 412 __ movz(R2, 21, 0); |
| 413 __ and_(R0, R1, Operand(R2, LSL, 1)); |
| 414 __ ret(); |
| 415 } |
| 416 |
| 417 |
| 418 ASSEMBLER_TEST_RUN(AndShiftRegs, test) { |
| 419 typedef int (*SimpleCode)(); |
| 420 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 421 } |
| 422 |
| 423 |
| 424 ASSEMBLER_TEST_GENERATE(BicRegs, assembler) { |
| 425 __ movz(R1, 42, 0); |
| 426 __ movz(R2, 5, 0); |
| 427 __ bic(R0, R1, Operand(R2)); |
| 428 __ ret(); |
| 429 } |
| 430 |
| 431 |
| 432 ASSEMBLER_TEST_RUN(BicRegs, test) { |
| 433 typedef int (*SimpleCode)(); |
| 434 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 435 } |
| 436 |
| 437 |
| 438 ASSEMBLER_TEST_GENERATE(OrrRegs, assembler) { |
| 439 __ movz(R1, 32, 0); |
| 440 __ movz(R2, 10, 0); |
| 441 __ orr(R0, R1, Operand(R2)); |
| 442 __ ret(); |
| 443 } |
| 444 |
| 445 |
| 446 ASSEMBLER_TEST_RUN(OrrRegs, test) { |
| 447 typedef int (*SimpleCode)(); |
| 448 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 449 } |
| 450 |
| 451 |
| 452 ASSEMBLER_TEST_GENERATE(OrnRegs, assembler) { |
| 453 __ movz(R1, 32, 0); |
| 454 __ movn(R2, 0, 0); // R2 <- 0xffffffffffffffff. |
| 455 __ movk(R2, 0xffd5, 0); // R2 <- 0xffffffffffffffe5. |
| 456 __ orn(R0, R1, Operand(R2)); |
| 457 __ ret(); |
| 458 } |
| 459 |
| 460 |
| 461 ASSEMBLER_TEST_RUN(OrnRegs, test) { |
| 462 typedef int (*SimpleCode)(); |
| 463 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 464 } |
| 465 |
| 466 |
| 467 ASSEMBLER_TEST_GENERATE(EorRegs, assembler) { |
| 468 __ movz(R1, 0xffd5, 0); |
| 469 __ movz(R2, 0xffff, 0); |
| 470 __ eor(R0, R1, Operand(R2)); |
| 471 __ ret(); |
| 472 } |
| 473 |
| 474 |
| 475 ASSEMBLER_TEST_RUN(EorRegs, test) { |
| 476 typedef int (*SimpleCode)(); |
| 477 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 478 } |
| 479 |
| 480 |
| 481 ASSEMBLER_TEST_GENERATE(EonRegs, assembler) { |
| 482 __ movz(R1, 0xffd5, 0); |
| 483 __ movn(R2, 0xffff, 0); |
| 484 __ eon(R0, R1, Operand(R2)); |
| 485 __ ret(); |
| 486 } |
| 487 |
| 488 |
| 489 ASSEMBLER_TEST_RUN(EonRegs, test) { |
| 490 typedef int (*SimpleCode)(); |
| 491 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 492 } |
| 493 |
| 494 // TODO(zra): ands and bics after branches are implemented. |
| 495 |
| 496 |
| 497 // Logical immediate operations. |
| 498 ASSEMBLER_TEST_GENERATE(AndImm, assembler) { |
| 499 __ movz(R1, 42, 0); |
| 500 __ andi(R0, R1, 0xaaaaaaaaaaaaaaaaULL); |
| 501 __ ret(); |
| 502 } |
| 503 |
| 504 |
| 505 ASSEMBLER_TEST_RUN(AndImm, test) { |
| 506 typedef int (*SimpleCode)(); |
| 507 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 508 } |
| 509 |
| 510 |
| 511 ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) { |
| 512 __ movz(R1, 43, 0); |
| 513 __ andi(R0, R1, 1); |
| 514 __ ret(); |
| 515 } |
| 516 |
| 517 |
| 518 ASSEMBLER_TEST_RUN(AndOneImm, test) { |
| 519 typedef int (*SimpleCode)(); |
| 520 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 521 } |
| 522 |
| 523 |
| 524 ASSEMBLER_TEST_GENERATE(OrrImm, assembler) { |
| 525 __ movz(R1, 0, 0); |
| 526 __ movz(R2, 0x3f, 0); |
| 527 __ movz(R3, 0xa, 0); |
| 528 __ orri(R1, R1, 0x0020002000200020ULL); |
| 529 __ orr(R1, R1, Operand(R3)); |
| 530 __ and_(R0, R1, Operand(R2)); |
| 531 __ ret(); |
| 532 } |
| 533 |
| 534 |
| 535 ASSEMBLER_TEST_RUN(OrrImm, test) { |
| 536 typedef int (*SimpleCode)(); |
| 537 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 538 } |
| 539 |
| 540 |
| 541 ASSEMBLER_TEST_GENERATE(EorImm, assembler) { |
| 542 __ movn(R0, 0, 0); |
| 543 __ movk(R0, 0xffd5, 0); // R0 < 0xffffffffffffffd5. |
| 544 __ movz(R1, 0x3f, 0); |
| 545 __ eori(R0, R0, 0x3f3f3f3f3f3f3f3fULL); |
| 546 __ and_(R0, R0, Operand(R1)); |
| 547 __ ret(); |
| 548 } |
| 549 |
| 550 |
| 551 ASSEMBLER_TEST_RUN(EorImm, test) { |
| 552 typedef int (*SimpleCode)(); |
| 553 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 554 } |
| 555 |
| 556 // TODO(zra): andis after branches are implemented. |
| 557 |
| 394 } // namespace dart | 558 } // namespace dart |
| 395 | 559 |
| 396 #endif // defined(TARGET_ARCH_ARM64) | 560 #endif // defined(TARGET_ARCH_ARM64) |
| OLD | NEW |