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

Side by Side Diff: test/cctest/test-assembler-a64.cc

Issue 154713002: A64: Only initialize V8 per test in test-assembler-a64.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 #endif 102 #endif
103 103
104 #define __ masm. 104 #define __ masm.
105 105
106 #define BUF_SIZE 8192 106 #define BUF_SIZE 8192
107 #define SETUP() SETUP_SIZE(BUF_SIZE) 107 #define SETUP() SETUP_SIZE(BUF_SIZE)
108 108
109 #define INIT_V8() \ 109 #define INIT_V8() \
110 CcTest::InitializeVM(); \ 110 CcTest::InitializeVM(); \
111 Isolate* isolate = Isolate::Current(); \
112 HandleScope scope(isolate); \
113 ASSERT(isolate != NULL);
114 111
115 #ifdef USE_SIMULATOR 112 #ifdef USE_SIMULATOR
116 113
117 // Run tests with the simulator. 114 // Run tests with the simulator.
118 #define SETUP_SIZE(buf_size) \ 115 #define SETUP_SIZE(buf_size) \
119 INIT_V8(); \ 116 Isolate* isolate = Isolate::Current(); \
117 HandleScope scope(isolate); \
118 ASSERT(isolate != NULL); \
120 byte* buf = new byte[buf_size]; \ 119 byte* buf = new byte[buf_size]; \
121 MacroAssembler masm(isolate, buf, buf_size); \ 120 MacroAssembler masm(isolate, buf, buf_size); \
122 Decoder decoder; \ 121 Decoder decoder; \
123 Simulator simulator(&decoder); \ 122 Simulator simulator(&decoder); \
124 PrintDisassembler* pdis = NULL; \ 123 PrintDisassembler* pdis = NULL; \
125 RegisterDump core; 124 RegisterDump core;
126 125
127 /* if (Cctest::trace_sim()) { \ 126 /* if (Cctest::trace_sim()) { \
128 pdis = new PrintDisassembler(stdout); \ 127 pdis = new PrintDisassembler(stdout); \
129 decoder.PrependVisitor(pdis); \ 128 decoder.PrependVisitor(pdis); \
(...skipping 30 matching lines...) Expand all
160 __ Ret(); \ 159 __ Ret(); \
161 __ GetCode(NULL); 160 __ GetCode(NULL);
162 161
163 #define TEARDOWN() \ 162 #define TEARDOWN() \
164 delete pdis; \ 163 delete pdis; \
165 delete[] buf; 164 delete[] buf;
166 165
167 #else // ifdef USE_SIMULATOR. 166 #else // ifdef USE_SIMULATOR.
168 // Run the test on real hardware or models. 167 // Run the test on real hardware or models.
169 #define SETUP_SIZE(buf_size) \ 168 #define SETUP_SIZE(buf_size) \
170 INIT_V8(); \
171 byte* buf = new byte[buf_size]; \ 169 byte* buf = new byte[buf_size]; \
172 MacroAssembler masm(isolate, buf, buf_size); \ 170 MacroAssembler masm(isolate, buf, buf_size); \
173 RegisterDump core; \ 171 RegisterDump core; \
174 CPU::SetUp(); 172 CPU::SetUp();
175 173
176 #define RESET() \ 174 #define RESET() \
177 __ Reset(); 175 __ Reset();
178 176
179 #define START_AFTER_RESET() \ 177 #define START_AFTER_RESET() \
180 __ SetStackPointer(csp); \ 178 __ SetStackPointer(csp); \
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 #ifdef DEBUG 222 #ifdef DEBUG
225 #define ASSERT_LITERAL_POOL_SIZE(expected) \ 223 #define ASSERT_LITERAL_POOL_SIZE(expected) \
226 CHECK((expected) == (__ LiteralPoolSize())) 224 CHECK((expected) == (__ LiteralPoolSize()))
227 #else 225 #else
228 #define ASSERT_LITERAL_POOL_SIZE(expected) \ 226 #define ASSERT_LITERAL_POOL_SIZE(expected) \
229 ((void) 0) 227 ((void) 0)
230 #endif 228 #endif
231 229
232 230
233 TEST(stack_ops) { 231 TEST(stack_ops) {
232 INIT_V8();
234 SETUP(); 233 SETUP();
235 234
236 START(); 235 START();
237 // save csp. 236 // save csp.
238 __ Mov(x29, csp); 237 __ Mov(x29, csp);
239 238
240 // Set the csp to a known value. 239 // Set the csp to a known value.
241 __ Mov(x16, 0x1000); 240 __ Mov(x16, 0x1000);
242 __ Mov(csp, x16); 241 __ Mov(csp, x16);
243 __ Mov(x0, csp); 242 __ Mov(x0, csp);
(...skipping 30 matching lines...) Expand all
274 ASSERT_EQUAL_64(0x104f, x2); 273 ASSERT_EQUAL_64(0x104f, x2);
275 ASSERT_EQUAL_64(0x1fff, x3); 274 ASSERT_EQUAL_64(0x1fff, x3);
276 ASSERT_EQUAL_64(0xfffffff8, x4); 275 ASSERT_EQUAL_64(0xfffffff8, x4);
277 ASSERT_EQUAL_64(0xfffffff8, x5); 276 ASSERT_EQUAL_64(0xfffffff8, x5);
278 277
279 TEARDOWN(); 278 TEARDOWN();
280 } 279 }
281 280
282 281
283 TEST(mvn) { 282 TEST(mvn) {
283 INIT_V8();
284 SETUP(); 284 SETUP();
285 285
286 START(); 286 START();
287 __ Mvn(w0, 0xfff); 287 __ Mvn(w0, 0xfff);
288 __ Mvn(x1, 0xfff); 288 __ Mvn(x1, 0xfff);
289 __ Mvn(w2, Operand(w0, LSL, 1)); 289 __ Mvn(w2, Operand(w0, LSL, 1));
290 __ Mvn(x3, Operand(x1, LSL, 2)); 290 __ Mvn(x3, Operand(x1, LSL, 2));
291 __ Mvn(w4, Operand(w0, LSR, 3)); 291 __ Mvn(w4, Operand(w0, LSR, 3));
292 __ Mvn(x5, Operand(x1, LSR, 4)); 292 __ Mvn(x5, Operand(x1, LSR, 4));
293 __ Mvn(w6, Operand(w0, ASR, 11)); 293 __ Mvn(w6, Operand(w0, ASR, 11));
(...skipping 25 matching lines...) Expand all
319 ASSERT_EQUAL_64(0xffff8003, x12); 319 ASSERT_EQUAL_64(0xffff8003, x12);
320 ASSERT_EQUAL_64(0xffffffffffff0007UL, x13); 320 ASSERT_EQUAL_64(0xffffffffffff0007UL, x13);
321 ASSERT_EQUAL_64(0xfffffffffffe000fUL, x14); 321 ASSERT_EQUAL_64(0xfffffffffffe000fUL, x14);
322 ASSERT_EQUAL_64(0xfffffffffffe000fUL, x15); 322 ASSERT_EQUAL_64(0xfffffffffffe000fUL, x15);
323 323
324 TEARDOWN(); 324 TEARDOWN();
325 } 325 }
326 326
327 327
328 TEST(mov) { 328 TEST(mov) {
329 INIT_V8();
329 SETUP(); 330 SETUP();
330 331
331 START(); 332 START();
332 __ Mov(x0, 0xffffffffffffffffL); 333 __ Mov(x0, 0xffffffffffffffffL);
333 __ Mov(x1, 0xffffffffffffffffL); 334 __ Mov(x1, 0xffffffffffffffffL);
334 __ Mov(x2, 0xffffffffffffffffL); 335 __ Mov(x2, 0xffffffffffffffffL);
335 __ Mov(x3, 0xffffffffffffffffL); 336 __ Mov(x3, 0xffffffffffffffffL);
336 337
337 __ Mov(x0, 0x0123456789abcdefL); 338 __ Mov(x0, 0x0123456789abcdefL);
338 339
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ASSERT_EQUAL_64(0xfffffffffffffffcUL, x24); 400 ASSERT_EQUAL_64(0xfffffffffffffffcUL, x24);
400 ASSERT_EQUAL_64(0x00007ff8, x25); 401 ASSERT_EQUAL_64(0x00007ff8, x25);
401 ASSERT_EQUAL_64(0x000000000000fff0UL, x26); 402 ASSERT_EQUAL_64(0x000000000000fff0UL, x26);
402 ASSERT_EQUAL_64(0x000000000001ffe0UL, x27); 403 ASSERT_EQUAL_64(0x000000000001ffe0UL, x27);
403 404
404 TEARDOWN(); 405 TEARDOWN();
405 } 406 }
406 407
407 408
408 TEST(mov_imm_w) { 409 TEST(mov_imm_w) {
410 INIT_V8();
409 SETUP(); 411 SETUP();
410 412
411 START(); 413 START();
412 __ Mov(w0, 0xffffffffL); 414 __ Mov(w0, 0xffffffffL);
413 __ Mov(w1, 0xffff1234L); 415 __ Mov(w1, 0xffff1234L);
414 __ Mov(w2, 0x1234ffffL); 416 __ Mov(w2, 0x1234ffffL);
415 __ Mov(w3, 0x00000000L); 417 __ Mov(w3, 0x00000000L);
416 __ Mov(w4, 0x00001234L); 418 __ Mov(w4, 0x00001234L);
417 __ Mov(w5, 0x12340000L); 419 __ Mov(w5, 0x12340000L);
418 __ Mov(w6, 0x12345678L); 420 __ Mov(w6, 0x12345678L);
419 END(); 421 END();
420 422
421 RUN(); 423 RUN();
422 424
423 ASSERT_EQUAL_64(0xffffffffL, x0); 425 ASSERT_EQUAL_64(0xffffffffL, x0);
424 ASSERT_EQUAL_64(0xffff1234L, x1); 426 ASSERT_EQUAL_64(0xffff1234L, x1);
425 ASSERT_EQUAL_64(0x1234ffffL, x2); 427 ASSERT_EQUAL_64(0x1234ffffL, x2);
426 ASSERT_EQUAL_64(0x00000000L, x3); 428 ASSERT_EQUAL_64(0x00000000L, x3);
427 ASSERT_EQUAL_64(0x00001234L, x4); 429 ASSERT_EQUAL_64(0x00001234L, x4);
428 ASSERT_EQUAL_64(0x12340000L, x5); 430 ASSERT_EQUAL_64(0x12340000L, x5);
429 ASSERT_EQUAL_64(0x12345678L, x6); 431 ASSERT_EQUAL_64(0x12345678L, x6);
430 432
431 TEARDOWN(); 433 TEARDOWN();
432 } 434 }
433 435
434 436
435 TEST(mov_imm_x) { 437 TEST(mov_imm_x) {
438 INIT_V8();
436 SETUP(); 439 SETUP();
437 440
438 START(); 441 START();
439 __ Mov(x0, 0xffffffffffffffffL); 442 __ Mov(x0, 0xffffffffffffffffL);
440 __ Mov(x1, 0xffffffffffff1234L); 443 __ Mov(x1, 0xffffffffffff1234L);
441 __ Mov(x2, 0xffffffff12345678L); 444 __ Mov(x2, 0xffffffff12345678L);
442 __ Mov(x3, 0xffff1234ffff5678L); 445 __ Mov(x3, 0xffff1234ffff5678L);
443 __ Mov(x4, 0x1234ffffffff5678L); 446 __ Mov(x4, 0x1234ffffffff5678L);
444 __ Mov(x5, 0x1234ffff5678ffffL); 447 __ Mov(x5, 0x1234ffff5678ffffL);
445 __ Mov(x6, 0x12345678ffffffffL); 448 __ Mov(x6, 0x12345678ffffffffL);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 ASSERT_EQUAL_64(0x0000123456789abcL, x25); 495 ASSERT_EQUAL_64(0x0000123456789abcL, x25);
493 ASSERT_EQUAL_64(0x123456789abcdef0L, x26); 496 ASSERT_EQUAL_64(0x123456789abcdef0L, x26);
494 ASSERT_EQUAL_64(0xffff000000000001L, x27); 497 ASSERT_EQUAL_64(0xffff000000000001L, x27);
495 ASSERT_EQUAL_64(0x8000ffff00000000L, x28); 498 ASSERT_EQUAL_64(0x8000ffff00000000L, x28);
496 499
497 TEARDOWN(); 500 TEARDOWN();
498 } 501 }
499 502
500 503
501 TEST(orr) { 504 TEST(orr) {
505 INIT_V8();
502 SETUP(); 506 SETUP();
503 507
504 START(); 508 START();
505 __ Mov(x0, 0xf0f0); 509 __ Mov(x0, 0xf0f0);
506 __ Mov(x1, 0xf00000ff); 510 __ Mov(x1, 0xf00000ff);
507 511
508 __ Orr(x2, x0, Operand(x1)); 512 __ Orr(x2, x0, Operand(x1));
509 __ Orr(w3, w0, Operand(w1, LSL, 28)); 513 __ Orr(w3, w0, Operand(w1, LSL, 28));
510 __ Orr(x4, x0, Operand(x1, LSL, 32)); 514 __ Orr(x4, x0, Operand(x1, LSL, 32));
511 __ Orr(x5, x0, Operand(x1, LSR, 4)); 515 __ Orr(x5, x0, Operand(x1, LSR, 4));
(...skipping 16 matching lines...) Expand all
528 ASSERT_EQUAL_64(0x0ffff0f0, x8); 532 ASSERT_EQUAL_64(0x0ffff0f0, x8);
529 ASSERT_EQUAL_64(0x0ff00000000ff0f0L, x9); 533 ASSERT_EQUAL_64(0x0ff00000000ff0f0L, x9);
530 ASSERT_EQUAL_64(0xf0ff, x10); 534 ASSERT_EQUAL_64(0xf0ff, x10);
531 ASSERT_EQUAL_64(0xf0000000f000f0f0L, x11); 535 ASSERT_EQUAL_64(0xf0000000f000f0f0L, x11);
532 536
533 TEARDOWN(); 537 TEARDOWN();
534 } 538 }
535 539
536 540
537 TEST(orr_extend) { 541 TEST(orr_extend) {
542 INIT_V8();
538 SETUP(); 543 SETUP();
539 544
540 START(); 545 START();
541 __ Mov(x0, 1); 546 __ Mov(x0, 1);
542 __ Mov(x1, 0x8000000080008080UL); 547 __ Mov(x1, 0x8000000080008080UL);
543 __ Orr(w6, w0, Operand(w1, UXTB)); 548 __ Orr(w6, w0, Operand(w1, UXTB));
544 __ Orr(x7, x0, Operand(x1, UXTH, 1)); 549 __ Orr(x7, x0, Operand(x1, UXTH, 1));
545 __ Orr(w8, w0, Operand(w1, UXTW, 2)); 550 __ Orr(w8, w0, Operand(w1, UXTW, 2));
546 __ Orr(x9, x0, Operand(x1, UXTX, 3)); 551 __ Orr(x9, x0, Operand(x1, UXTX, 3));
547 __ Orr(w10, w0, Operand(w1, SXTB)); 552 __ Orr(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
559 ASSERT_EQUAL_64(0x00000000ffffff81UL, x10); 564 ASSERT_EQUAL_64(0x00000000ffffff81UL, x10);
560 ASSERT_EQUAL_64(0xffffffffffff0101UL, x11); 565 ASSERT_EQUAL_64(0xffffffffffff0101UL, x11);
561 ASSERT_EQUAL_64(0xfffffffe00020201UL, x12); 566 ASSERT_EQUAL_64(0xfffffffe00020201UL, x12);
562 ASSERT_EQUAL_64(0x0000000400040401UL, x13); 567 ASSERT_EQUAL_64(0x0000000400040401UL, x13);
563 568
564 TEARDOWN(); 569 TEARDOWN();
565 } 570 }
566 571
567 572
568 TEST(bitwise_wide_imm) { 573 TEST(bitwise_wide_imm) {
574 INIT_V8();
569 SETUP(); 575 SETUP();
570 576
571 START(); 577 START();
572 __ Mov(x0, 0); 578 __ Mov(x0, 0);
573 __ Mov(x1, 0xf0f0f0f0f0f0f0f0UL); 579 __ Mov(x1, 0xf0f0f0f0f0f0f0f0UL);
574 580
575 __ Orr(x10, x0, Operand(0x1234567890abcdefUL)); 581 __ Orr(x10, x0, Operand(0x1234567890abcdefUL));
576 __ Orr(w11, w1, Operand(0x90abcdef)); 582 __ Orr(w11, w1, Operand(0x90abcdef));
577 END(); 583 END();
578 584
579 RUN(); 585 RUN();
580 586
581 ASSERT_EQUAL_64(0, x0); 587 ASSERT_EQUAL_64(0, x0);
582 ASSERT_EQUAL_64(0xf0f0f0f0f0f0f0f0UL, x1); 588 ASSERT_EQUAL_64(0xf0f0f0f0f0f0f0f0UL, x1);
583 ASSERT_EQUAL_64(0x1234567890abcdefUL, x10); 589 ASSERT_EQUAL_64(0x1234567890abcdefUL, x10);
584 ASSERT_EQUAL_64(0xf0fbfdffUL, x11); 590 ASSERT_EQUAL_64(0xf0fbfdffUL, x11);
585 591
586 TEARDOWN(); 592 TEARDOWN();
587 } 593 }
588 594
589 595
590 TEST(orn) { 596 TEST(orn) {
597 INIT_V8();
591 SETUP(); 598 SETUP();
592 599
593 START(); 600 START();
594 __ Mov(x0, 0xf0f0); 601 __ Mov(x0, 0xf0f0);
595 __ Mov(x1, 0xf00000ff); 602 __ Mov(x1, 0xf00000ff);
596 603
597 __ Orn(x2, x0, Operand(x1)); 604 __ Orn(x2, x0, Operand(x1));
598 __ Orn(w3, w0, Operand(w1, LSL, 4)); 605 __ Orn(w3, w0, Operand(w1, LSL, 4));
599 __ Orn(x4, x0, Operand(x1, LSL, 4)); 606 __ Orn(x4, x0, Operand(x1, LSL, 4));
600 __ Orn(x5, x0, Operand(x1, LSR, 1)); 607 __ Orn(x5, x0, Operand(x1, LSR, 1));
(...skipping 16 matching lines...) Expand all
617 ASSERT_EQUAL_64(0xff00ffff, x8); 624 ASSERT_EQUAL_64(0xff00ffff, x8);
618 ASSERT_EQUAL_64(0xff00ffffffffffffL, x9); 625 ASSERT_EQUAL_64(0xff00ffffffffffffL, x9);
619 ASSERT_EQUAL_64(0xfffff0f0, x10); 626 ASSERT_EQUAL_64(0xfffff0f0, x10);
620 ASSERT_EQUAL_64(0xffff0000fffff0f0L, x11); 627 ASSERT_EQUAL_64(0xffff0000fffff0f0L, x11);
621 628
622 TEARDOWN(); 629 TEARDOWN();
623 } 630 }
624 631
625 632
626 TEST(orn_extend) { 633 TEST(orn_extend) {
634 INIT_V8();
627 SETUP(); 635 SETUP();
628 636
629 START(); 637 START();
630 __ Mov(x0, 1); 638 __ Mov(x0, 1);
631 __ Mov(x1, 0x8000000080008081UL); 639 __ Mov(x1, 0x8000000080008081UL);
632 __ Orn(w6, w0, Operand(w1, UXTB)); 640 __ Orn(w6, w0, Operand(w1, UXTB));
633 __ Orn(x7, x0, Operand(x1, UXTH, 1)); 641 __ Orn(x7, x0, Operand(x1, UXTH, 1));
634 __ Orn(w8, w0, Operand(w1, UXTW, 2)); 642 __ Orn(w8, w0, Operand(w1, UXTW, 2));
635 __ Orn(x9, x0, Operand(x1, UXTX, 3)); 643 __ Orn(x9, x0, Operand(x1, UXTX, 3));
636 __ Orn(w10, w0, Operand(w1, SXTB)); 644 __ Orn(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
648 ASSERT_EQUAL_64(0x0000007f, x10); 656 ASSERT_EQUAL_64(0x0000007f, x10);
649 ASSERT_EQUAL_64(0x0000fefd, x11); 657 ASSERT_EQUAL_64(0x0000fefd, x11);
650 ASSERT_EQUAL_64(0x00000001fffdfdfbUL, x12); 658 ASSERT_EQUAL_64(0x00000001fffdfdfbUL, x12);
651 ASSERT_EQUAL_64(0xfffffffbfffbfbf7UL, x13); 659 ASSERT_EQUAL_64(0xfffffffbfffbfbf7UL, x13);
652 660
653 TEARDOWN(); 661 TEARDOWN();
654 } 662 }
655 663
656 664
657 TEST(and_) { 665 TEST(and_) {
666 INIT_V8();
658 SETUP(); 667 SETUP();
659 668
660 START(); 669 START();
661 __ Mov(x0, 0xfff0); 670 __ Mov(x0, 0xfff0);
662 __ Mov(x1, 0xf00000ff); 671 __ Mov(x1, 0xf00000ff);
663 672
664 __ And(x2, x0, Operand(x1)); 673 __ And(x2, x0, Operand(x1));
665 __ And(w3, w0, Operand(w1, LSL, 4)); 674 __ And(w3, w0, Operand(w1, LSL, 4));
666 __ And(x4, x0, Operand(x1, LSL, 4)); 675 __ And(x4, x0, Operand(x1, LSL, 4));
667 __ And(x5, x0, Operand(x1, LSR, 1)); 676 __ And(x5, x0, Operand(x1, LSR, 1));
(...skipping 16 matching lines...) Expand all
684 ASSERT_EQUAL_64(0x00000ff0, x8); 693 ASSERT_EQUAL_64(0x00000ff0, x8);
685 ASSERT_EQUAL_64(0x00000000, x9); 694 ASSERT_EQUAL_64(0x00000000, x9);
686 ASSERT_EQUAL_64(0x0000ff00, x10); 695 ASSERT_EQUAL_64(0x0000ff00, x10);
687 ASSERT_EQUAL_64(0x000000f0, x11); 696 ASSERT_EQUAL_64(0x000000f0, x11);
688 697
689 TEARDOWN(); 698 TEARDOWN();
690 } 699 }
691 700
692 701
693 TEST(and_extend) { 702 TEST(and_extend) {
703 INIT_V8();
694 SETUP(); 704 SETUP();
695 705
696 START(); 706 START();
697 __ Mov(x0, 0xffffffffffffffffUL); 707 __ Mov(x0, 0xffffffffffffffffUL);
698 __ Mov(x1, 0x8000000080008081UL); 708 __ Mov(x1, 0x8000000080008081UL);
699 __ And(w6, w0, Operand(w1, UXTB)); 709 __ And(w6, w0, Operand(w1, UXTB));
700 __ And(x7, x0, Operand(x1, UXTH, 1)); 710 __ And(x7, x0, Operand(x1, UXTH, 1));
701 __ And(w8, w0, Operand(w1, UXTW, 2)); 711 __ And(w8, w0, Operand(w1, UXTW, 2));
702 __ And(x9, x0, Operand(x1, UXTX, 3)); 712 __ And(x9, x0, Operand(x1, UXTX, 3));
703 __ And(w10, w0, Operand(w1, SXTB)); 713 __ And(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
715 ASSERT_EQUAL_64(0xffffff81, x10); 725 ASSERT_EQUAL_64(0xffffff81, x10);
716 ASSERT_EQUAL_64(0xffffffffffff0102UL, x11); 726 ASSERT_EQUAL_64(0xffffffffffff0102UL, x11);
717 ASSERT_EQUAL_64(0xfffffffe00020204UL, x12); 727 ASSERT_EQUAL_64(0xfffffffe00020204UL, x12);
718 ASSERT_EQUAL_64(0x0000000400040408UL, x13); 728 ASSERT_EQUAL_64(0x0000000400040408UL, x13);
719 729
720 TEARDOWN(); 730 TEARDOWN();
721 } 731 }
722 732
723 733
724 TEST(ands) { 734 TEST(ands) {
735 INIT_V8();
725 SETUP(); 736 SETUP();
726 737
727 START(); 738 START();
728 __ Mov(x1, 0xf00000ff); 739 __ Mov(x1, 0xf00000ff);
729 __ Ands(w0, w1, Operand(w1)); 740 __ Ands(w0, w1, Operand(w1));
730 END(); 741 END();
731 742
732 RUN(); 743 RUN();
733 744
734 ASSERT_EQUAL_NZCV(NFlag); 745 ASSERT_EQUAL_NZCV(NFlag);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 RUN(); 785 RUN();
775 786
776 ASSERT_EQUAL_NZCV(NFlag); 787 ASSERT_EQUAL_NZCV(NFlag);
777 ASSERT_EQUAL_64(0x80000000, x0); 788 ASSERT_EQUAL_64(0x80000000, x0);
778 789
779 TEARDOWN(); 790 TEARDOWN();
780 } 791 }
781 792
782 793
783 TEST(bic) { 794 TEST(bic) {
795 INIT_V8();
784 SETUP(); 796 SETUP();
785 797
786 START(); 798 START();
787 __ Mov(x0, 0xfff0); 799 __ Mov(x0, 0xfff0);
788 __ Mov(x1, 0xf00000ff); 800 __ Mov(x1, 0xf00000ff);
789 801
790 __ Bic(x2, x0, Operand(x1)); 802 __ Bic(x2, x0, Operand(x1));
791 __ Bic(w3, w0, Operand(w1, LSL, 4)); 803 __ Bic(w3, w0, Operand(w1, LSL, 4));
792 __ Bic(x4, x0, Operand(x1, LSL, 4)); 804 __ Bic(x4, x0, Operand(x1, LSL, 4));
793 __ Bic(x5, x0, Operand(x1, LSR, 1)); 805 __ Bic(x5, x0, Operand(x1, LSR, 1));
(...skipping 28 matching lines...) Expand all
822 ASSERT_EQUAL_64(0x0000ffe0, x10); 834 ASSERT_EQUAL_64(0x0000ffe0, x10);
823 ASSERT_EQUAL_64(0x0000fef0, x11); 835 ASSERT_EQUAL_64(0x0000fef0, x11);
824 836
825 ASSERT_EQUAL_64(0x543210, x21); 837 ASSERT_EQUAL_64(0x543210, x21);
826 838
827 TEARDOWN(); 839 TEARDOWN();
828 } 840 }
829 841
830 842
831 TEST(bic_extend) { 843 TEST(bic_extend) {
844 INIT_V8();
832 SETUP(); 845 SETUP();
833 846
834 START(); 847 START();
835 __ Mov(x0, 0xffffffffffffffffUL); 848 __ Mov(x0, 0xffffffffffffffffUL);
836 __ Mov(x1, 0x8000000080008081UL); 849 __ Mov(x1, 0x8000000080008081UL);
837 __ Bic(w6, w0, Operand(w1, UXTB)); 850 __ Bic(w6, w0, Operand(w1, UXTB));
838 __ Bic(x7, x0, Operand(x1, UXTH, 1)); 851 __ Bic(x7, x0, Operand(x1, UXTH, 1));
839 __ Bic(w8, w0, Operand(w1, UXTW, 2)); 852 __ Bic(w8, w0, Operand(w1, UXTW, 2));
840 __ Bic(x9, x0, Operand(x1, UXTX, 3)); 853 __ Bic(x9, x0, Operand(x1, UXTX, 3));
841 __ Bic(w10, w0, Operand(w1, SXTB)); 854 __ Bic(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
853 ASSERT_EQUAL_64(0x0000007e, x10); 866 ASSERT_EQUAL_64(0x0000007e, x10);
854 ASSERT_EQUAL_64(0x0000fefd, x11); 867 ASSERT_EQUAL_64(0x0000fefd, x11);
855 ASSERT_EQUAL_64(0x00000001fffdfdfbUL, x12); 868 ASSERT_EQUAL_64(0x00000001fffdfdfbUL, x12);
856 ASSERT_EQUAL_64(0xfffffffbfffbfbf7UL, x13); 869 ASSERT_EQUAL_64(0xfffffffbfffbfbf7UL, x13);
857 870
858 TEARDOWN(); 871 TEARDOWN();
859 } 872 }
860 873
861 874
862 TEST(bics) { 875 TEST(bics) {
876 INIT_V8();
863 SETUP(); 877 SETUP();
864 878
865 START(); 879 START();
866 __ Mov(x1, 0xffff); 880 __ Mov(x1, 0xffff);
867 __ Bics(w0, w1, Operand(w1)); 881 __ Bics(w0, w1, Operand(w1));
868 END(); 882 END();
869 883
870 RUN(); 884 RUN();
871 885
872 ASSERT_EQUAL_NZCV(ZFlag); 886 ASSERT_EQUAL_NZCV(ZFlag);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 RUN(); 925 RUN();
912 926
913 ASSERT_EQUAL_NZCV(ZFlag); 927 ASSERT_EQUAL_NZCV(ZFlag);
914 ASSERT_EQUAL_64(0x00000000, x0); 928 ASSERT_EQUAL_64(0x00000000, x0);
915 929
916 TEARDOWN(); 930 TEARDOWN();
917 } 931 }
918 932
919 933
920 TEST(eor) { 934 TEST(eor) {
935 INIT_V8();
921 SETUP(); 936 SETUP();
922 937
923 START(); 938 START();
924 __ Mov(x0, 0xfff0); 939 __ Mov(x0, 0xfff0);
925 __ Mov(x1, 0xf00000ff); 940 __ Mov(x1, 0xf00000ff);
926 941
927 __ Eor(x2, x0, Operand(x1)); 942 __ Eor(x2, x0, Operand(x1));
928 __ Eor(w3, w0, Operand(w1, LSL, 4)); 943 __ Eor(w3, w0, Operand(w1, LSL, 4));
929 __ Eor(x4, x0, Operand(x1, LSL, 4)); 944 __ Eor(x4, x0, Operand(x1, LSL, 4));
930 __ Eor(x5, x0, Operand(x1, LSR, 1)); 945 __ Eor(x5, x0, Operand(x1, LSR, 1));
(...skipping 16 matching lines...) Expand all
947 ASSERT_EQUAL_64(0x0000f00f, x8); 962 ASSERT_EQUAL_64(0x0000f00f, x8);
948 ASSERT_EQUAL_64(0x00000ff00000ffffL, x9); 963 ASSERT_EQUAL_64(0x00000ff00000ffffL, x9);
949 ASSERT_EQUAL_64(0xff0000f0, x10); 964 ASSERT_EQUAL_64(0xff0000f0, x10);
950 ASSERT_EQUAL_64(0xff00ff00ff0000f0L, x11); 965 ASSERT_EQUAL_64(0xff00ff00ff0000f0L, x11);
951 966
952 TEARDOWN(); 967 TEARDOWN();
953 } 968 }
954 969
955 970
956 TEST(eor_extend) { 971 TEST(eor_extend) {
972 INIT_V8();
957 SETUP(); 973 SETUP();
958 974
959 START(); 975 START();
960 __ Mov(x0, 0x1111111111111111UL); 976 __ Mov(x0, 0x1111111111111111UL);
961 __ Mov(x1, 0x8000000080008081UL); 977 __ Mov(x1, 0x8000000080008081UL);
962 __ Eor(w6, w0, Operand(w1, UXTB)); 978 __ Eor(w6, w0, Operand(w1, UXTB));
963 __ Eor(x7, x0, Operand(x1, UXTH, 1)); 979 __ Eor(x7, x0, Operand(x1, UXTH, 1));
964 __ Eor(w8, w0, Operand(w1, UXTW, 2)); 980 __ Eor(w8, w0, Operand(w1, UXTW, 2));
965 __ Eor(x9, x0, Operand(x1, UXTX, 3)); 981 __ Eor(x9, x0, Operand(x1, UXTX, 3));
966 __ Eor(w10, w0, Operand(w1, SXTB)); 982 __ Eor(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
978 ASSERT_EQUAL_64(0xeeeeee90, x10); 994 ASSERT_EQUAL_64(0xeeeeee90, x10);
979 ASSERT_EQUAL_64(0xeeeeeeeeeeee1013UL, x11); 995 ASSERT_EQUAL_64(0xeeeeeeeeeeee1013UL, x11);
980 ASSERT_EQUAL_64(0xeeeeeeef11131315UL, x12); 996 ASSERT_EQUAL_64(0xeeeeeeef11131315UL, x12);
981 ASSERT_EQUAL_64(0x1111111511151519UL, x13); 997 ASSERT_EQUAL_64(0x1111111511151519UL, x13);
982 998
983 TEARDOWN(); 999 TEARDOWN();
984 } 1000 }
985 1001
986 1002
987 TEST(eon) { 1003 TEST(eon) {
1004 INIT_V8();
988 SETUP(); 1005 SETUP();
989 1006
990 START(); 1007 START();
991 __ Mov(x0, 0xfff0); 1008 __ Mov(x0, 0xfff0);
992 __ Mov(x1, 0xf00000ff); 1009 __ Mov(x1, 0xf00000ff);
993 1010
994 __ Eon(x2, x0, Operand(x1)); 1011 __ Eon(x2, x0, Operand(x1));
995 __ Eon(w3, w0, Operand(w1, LSL, 4)); 1012 __ Eon(w3, w0, Operand(w1, LSL, 4));
996 __ Eon(x4, x0, Operand(x1, LSL, 4)); 1013 __ Eon(x4, x0, Operand(x1, LSL, 4));
997 __ Eon(x5, x0, Operand(x1, LSR, 1)); 1014 __ Eon(x5, x0, Operand(x1, LSR, 1));
(...skipping 16 matching lines...) Expand all
1014 ASSERT_EQUAL_64(0xffff0ff0, x8); 1031 ASSERT_EQUAL_64(0xffff0ff0, x8);
1015 ASSERT_EQUAL_64(0xfffff00fffff0000L, x9); 1032 ASSERT_EQUAL_64(0xfffff00fffff0000L, x9);
1016 ASSERT_EQUAL_64(0xfc3f03cf, x10); 1033 ASSERT_EQUAL_64(0xfc3f03cf, x10);
1017 ASSERT_EQUAL_64(0xffffefffffff100fL, x11); 1034 ASSERT_EQUAL_64(0xffffefffffff100fL, x11);
1018 1035
1019 TEARDOWN(); 1036 TEARDOWN();
1020 } 1037 }
1021 1038
1022 1039
1023 TEST(eon_extend) { 1040 TEST(eon_extend) {
1041 INIT_V8();
1024 SETUP(); 1042 SETUP();
1025 1043
1026 START(); 1044 START();
1027 __ Mov(x0, 0x1111111111111111UL); 1045 __ Mov(x0, 0x1111111111111111UL);
1028 __ Mov(x1, 0x8000000080008081UL); 1046 __ Mov(x1, 0x8000000080008081UL);
1029 __ Eon(w6, w0, Operand(w1, UXTB)); 1047 __ Eon(w6, w0, Operand(w1, UXTB));
1030 __ Eon(x7, x0, Operand(x1, UXTH, 1)); 1048 __ Eon(x7, x0, Operand(x1, UXTH, 1));
1031 __ Eon(w8, w0, Operand(w1, UXTW, 2)); 1049 __ Eon(w8, w0, Operand(w1, UXTW, 2));
1032 __ Eon(x9, x0, Operand(x1, UXTX, 3)); 1050 __ Eon(x9, x0, Operand(x1, UXTX, 3));
1033 __ Eon(w10, w0, Operand(w1, SXTB)); 1051 __ Eon(w10, w0, Operand(w1, SXTB));
(...skipping 11 matching lines...) Expand all
1045 ASSERT_EQUAL_64(0x1111116f, x10); 1063 ASSERT_EQUAL_64(0x1111116f, x10);
1046 ASSERT_EQUAL_64(0x111111111111efecUL, x11); 1064 ASSERT_EQUAL_64(0x111111111111efecUL, x11);
1047 ASSERT_EQUAL_64(0x11111110eeececeaUL, x12); 1065 ASSERT_EQUAL_64(0x11111110eeececeaUL, x12);
1048 ASSERT_EQUAL_64(0xeeeeeeeaeeeaeae6UL, x13); 1066 ASSERT_EQUAL_64(0xeeeeeeeaeeeaeae6UL, x13);
1049 1067
1050 TEARDOWN(); 1068 TEARDOWN();
1051 } 1069 }
1052 1070
1053 1071
1054 TEST(mul) { 1072 TEST(mul) {
1073 INIT_V8();
1055 SETUP(); 1074 SETUP();
1056 1075
1057 START(); 1076 START();
1058 __ Mov(x16, 0); 1077 __ Mov(x16, 0);
1059 __ Mov(x17, 1); 1078 __ Mov(x17, 1);
1060 __ Mov(x18, 0xffffffff); 1079 __ Mov(x18, 0xffffffff);
1061 __ Mov(x19, 0xffffffffffffffffUL); 1080 __ Mov(x19, 0xffffffffffffffffUL);
1062 1081
1063 __ Mul(w0, w16, w16); 1082 __ Mul(w0, w16, w16);
1064 __ Mul(w1, w16, w17); 1083 __ Mul(w1, w16, w17);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 __ Mov(w1, b); 1133 __ Mov(w1, b);
1115 __ Smull(x2, w0, w1); 1134 __ Smull(x2, w0, w1);
1116 END(); 1135 END();
1117 RUN(); 1136 RUN();
1118 ASSERT_EQUAL_64(expected, x2); 1137 ASSERT_EQUAL_64(expected, x2);
1119 TEARDOWN(); 1138 TEARDOWN();
1120 } 1139 }
1121 1140
1122 1141
1123 TEST(smull) { 1142 TEST(smull) {
1143 INIT_V8();
1124 SmullHelper(0, 0, 0); 1144 SmullHelper(0, 0, 0);
1125 SmullHelper(1, 1, 1); 1145 SmullHelper(1, 1, 1);
1126 SmullHelper(-1, -1, 1); 1146 SmullHelper(-1, -1, 1);
1127 SmullHelper(1, -1, -1); 1147 SmullHelper(1, -1, -1);
1128 SmullHelper(0xffffffff80000000, 0x80000000, 1); 1148 SmullHelper(0xffffffff80000000, 0x80000000, 1);
1129 SmullHelper(0x0000000080000000, 0x00010000, 0x00008000); 1149 SmullHelper(0x0000000080000000, 0x00010000, 0x00008000);
1130 } 1150 }
1131 1151
1132 1152
1133 TEST(madd) { 1153 TEST(madd) {
1154 INIT_V8();
1134 SETUP(); 1155 SETUP();
1135 1156
1136 START(); 1157 START();
1137 __ Mov(x16, 0); 1158 __ Mov(x16, 0);
1138 __ Mov(x17, 1); 1159 __ Mov(x17, 1);
1139 __ Mov(x18, 0xffffffff); 1160 __ Mov(x18, 0xffffffff);
1140 __ Mov(x19, 0xffffffffffffffffUL); 1161 __ Mov(x19, 0xffffffffffffffffUL);
1141 1162
1142 __ Madd(w0, w16, w16, w16); 1163 __ Madd(w0, w16, w16, w16);
1143 __ Madd(w1, w16, w16, w17); 1164 __ Madd(w1, w16, w16, w17);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 ASSERT_EQUAL_64(0x1fffffffe, x24); 1214 ASSERT_EQUAL_64(0x1fffffffe, x24);
1194 ASSERT_EQUAL_64(0xfffffffe00000002UL, x25); 1215 ASSERT_EQUAL_64(0xfffffffe00000002UL, x25);
1195 ASSERT_EQUAL_64(0, x26); 1216 ASSERT_EQUAL_64(0, x26);
1196 ASSERT_EQUAL_64(0, x27); 1217 ASSERT_EQUAL_64(0, x27);
1197 1218
1198 TEARDOWN(); 1219 TEARDOWN();
1199 } 1220 }
1200 1221
1201 1222
1202 TEST(msub) { 1223 TEST(msub) {
1224 INIT_V8();
1203 SETUP(); 1225 SETUP();
1204 1226
1205 START(); 1227 START();
1206 __ Mov(x16, 0); 1228 __ Mov(x16, 0);
1207 __ Mov(x17, 1); 1229 __ Mov(x17, 1);
1208 __ Mov(x18, 0xffffffff); 1230 __ Mov(x18, 0xffffffff);
1209 __ Mov(x19, 0xffffffffffffffffUL); 1231 __ Mov(x19, 0xffffffffffffffffUL);
1210 1232
1211 __ Msub(w0, w16, w16, w16); 1233 __ Msub(w0, w16, w16, w16);
1212 __ Msub(w1, w16, w16, w17); 1234 __ Msub(w1, w16, w16, w17);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 ASSERT_EQUAL_64(0, x24); 1284 ASSERT_EQUAL_64(0, x24);
1263 ASSERT_EQUAL_64(0x200000000UL, x25); 1285 ASSERT_EQUAL_64(0x200000000UL, x25);
1264 ASSERT_EQUAL_64(0x1fffffffeUL, x26); 1286 ASSERT_EQUAL_64(0x1fffffffeUL, x26);
1265 ASSERT_EQUAL_64(0xfffffffffffffffeUL, x27); 1287 ASSERT_EQUAL_64(0xfffffffffffffffeUL, x27);
1266 1288
1267 TEARDOWN(); 1289 TEARDOWN();
1268 } 1290 }
1269 1291
1270 1292
1271 TEST(smulh) { 1293 TEST(smulh) {
1294 INIT_V8();
1272 SETUP(); 1295 SETUP();
1273 1296
1274 START(); 1297 START();
1275 __ Mov(x20, 0); 1298 __ Mov(x20, 0);
1276 __ Mov(x21, 1); 1299 __ Mov(x21, 1);
1277 __ Mov(x22, 0x0000000100000000L); 1300 __ Mov(x22, 0x0000000100000000L);
1278 __ Mov(x23, 0x12345678); 1301 __ Mov(x23, 0x12345678);
1279 __ Mov(x24, 0x0123456789abcdefL); 1302 __ Mov(x24, 0x0123456789abcdefL);
1280 __ Mov(x25, 0x0000000200000000L); 1303 __ Mov(x25, 0x0000000200000000L);
1281 __ Mov(x26, 0x8000000000000000UL); 1304 __ Mov(x26, 0x8000000000000000UL);
(...skipping 28 matching lines...) Expand all
1310 ASSERT_EQUAL_64(0, x8); 1333 ASSERT_EQUAL_64(0, x8);
1311 ASSERT_EQUAL_64(0x1c71c71c71c71c71UL, x9); 1334 ASSERT_EQUAL_64(0x1c71c71c71c71c71UL, x9);
1312 ASSERT_EQUAL_64(0xe38e38e38e38e38eUL, x10); 1335 ASSERT_EQUAL_64(0xe38e38e38e38e38eUL, x10);
1313 ASSERT_EQUAL_64(0x1c71c71c71c71c72UL, x11); 1336 ASSERT_EQUAL_64(0x1c71c71c71c71c72UL, x11);
1314 1337
1315 TEARDOWN(); 1338 TEARDOWN();
1316 } 1339 }
1317 1340
1318 1341
1319 TEST(smaddl_umaddl) { 1342 TEST(smaddl_umaddl) {
1343 INIT_V8();
1320 SETUP(); 1344 SETUP();
1321 1345
1322 START(); 1346 START();
1323 __ Mov(x17, 1); 1347 __ Mov(x17, 1);
1324 __ Mov(x18, 0xffffffff); 1348 __ Mov(x18, 0xffffffff);
1325 __ Mov(x19, 0xffffffffffffffffUL); 1349 __ Mov(x19, 0xffffffffffffffffUL);
1326 __ Mov(x20, 4); 1350 __ Mov(x20, 4);
1327 __ Mov(x21, 0x200000000UL); 1351 __ Mov(x21, 0x200000000UL);
1328 1352
1329 __ Smaddl(x9, w17, w18, x20); 1353 __ Smaddl(x9, w17, w18, x20);
(...skipping 15 matching lines...) Expand all
1345 ASSERT_EQUAL_64(0x100000003UL, x13); 1369 ASSERT_EQUAL_64(0x100000003UL, x13);
1346 ASSERT_EQUAL_64(0xfffffffe00000005UL, x14); 1370 ASSERT_EQUAL_64(0xfffffffe00000005UL, x14);
1347 ASSERT_EQUAL_64(0xfffffffe00000005UL, x15); 1371 ASSERT_EQUAL_64(0xfffffffe00000005UL, x15);
1348 ASSERT_EQUAL_64(0x1, x22); 1372 ASSERT_EQUAL_64(0x1, x22);
1349 1373
1350 TEARDOWN(); 1374 TEARDOWN();
1351 } 1375 }
1352 1376
1353 1377
1354 TEST(smsubl_umsubl) { 1378 TEST(smsubl_umsubl) {
1379 INIT_V8();
1355 SETUP(); 1380 SETUP();
1356 1381
1357 START(); 1382 START();
1358 __ Mov(x17, 1); 1383 __ Mov(x17, 1);
1359 __ Mov(x18, 0xffffffff); 1384 __ Mov(x18, 0xffffffff);
1360 __ Mov(x19, 0xffffffffffffffffUL); 1385 __ Mov(x19, 0xffffffffffffffffUL);
1361 __ Mov(x20, 4); 1386 __ Mov(x20, 4);
1362 __ Mov(x21, 0x200000000UL); 1387 __ Mov(x21, 0x200000000UL);
1363 1388
1364 __ Smsubl(x9, w17, w18, x20); 1389 __ Smsubl(x9, w17, w18, x20);
(...skipping 15 matching lines...) Expand all
1380 ASSERT_EQUAL_64(0xffffffff00000005UL, x13); 1405 ASSERT_EQUAL_64(0xffffffff00000005UL, x13);
1381 ASSERT_EQUAL_64(0x200000003UL, x14); 1406 ASSERT_EQUAL_64(0x200000003UL, x14);
1382 ASSERT_EQUAL_64(0x200000003UL, x15); 1407 ASSERT_EQUAL_64(0x200000003UL, x15);
1383 ASSERT_EQUAL_64(0x3ffffffffUL, x22); 1408 ASSERT_EQUAL_64(0x3ffffffffUL, x22);
1384 1409
1385 TEARDOWN(); 1410 TEARDOWN();
1386 } 1411 }
1387 1412
1388 1413
1389 TEST(div) { 1414 TEST(div) {
1415 INIT_V8();
1390 SETUP(); 1416 SETUP();
1391 1417
1392 START(); 1418 START();
1393 __ Mov(x16, 1); 1419 __ Mov(x16, 1);
1394 __ Mov(x17, 0xffffffff); 1420 __ Mov(x17, 0xffffffff);
1395 __ Mov(x18, 0xffffffffffffffffUL); 1421 __ Mov(x18, 0xffffffffffffffffUL);
1396 __ Mov(x19, 0x80000000); 1422 __ Mov(x19, 0x80000000);
1397 __ Mov(x20, 0x8000000000000000UL); 1423 __ Mov(x20, 0x8000000000000000UL);
1398 __ Mov(x21, 2); 1424 __ Mov(x21, 2);
1399 1425
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 ASSERT_EQUAL_64(0, x18); 1488 ASSERT_EQUAL_64(0, x18);
1463 ASSERT_EQUAL_64(0, x19); 1489 ASSERT_EQUAL_64(0, x19);
1464 ASSERT_EQUAL_64(0, x20); 1490 ASSERT_EQUAL_64(0, x20);
1465 ASSERT_EQUAL_64(0, x21); 1491 ASSERT_EQUAL_64(0, x21);
1466 1492
1467 TEARDOWN(); 1493 TEARDOWN();
1468 } 1494 }
1469 1495
1470 1496
1471 TEST(rbit_rev) { 1497 TEST(rbit_rev) {
1498 INIT_V8();
1472 SETUP(); 1499 SETUP();
1473 1500
1474 START(); 1501 START();
1475 __ Mov(x24, 0xfedcba9876543210UL); 1502 __ Mov(x24, 0xfedcba9876543210UL);
1476 __ Rbit(w0, w24); 1503 __ Rbit(w0, w24);
1477 __ Rbit(x1, x24); 1504 __ Rbit(x1, x24);
1478 __ Rev16(w2, w24); 1505 __ Rev16(w2, w24);
1479 __ Rev16(x3, x24); 1506 __ Rev16(x3, x24);
1480 __ Rev(w4, w24); 1507 __ Rev(w4, w24);
1481 __ Rev32(x5, x24); 1508 __ Rev32(x5, x24);
1482 __ Rev(x6, x24); 1509 __ Rev(x6, x24);
1483 END(); 1510 END();
1484 1511
1485 RUN(); 1512 RUN();
1486 1513
1487 ASSERT_EQUAL_64(0x084c2a6e, x0); 1514 ASSERT_EQUAL_64(0x084c2a6e, x0);
1488 ASSERT_EQUAL_64(0x084c2a6e195d3b7fUL, x1); 1515 ASSERT_EQUAL_64(0x084c2a6e195d3b7fUL, x1);
1489 ASSERT_EQUAL_64(0x54761032, x2); 1516 ASSERT_EQUAL_64(0x54761032, x2);
1490 ASSERT_EQUAL_64(0xdcfe98ba54761032UL, x3); 1517 ASSERT_EQUAL_64(0xdcfe98ba54761032UL, x3);
1491 ASSERT_EQUAL_64(0x10325476, x4); 1518 ASSERT_EQUAL_64(0x10325476, x4);
1492 ASSERT_EQUAL_64(0x98badcfe10325476UL, x5); 1519 ASSERT_EQUAL_64(0x98badcfe10325476UL, x5);
1493 ASSERT_EQUAL_64(0x1032547698badcfeUL, x6); 1520 ASSERT_EQUAL_64(0x1032547698badcfeUL, x6);
1494 1521
1495 TEARDOWN(); 1522 TEARDOWN();
1496 } 1523 }
1497 1524
1498 1525
1499 TEST(clz_cls) { 1526 TEST(clz_cls) {
1527 INIT_V8();
1500 SETUP(); 1528 SETUP();
1501 1529
1502 START(); 1530 START();
1503 __ Mov(x24, 0x0008000000800000UL); 1531 __ Mov(x24, 0x0008000000800000UL);
1504 __ Mov(x25, 0xff800000fff80000UL); 1532 __ Mov(x25, 0xff800000fff80000UL);
1505 __ Mov(x26, 0); 1533 __ Mov(x26, 0);
1506 __ Clz(w0, w24); 1534 __ Clz(w0, w24);
1507 __ Clz(x1, x24); 1535 __ Clz(x1, x24);
1508 __ Clz(w2, w25); 1536 __ Clz(w2, w25);
1509 __ Clz(x3, x25); 1537 __ Clz(x3, x25);
(...skipping 20 matching lines...) Expand all
1530 ASSERT_EQUAL_64(12, x8); 1558 ASSERT_EQUAL_64(12, x8);
1531 ASSERT_EQUAL_64(8, x9); 1559 ASSERT_EQUAL_64(8, x9);
1532 ASSERT_EQUAL_64(31, x10); 1560 ASSERT_EQUAL_64(31, x10);
1533 ASSERT_EQUAL_64(63, x11); 1561 ASSERT_EQUAL_64(63, x11);
1534 1562
1535 TEARDOWN(); 1563 TEARDOWN();
1536 } 1564 }
1537 1565
1538 1566
1539 TEST(label) { 1567 TEST(label) {
1568 INIT_V8();
1540 SETUP(); 1569 SETUP();
1541 1570
1542 Label label_1, label_2, label_3, label_4; 1571 Label label_1, label_2, label_3, label_4;
1543 1572
1544 START(); 1573 START();
1545 __ Mov(x0, 0x1); 1574 __ Mov(x0, 0x1);
1546 __ Mov(x1, 0x0); 1575 __ Mov(x1, 0x0);
1547 __ Mov(x22, lr); // Save lr. 1576 __ Mov(x22, lr); // Save lr.
1548 1577
1549 __ B(&label_1); 1578 __ B(&label_1);
(...skipping 18 matching lines...) Expand all
1568 RUN(); 1597 RUN();
1569 1598
1570 ASSERT_EQUAL_64(0x1, x0); 1599 ASSERT_EQUAL_64(0x1, x0);
1571 ASSERT_EQUAL_64(0x1, x1); 1600 ASSERT_EQUAL_64(0x1, x1);
1572 1601
1573 TEARDOWN(); 1602 TEARDOWN();
1574 } 1603 }
1575 1604
1576 1605
1577 TEST(branch_at_start) { 1606 TEST(branch_at_start) {
1607 INIT_V8();
1578 SETUP(); 1608 SETUP();
1579 1609
1580 Label good, exit; 1610 Label good, exit;
1581 1611
1582 // Test that branches can exist at the start of the buffer. (This is a 1612 // Test that branches can exist at the start of the buffer. (This is a
1583 // boundary condition in the label-handling code.) To achieve this, we have 1613 // boundary condition in the label-handling code.) To achieve this, we have
1584 // to work around the code generated by START. 1614 // to work around the code generated by START.
1585 RESET(); 1615 RESET();
1586 __ B(&good); 1616 __ B(&good);
1587 1617
(...skipping 11 matching lines...) Expand all
1599 END(); 1629 END();
1600 1630
1601 RUN(); 1631 RUN();
1602 1632
1603 ASSERT_EQUAL_64(0x1, x0); 1633 ASSERT_EQUAL_64(0x1, x0);
1604 TEARDOWN(); 1634 TEARDOWN();
1605 } 1635 }
1606 1636
1607 1637
1608 TEST(adr) { 1638 TEST(adr) {
1639 INIT_V8();
1609 SETUP(); 1640 SETUP();
1610 1641
1611 Label label_1, label_2, label_3, label_4; 1642 Label label_1, label_2, label_3, label_4;
1612 1643
1613 START(); 1644 START();
1614 __ Mov(x0, 0x0); // Set to non-zero to indicate failure. 1645 __ Mov(x0, 0x0); // Set to non-zero to indicate failure.
1615 __ Adr(x1, &label_3); // Set to zero to indicate success. 1646 __ Adr(x1, &label_3); // Set to zero to indicate success.
1616 1647
1617 __ Adr(x2, &label_1); // Multiple forward references to the same label. 1648 __ Adr(x2, &label_1); // Multiple forward references to the same label.
1618 __ Adr(x3, &label_1); 1649 __ Adr(x3, &label_1);
(...skipping 25 matching lines...) Expand all
1644 RUN(); 1675 RUN();
1645 1676
1646 ASSERT_EQUAL_64(0x0, x0); 1677 ASSERT_EQUAL_64(0x0, x0);
1647 ASSERT_EQUAL_64(0x0, x1); 1678 ASSERT_EQUAL_64(0x0, x1);
1648 1679
1649 TEARDOWN(); 1680 TEARDOWN();
1650 } 1681 }
1651 1682
1652 1683
1653 TEST(branch_cond) { 1684 TEST(branch_cond) {
1685 INIT_V8();
1654 SETUP(); 1686 SETUP();
1655 1687
1656 Label wrong; 1688 Label wrong;
1657 1689
1658 START(); 1690 START();
1659 __ Mov(x0, 0x1); 1691 __ Mov(x0, 0x1);
1660 __ Mov(x1, 0x1); 1692 __ Mov(x1, 0x1);
1661 __ Mov(x2, 0x8000000000000000L); 1693 __ Mov(x2, 0x8000000000000000L);
1662 1694
1663 // For each 'cmp' instruction below, condition codes other than the ones 1695 // For each 'cmp' instruction below, condition codes other than the ones
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 1765
1734 RUN(); 1766 RUN();
1735 1767
1736 ASSERT_EQUAL_64(0x1, x0); 1768 ASSERT_EQUAL_64(0x1, x0);
1737 1769
1738 TEARDOWN(); 1770 TEARDOWN();
1739 } 1771 }
1740 1772
1741 1773
1742 TEST(branch_to_reg) { 1774 TEST(branch_to_reg) {
1775 INIT_V8();
1743 SETUP(); 1776 SETUP();
1744 1777
1745 // Test br. 1778 // Test br.
1746 Label fn1, after_fn1; 1779 Label fn1, after_fn1;
1747 1780
1748 START(); 1781 START();
1749 __ Mov(x29, lr); 1782 __ Mov(x29, lr);
1750 1783
1751 __ Mov(x1, 0); 1784 __ Mov(x1, 0);
1752 __ B(&after_fn1); 1785 __ B(&after_fn1);
(...skipping 28 matching lines...) Expand all
1781 1814
1782 ASSERT_EQUAL_64(core.xreg(3) + kInstructionSize, x0); 1815 ASSERT_EQUAL_64(core.xreg(3) + kInstructionSize, x0);
1783 ASSERT_EQUAL_64(42, x1); 1816 ASSERT_EQUAL_64(42, x1);
1784 ASSERT_EQUAL_64(84, x2); 1817 ASSERT_EQUAL_64(84, x2);
1785 1818
1786 TEARDOWN(); 1819 TEARDOWN();
1787 } 1820 }
1788 1821
1789 1822
1790 TEST(compare_branch) { 1823 TEST(compare_branch) {
1824 INIT_V8();
1791 SETUP(); 1825 SETUP();
1792 1826
1793 START(); 1827 START();
1794 __ Mov(x0, 0); 1828 __ Mov(x0, 0);
1795 __ Mov(x1, 0); 1829 __ Mov(x1, 0);
1796 __ Mov(x2, 0); 1830 __ Mov(x2, 0);
1797 __ Mov(x3, 0); 1831 __ Mov(x3, 0);
1798 __ Mov(x4, 0); 1832 __ Mov(x4, 0);
1799 __ Mov(x5, 0); 1833 __ Mov(x5, 0);
1800 __ Mov(x16, 0); 1834 __ Mov(x16, 0);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 ASSERT_EQUAL_64(1, x2); 1887 ASSERT_EQUAL_64(1, x2);
1854 ASSERT_EQUAL_64(0, x3); 1888 ASSERT_EQUAL_64(0, x3);
1855 ASSERT_EQUAL_64(1, x4); 1889 ASSERT_EQUAL_64(1, x4);
1856 ASSERT_EQUAL_64(0, x5); 1890 ASSERT_EQUAL_64(0, x5);
1857 1891
1858 TEARDOWN(); 1892 TEARDOWN();
1859 } 1893 }
1860 1894
1861 1895
1862 TEST(test_branch) { 1896 TEST(test_branch) {
1897 INIT_V8();
1863 SETUP(); 1898 SETUP();
1864 1899
1865 START(); 1900 START();
1866 __ Mov(x0, 0); 1901 __ Mov(x0, 0);
1867 __ Mov(x1, 0); 1902 __ Mov(x1, 0);
1868 __ Mov(x2, 0); 1903 __ Mov(x2, 0);
1869 __ Mov(x3, 0); 1904 __ Mov(x3, 0);
1870 __ Mov(x16, 0xaaaaaaaaaaaaaaaaUL); 1905 __ Mov(x16, 0xaaaaaaaaaaaaaaaaUL);
1871 1906
1872 Label bz, bz_end; 1907 Label bz, bz_end;
(...skipping 30 matching lines...) Expand all
1903 ASSERT_EQUAL_64(1, x0); 1938 ASSERT_EQUAL_64(1, x0);
1904 ASSERT_EQUAL_64(0, x1); 1939 ASSERT_EQUAL_64(0, x1);
1905 ASSERT_EQUAL_64(1, x2); 1940 ASSERT_EQUAL_64(1, x2);
1906 ASSERT_EQUAL_64(0, x3); 1941 ASSERT_EQUAL_64(0, x3);
1907 1942
1908 TEARDOWN(); 1943 TEARDOWN();
1909 } 1944 }
1910 1945
1911 1946
1912 TEST(ldr_str_offset) { 1947 TEST(ldr_str_offset) {
1948 INIT_V8();
1913 SETUP(); 1949 SETUP();
1914 1950
1915 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; 1951 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL};
1916 uint64_t dst[5] = {0, 0, 0, 0, 0}; 1952 uint64_t dst[5] = {0, 0, 0, 0, 0};
1917 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 1953 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
1918 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 1954 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
1919 1955
1920 START(); 1956 START();
1921 __ Mov(x17, src_base); 1957 __ Mov(x17, src_base);
1922 __ Mov(x18, dst_base); 1958 __ Mov(x18, dst_base);
(...skipping 22 matching lines...) Expand all
1945 ASSERT_EQUAL_64(0x7654, x4); 1981 ASSERT_EQUAL_64(0x7654, x4);
1946 ASSERT_EQUAL_64(0x765400, dst[4]); 1982 ASSERT_EQUAL_64(0x765400, dst[4]);
1947 ASSERT_EQUAL_64(src_base, x17); 1983 ASSERT_EQUAL_64(src_base, x17);
1948 ASSERT_EQUAL_64(dst_base, x18); 1984 ASSERT_EQUAL_64(dst_base, x18);
1949 1985
1950 TEARDOWN(); 1986 TEARDOWN();
1951 } 1987 }
1952 1988
1953 1989
1954 TEST(ldr_str_wide) { 1990 TEST(ldr_str_wide) {
1991 INIT_V8();
1955 SETUP(); 1992 SETUP();
1956 1993
1957 uint32_t src[8192]; 1994 uint32_t src[8192];
1958 uint32_t dst[8192]; 1995 uint32_t dst[8192];
1959 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 1996 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
1960 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 1997 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
1961 memset(src, 0xaa, 8192 * sizeof(src[0])); 1998 memset(src, 0xaa, 8192 * sizeof(src[0]));
1962 memset(dst, 0xaa, 8192 * sizeof(dst[0])); 1999 memset(dst, 0xaa, 8192 * sizeof(dst[0]));
1963 src[0] = 0; 2000 src[0] = 0;
1964 src[6144] = 6144; 2001 src[6144] = 6144;
(...skipping 28 matching lines...) Expand all
1993 ASSERT_EQUAL_32(6144, w2); 2030 ASSERT_EQUAL_32(6144, w2);
1994 ASSERT_EQUAL_32(6144, dst[6144]); 2031 ASSERT_EQUAL_32(6144, dst[6144]);
1995 ASSERT_EQUAL_64(src_base + 6144 * sizeof(src[0]), x26); 2032 ASSERT_EQUAL_64(src_base + 6144 * sizeof(src[0]), x26);
1996 ASSERT_EQUAL_64(dst_base + 6144 * sizeof(dst[0]), x27); 2033 ASSERT_EQUAL_64(dst_base + 6144 * sizeof(dst[0]), x27);
1997 2034
1998 TEARDOWN(); 2035 TEARDOWN();
1999 } 2036 }
2000 2037
2001 2038
2002 TEST(ldr_str_preindex) { 2039 TEST(ldr_str_preindex) {
2040 INIT_V8();
2003 SETUP(); 2041 SETUP();
2004 2042
2005 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; 2043 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL};
2006 uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; 2044 uint64_t dst[6] = {0, 0, 0, 0, 0, 0};
2007 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2045 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2008 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2046 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2009 2047
2010 START(); 2048 START();
2011 __ Mov(x17, src_base); 2049 __ Mov(x17, src_base);
2012 __ Mov(x18, dst_base); 2050 __ Mov(x18, dst_base);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 ASSERT_EQUAL_64(src_base + 1, x23); 2089 ASSERT_EQUAL_64(src_base + 1, x23);
2052 ASSERT_EQUAL_64(dst_base + 25, x24); 2090 ASSERT_EQUAL_64(dst_base + 25, x24);
2053 ASSERT_EQUAL_64(src_base + 3, x25); 2091 ASSERT_EQUAL_64(src_base + 3, x25);
2054 ASSERT_EQUAL_64(dst_base + 41, x26); 2092 ASSERT_EQUAL_64(dst_base + 41, x26);
2055 2093
2056 TEARDOWN(); 2094 TEARDOWN();
2057 } 2095 }
2058 2096
2059 2097
2060 TEST(ldr_str_postindex) { 2098 TEST(ldr_str_postindex) {
2099 INIT_V8();
2061 SETUP(); 2100 SETUP();
2062 2101
2063 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; 2102 uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL};
2064 uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; 2103 uint64_t dst[6] = {0, 0, 0, 0, 0, 0};
2065 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2104 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2066 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2105 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2067 2106
2068 START(); 2107 START();
2069 __ Mov(x17, src_base + 4); 2108 __ Mov(x17, src_base + 4);
2070 __ Mov(x18, dst_base + 12); 2109 __ Mov(x18, dst_base + 12);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 ASSERT_EQUAL_64(src_base + 2, x23); 2148 ASSERT_EQUAL_64(src_base + 2, x23);
2110 ASSERT_EQUAL_64(dst_base + 30, x24); 2149 ASSERT_EQUAL_64(dst_base + 30, x24);
2111 ASSERT_EQUAL_64(src_base, x25); 2150 ASSERT_EQUAL_64(src_base, x25);
2112 ASSERT_EQUAL_64(dst_base, x26); 2151 ASSERT_EQUAL_64(dst_base, x26);
2113 2152
2114 TEARDOWN(); 2153 TEARDOWN();
2115 } 2154 }
2116 2155
2117 2156
2118 TEST(load_signed) { 2157 TEST(load_signed) {
2158 INIT_V8();
2119 SETUP(); 2159 SETUP();
2120 2160
2121 uint32_t src[2] = {0x80008080, 0x7fff7f7f}; 2161 uint32_t src[2] = {0x80008080, 0x7fff7f7f};
2122 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2162 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2123 2163
2124 START(); 2164 START();
2125 __ Mov(x24, src_base); 2165 __ Mov(x24, src_base);
2126 __ Ldrsb(w0, MemOperand(x24)); 2166 __ Ldrsb(w0, MemOperand(x24));
2127 __ Ldrsb(w1, MemOperand(x24, 4)); 2167 __ Ldrsb(w1, MemOperand(x24, 4));
2128 __ Ldrsh(w2, MemOperand(x24)); 2168 __ Ldrsh(w2, MemOperand(x24));
(...skipping 17 matching lines...) Expand all
2146 ASSERT_EQUAL_64(0xffffffffffff8080UL, x6); 2186 ASSERT_EQUAL_64(0xffffffffffff8080UL, x6);
2147 ASSERT_EQUAL_64(0x0000000000007f7fUL, x7); 2187 ASSERT_EQUAL_64(0x0000000000007f7fUL, x7);
2148 ASSERT_EQUAL_64(0xffffffff80008080UL, x8); 2188 ASSERT_EQUAL_64(0xffffffff80008080UL, x8);
2149 ASSERT_EQUAL_64(0x000000007fff7f7fUL, x9); 2189 ASSERT_EQUAL_64(0x000000007fff7f7fUL, x9);
2150 2190
2151 TEARDOWN(); 2191 TEARDOWN();
2152 } 2192 }
2153 2193
2154 2194
2155 TEST(load_store_regoffset) { 2195 TEST(load_store_regoffset) {
2196 INIT_V8();
2156 SETUP(); 2197 SETUP();
2157 2198
2158 uint32_t src[3] = {1, 2, 3}; 2199 uint32_t src[3] = {1, 2, 3};
2159 uint32_t dst[4] = {0, 0, 0, 0}; 2200 uint32_t dst[4] = {0, 0, 0, 0};
2160 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2201 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2161 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2202 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2162 2203
2163 START(); 2204 START();
2164 __ Mov(x16, src_base); 2205 __ Mov(x16, src_base);
2165 __ Mov(x17, dst_base); 2206 __ Mov(x17, dst_base);
(...skipping 27 matching lines...) Expand all
2193 ASSERT_EQUAL_32(1, dst[0]); 2234 ASSERT_EQUAL_32(1, dst[0]);
2194 ASSERT_EQUAL_32(2, dst[1]); 2235 ASSERT_EQUAL_32(2, dst[1]);
2195 ASSERT_EQUAL_32(3, dst[2]); 2236 ASSERT_EQUAL_32(3, dst[2]);
2196 ASSERT_EQUAL_32(3, dst[3]); 2237 ASSERT_EQUAL_32(3, dst[3]);
2197 2238
2198 TEARDOWN(); 2239 TEARDOWN();
2199 } 2240 }
2200 2241
2201 2242
2202 TEST(load_store_float) { 2243 TEST(load_store_float) {
2244 INIT_V8();
2203 SETUP(); 2245 SETUP();
2204 2246
2205 float src[3] = {1.0, 2.0, 3.0}; 2247 float src[3] = {1.0, 2.0, 3.0};
2206 float dst[3] = {0.0, 0.0, 0.0}; 2248 float dst[3] = {0.0, 0.0, 0.0};
2207 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2249 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2208 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2250 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2209 2251
2210 START(); 2252 START();
2211 __ Mov(x17, src_base); 2253 __ Mov(x17, src_base);
2212 __ Mov(x18, dst_base); 2254 __ Mov(x18, dst_base);
(...skipping 22 matching lines...) Expand all
2235 ASSERT_EQUAL_64(src_base + sizeof(src[0]), x19); 2277 ASSERT_EQUAL_64(src_base + sizeof(src[0]), x19);
2236 ASSERT_EQUAL_64(dst_base + 2 * sizeof(dst[0]), x20); 2278 ASSERT_EQUAL_64(dst_base + 2 * sizeof(dst[0]), x20);
2237 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x21); 2279 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x21);
2238 ASSERT_EQUAL_64(dst_base, x22); 2280 ASSERT_EQUAL_64(dst_base, x22);
2239 2281
2240 TEARDOWN(); 2282 TEARDOWN();
2241 } 2283 }
2242 2284
2243 2285
2244 TEST(load_store_double) { 2286 TEST(load_store_double) {
2287 INIT_V8();
2245 SETUP(); 2288 SETUP();
2246 2289
2247 double src[3] = {1.0, 2.0, 3.0}; 2290 double src[3] = {1.0, 2.0, 3.0};
2248 double dst[3] = {0.0, 0.0, 0.0}; 2291 double dst[3] = {0.0, 0.0, 0.0};
2249 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2292 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2250 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2293 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2251 2294
2252 START(); 2295 START();
2253 __ Mov(x17, src_base); 2296 __ Mov(x17, src_base);
2254 __ Mov(x18, dst_base); 2297 __ Mov(x18, dst_base);
(...skipping 22 matching lines...) Expand all
2277 ASSERT_EQUAL_64(src_base + sizeof(src[0]), x19); 2320 ASSERT_EQUAL_64(src_base + sizeof(src[0]), x19);
2278 ASSERT_EQUAL_64(dst_base + 2 * sizeof(dst[0]), x20); 2321 ASSERT_EQUAL_64(dst_base + 2 * sizeof(dst[0]), x20);
2279 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x21); 2322 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x21);
2280 ASSERT_EQUAL_64(dst_base, x22); 2323 ASSERT_EQUAL_64(dst_base, x22);
2281 2324
2282 TEARDOWN(); 2325 TEARDOWN();
2283 } 2326 }
2284 2327
2285 2328
2286 TEST(ldp_stp_float) { 2329 TEST(ldp_stp_float) {
2330 INIT_V8();
2287 SETUP(); 2331 SETUP();
2288 2332
2289 float src[2] = {1.0, 2.0}; 2333 float src[2] = {1.0, 2.0};
2290 float dst[3] = {0.0, 0.0, 0.0}; 2334 float dst[3] = {0.0, 0.0, 0.0};
2291 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2335 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2292 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2336 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2293 2337
2294 START(); 2338 START();
2295 __ Mov(x16, src_base); 2339 __ Mov(x16, src_base);
2296 __ Mov(x17, dst_base); 2340 __ Mov(x17, dst_base);
2297 __ Ldp(s31, s0, MemOperand(x16, 2 * sizeof(src[0]), PostIndex)); 2341 __ Ldp(s31, s0, MemOperand(x16, 2 * sizeof(src[0]), PostIndex));
2298 __ Stp(s0, s31, MemOperand(x17, sizeof(dst[1]), PreIndex)); 2342 __ Stp(s0, s31, MemOperand(x17, sizeof(dst[1]), PreIndex));
2299 END(); 2343 END();
2300 2344
2301 RUN(); 2345 RUN();
2302 2346
2303 ASSERT_EQUAL_FP32(1.0, s31); 2347 ASSERT_EQUAL_FP32(1.0, s31);
2304 ASSERT_EQUAL_FP32(2.0, s0); 2348 ASSERT_EQUAL_FP32(2.0, s0);
2305 ASSERT_EQUAL_FP32(0.0, dst[0]); 2349 ASSERT_EQUAL_FP32(0.0, dst[0]);
2306 ASSERT_EQUAL_FP32(2.0, dst[1]); 2350 ASSERT_EQUAL_FP32(2.0, dst[1]);
2307 ASSERT_EQUAL_FP32(1.0, dst[2]); 2351 ASSERT_EQUAL_FP32(1.0, dst[2]);
2308 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x16); 2352 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x16);
2309 ASSERT_EQUAL_64(dst_base + sizeof(dst[1]), x17); 2353 ASSERT_EQUAL_64(dst_base + sizeof(dst[1]), x17);
2310 2354
2311 TEARDOWN(); 2355 TEARDOWN();
2312 } 2356 }
2313 2357
2314 2358
2315 TEST(ldp_stp_double) { 2359 TEST(ldp_stp_double) {
2360 INIT_V8();
2316 SETUP(); 2361 SETUP();
2317 2362
2318 double src[2] = {1.0, 2.0}; 2363 double src[2] = {1.0, 2.0};
2319 double dst[3] = {0.0, 0.0, 0.0}; 2364 double dst[3] = {0.0, 0.0, 0.0};
2320 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2365 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2321 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2366 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2322 2367
2323 START(); 2368 START();
2324 __ Mov(x16, src_base); 2369 __ Mov(x16, src_base);
2325 __ Mov(x17, dst_base); 2370 __ Mov(x17, dst_base);
2326 __ Ldp(d31, d0, MemOperand(x16, 2 * sizeof(src[0]), PostIndex)); 2371 __ Ldp(d31, d0, MemOperand(x16, 2 * sizeof(src[0]), PostIndex));
2327 __ Stp(d0, d31, MemOperand(x17, sizeof(dst[1]), PreIndex)); 2372 __ Stp(d0, d31, MemOperand(x17, sizeof(dst[1]), PreIndex));
2328 END(); 2373 END();
2329 2374
2330 RUN(); 2375 RUN();
2331 2376
2332 ASSERT_EQUAL_FP64(1.0, d31); 2377 ASSERT_EQUAL_FP64(1.0, d31);
2333 ASSERT_EQUAL_FP64(2.0, d0); 2378 ASSERT_EQUAL_FP64(2.0, d0);
2334 ASSERT_EQUAL_FP64(0.0, dst[0]); 2379 ASSERT_EQUAL_FP64(0.0, dst[0]);
2335 ASSERT_EQUAL_FP64(2.0, dst[1]); 2380 ASSERT_EQUAL_FP64(2.0, dst[1]);
2336 ASSERT_EQUAL_FP64(1.0, dst[2]); 2381 ASSERT_EQUAL_FP64(1.0, dst[2]);
2337 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x16); 2382 ASSERT_EQUAL_64(src_base + 2 * sizeof(src[0]), x16);
2338 ASSERT_EQUAL_64(dst_base + sizeof(dst[1]), x17); 2383 ASSERT_EQUAL_64(dst_base + sizeof(dst[1]), x17);
2339 2384
2340 TEARDOWN(); 2385 TEARDOWN();
2341 } 2386 }
2342 2387
2343 2388
2344 TEST(ldp_stp_offset) { 2389 TEST(ldp_stp_offset) {
2390 INIT_V8();
2345 SETUP(); 2391 SETUP();
2346 2392
2347 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, 2393 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL,
2348 0xffeeddccbbaa9988UL}; 2394 0xffeeddccbbaa9988UL};
2349 uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0}; 2395 uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0};
2350 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2396 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2351 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2397 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2352 2398
2353 START(); 2399 START();
2354 __ Mov(x16, src_base); 2400 __ Mov(x16, src_base);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 ASSERT_EQUAL_64(src_base, x16); 2435 ASSERT_EQUAL_64(src_base, x16);
2390 ASSERT_EQUAL_64(dst_base, x17); 2436 ASSERT_EQUAL_64(dst_base, x17);
2391 ASSERT_EQUAL_64(src_base + 24, x18); 2437 ASSERT_EQUAL_64(src_base + 24, x18);
2392 ASSERT_EQUAL_64(dst_base + 56, x19); 2438 ASSERT_EQUAL_64(dst_base + 56, x19);
2393 2439
2394 TEARDOWN(); 2440 TEARDOWN();
2395 } 2441 }
2396 2442
2397 2443
2398 TEST(ldnp_stnp_offset) { 2444 TEST(ldnp_stnp_offset) {
2445 INIT_V8();
2399 SETUP(); 2446 SETUP();
2400 2447
2401 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, 2448 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL,
2402 0xffeeddccbbaa9988UL}; 2449 0xffeeddccbbaa9988UL};
2403 uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0}; 2450 uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0};
2404 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2451 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2405 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2452 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2406 2453
2407 START(); 2454 START();
2408 __ Mov(x16, src_base); 2455 __ Mov(x16, src_base);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 ASSERT_EQUAL_64(src_base, x16); 2490 ASSERT_EQUAL_64(src_base, x16);
2444 ASSERT_EQUAL_64(dst_base, x17); 2491 ASSERT_EQUAL_64(dst_base, x17);
2445 ASSERT_EQUAL_64(src_base + 24, x18); 2492 ASSERT_EQUAL_64(src_base + 24, x18);
2446 ASSERT_EQUAL_64(dst_base + 56, x19); 2493 ASSERT_EQUAL_64(dst_base + 56, x19);
2447 2494
2448 TEARDOWN(); 2495 TEARDOWN();
2449 } 2496 }
2450 2497
2451 2498
2452 TEST(ldp_stp_preindex) { 2499 TEST(ldp_stp_preindex) {
2500 INIT_V8();
2453 SETUP(); 2501 SETUP();
2454 2502
2455 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, 2503 uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL,
2456 0xffeeddccbbaa9988UL}; 2504 0xffeeddccbbaa9988UL};
2457 uint64_t dst[5] = {0, 0, 0, 0, 0}; 2505 uint64_t dst[5] = {0, 0, 0, 0, 0};
2458 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2506 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2459 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2507 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2460 2508
2461 START(); 2509 START();
2462 __ Mov(x16, src_base); 2510 __ Mov(x16, src_base);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 ASSERT_EQUAL_64(src_base + 4, x19); 2545 ASSERT_EQUAL_64(src_base + 4, x19);
2498 ASSERT_EQUAL_64(dst_base + 4, x20); 2546 ASSERT_EQUAL_64(dst_base + 4, x20);
2499 ASSERT_EQUAL_64(src_base + 8, x21); 2547 ASSERT_EQUAL_64(src_base + 8, x21);
2500 ASSERT_EQUAL_64(dst_base + 24, x22); 2548 ASSERT_EQUAL_64(dst_base + 24, x22);
2501 2549
2502 TEARDOWN(); 2550 TEARDOWN();
2503 } 2551 }
2504 2552
2505 2553
2506 TEST(ldp_stp_postindex) { 2554 TEST(ldp_stp_postindex) {
2555 INIT_V8();
2507 SETUP(); 2556 SETUP();
2508 2557
2509 uint64_t src[4] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, 2558 uint64_t src[4] = {0x0011223344556677UL, 0x8899aabbccddeeffUL,
2510 0xffeeddccbbaa9988UL, 0x7766554433221100UL}; 2559 0xffeeddccbbaa9988UL, 0x7766554433221100UL};
2511 uint64_t dst[5] = {0, 0, 0, 0, 0}; 2560 uint64_t dst[5] = {0, 0, 0, 0, 0};
2512 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2561 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2513 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2562 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2514 2563
2515 START(); 2564 START();
2516 __ Mov(x16, src_base); 2565 __ Mov(x16, src_base);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 ASSERT_EQUAL_64(src_base + 4, x19); 2600 ASSERT_EQUAL_64(src_base + 4, x19);
2552 ASSERT_EQUAL_64(dst_base + 4, x20); 2601 ASSERT_EQUAL_64(dst_base + 4, x20);
2553 ASSERT_EQUAL_64(src_base + 8, x21); 2602 ASSERT_EQUAL_64(src_base + 8, x21);
2554 ASSERT_EQUAL_64(dst_base + 24, x22); 2603 ASSERT_EQUAL_64(dst_base + 24, x22);
2555 2604
2556 TEARDOWN(); 2605 TEARDOWN();
2557 } 2606 }
2558 2607
2559 2608
2560 TEST(ldp_sign_extend) { 2609 TEST(ldp_sign_extend) {
2610 INIT_V8();
2561 SETUP(); 2611 SETUP();
2562 2612
2563 uint32_t src[2] = {0x80000000, 0x7fffffff}; 2613 uint32_t src[2] = {0x80000000, 0x7fffffff};
2564 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2614 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2565 2615
2566 START(); 2616 START();
2567 __ Mov(x24, src_base); 2617 __ Mov(x24, src_base);
2568 __ Ldpsw(x0, x1, MemOperand(x24)); 2618 __ Ldpsw(x0, x1, MemOperand(x24));
2569 END(); 2619 END();
2570 2620
2571 RUN(); 2621 RUN();
2572 2622
2573 ASSERT_EQUAL_64(0xffffffff80000000UL, x0); 2623 ASSERT_EQUAL_64(0xffffffff80000000UL, x0);
2574 ASSERT_EQUAL_64(0x000000007fffffffUL, x1); 2624 ASSERT_EQUAL_64(0x000000007fffffffUL, x1);
2575 2625
2576 TEARDOWN(); 2626 TEARDOWN();
2577 } 2627 }
2578 2628
2579 2629
2580 TEST(ldur_stur) { 2630 TEST(ldur_stur) {
2631 INIT_V8();
2581 SETUP(); 2632 SETUP();
2582 2633
2583 int64_t src[2] = {0x0123456789abcdefUL, 0x0123456789abcdefUL}; 2634 int64_t src[2] = {0x0123456789abcdefUL, 0x0123456789abcdefUL};
2584 int64_t dst[5] = {0, 0, 0, 0, 0}; 2635 int64_t dst[5] = {0, 0, 0, 0, 0};
2585 uintptr_t src_base = reinterpret_cast<uintptr_t>(src); 2636 uintptr_t src_base = reinterpret_cast<uintptr_t>(src);
2586 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); 2637 uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst);
2587 2638
2588 START(); 2639 START();
2589 __ Mov(x17, src_base); 2640 __ Mov(x17, src_base);
2590 __ Mov(x18, dst_base); 2641 __ Mov(x18, dst_base);
(...skipping 26 matching lines...) Expand all
2617 ASSERT_EQUAL_64(src_base + 16, x19); 2668 ASSERT_EQUAL_64(src_base + 16, x19);
2618 ASSERT_EQUAL_64(dst_base + 32, x20); 2669 ASSERT_EQUAL_64(dst_base + 32, x20);
2619 2670
2620 TEARDOWN(); 2671 TEARDOWN();
2621 } 2672 }
2622 2673
2623 2674
2624 #if 0 // TODO(all) enable. 2675 #if 0 // TODO(all) enable.
2625 // TODO(rodolph): Adapt w16 Literal tests for RelocInfo. 2676 // TODO(rodolph): Adapt w16 Literal tests for RelocInfo.
2626 TEST(ldr_literal) { 2677 TEST(ldr_literal) {
2678 INIT_V8();
2627 SETUP(); 2679 SETUP();
2628 2680
2629 START(); 2681 START();
2630 __ Ldr(x2, 0x1234567890abcdefUL); 2682 __ Ldr(x2, 0x1234567890abcdefUL);
2631 __ Ldr(w3, 0xfedcba09); 2683 __ Ldr(w3, 0xfedcba09);
2632 __ Ldr(d13, 1.234); 2684 __ Ldr(d13, 1.234);
2633 __ Ldr(s25, 2.5); 2685 __ Ldr(s25, 2.5);
2634 END(); 2686 END();
2635 2687
2636 RUN(); 2688 RUN();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 ASSERT_EQUAL_64(0x34567890abcdef12UL, x4); 2778 ASSERT_EQUAL_64(0x34567890abcdef12UL, x4);
2727 ASSERT_EQUAL_64(0xdcba09fe, x5); 2779 ASSERT_EQUAL_64(0xdcba09fe, x5);
2728 ASSERT_EQUAL_FP64(123.4, d4); 2780 ASSERT_EQUAL_FP64(123.4, d4);
2729 ASSERT_EQUAL_FP32(250.0, s5); 2781 ASSERT_EQUAL_FP32(250.0, s5);
2730 2782
2731 TEARDOWN(); 2783 TEARDOWN();
2732 } 2784 }
2733 2785
2734 2786
2735 TEST(ldr_literal_range_1) { 2787 TEST(ldr_literal_range_1) {
2788 INIT_V8();
2736 LdrLiteralRangeHelper(kRecommendedLiteralPoolRange, 2789 LdrLiteralRangeHelper(kRecommendedLiteralPoolRange,
2737 NoJumpRequired, 2790 NoJumpRequired,
2738 true); 2791 true);
2739 } 2792 }
2740 2793
2741 2794
2742 TEST(ldr_literal_range_2) { 2795 TEST(ldr_literal_range_2) {
2796 INIT_V8();
2743 LdrLiteralRangeHelper(kRecommendedLiteralPoolRange-sizeof(Instr), 2797 LdrLiteralRangeHelper(kRecommendedLiteralPoolRange-sizeof(Instr),
2744 NoJumpRequired, 2798 NoJumpRequired,
2745 false); 2799 false);
2746 } 2800 }
2747 2801
2748 2802
2749 TEST(ldr_literal_range_3) { 2803 TEST(ldr_literal_range_3) {
2804 INIT_V8();
2750 LdrLiteralRangeHelper(2 * kRecommendedLiteralPoolRange, 2805 LdrLiteralRangeHelper(2 * kRecommendedLiteralPoolRange,
2751 JumpRequired, 2806 JumpRequired,
2752 true); 2807 true);
2753 } 2808 }
2754 2809
2755 2810
2756 TEST(ldr_literal_range_4) { 2811 TEST(ldr_literal_range_4) {
2812 INIT_V8();
2757 LdrLiteralRangeHelper(2 * kRecommendedLiteralPoolRange-sizeof(Instr), 2813 LdrLiteralRangeHelper(2 * kRecommendedLiteralPoolRange-sizeof(Instr),
2758 JumpRequired, 2814 JumpRequired,
2759 false); 2815 false);
2760 } 2816 }
2761 2817
2762 2818
2763 TEST(ldr_literal_range_5) { 2819 TEST(ldr_literal_range_5) {
2820 INIT_V8();
2764 LdrLiteralRangeHelper(kLiteralPoolCheckInterval, 2821 LdrLiteralRangeHelper(kLiteralPoolCheckInterval,
2765 JumpRequired, 2822 JumpRequired,
2766 false); 2823 false);
2767 } 2824 }
2768 2825
2769 2826
2770 TEST(ldr_literal_range_6) { 2827 TEST(ldr_literal_range_6) {
2828 INIT_V8();
2771 LdrLiteralRangeHelper(kLiteralPoolCheckInterval-sizeof(Instr), 2829 LdrLiteralRangeHelper(kLiteralPoolCheckInterval-sizeof(Instr),
2772 JumpRequired, 2830 JumpRequired,
2773 false); 2831 false);
2774 } 2832 }
2775 #endif 2833 #endif
2776 2834
2777 TEST(add_sub_imm) { 2835 TEST(add_sub_imm) {
2836 INIT_V8();
2778 SETUP(); 2837 SETUP();
2779 2838
2780 START(); 2839 START();
2781 __ Mov(x0, 0x0); 2840 __ Mov(x0, 0x0);
2782 __ Mov(x1, 0x1111); 2841 __ Mov(x1, 0x1111);
2783 __ Mov(x2, 0xffffffffffffffffL); 2842 __ Mov(x2, 0xffffffffffffffffL);
2784 __ Mov(x3, 0x8000000000000000L); 2843 __ Mov(x3, 0x8000000000000000L);
2785 2844
2786 __ Add(x10, x0, Operand(0x123)); 2845 __ Add(x10, x0, Operand(0x123));
2787 __ Add(x11, x1, Operand(0x122000)); 2846 __ Add(x11, x1, Operand(0x122000));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 ASSERT_EQUAL_32(0xffffffff, w24); 2883 ASSERT_EQUAL_32(0xffffffff, w24);
2825 ASSERT_EQUAL_32(0x1000, w25); 2884 ASSERT_EQUAL_32(0x1000, w25);
2826 ASSERT_EQUAL_32(0x111, w26); 2885 ASSERT_EQUAL_32(0x111, w26);
2827 ASSERT_EQUAL_32(0xffffffff, w27); 2886 ASSERT_EQUAL_32(0xffffffff, w27);
2828 2887
2829 TEARDOWN(); 2888 TEARDOWN();
2830 } 2889 }
2831 2890
2832 2891
2833 TEST(add_sub_wide_imm) { 2892 TEST(add_sub_wide_imm) {
2893 INIT_V8();
2834 SETUP(); 2894 SETUP();
2835 2895
2836 START(); 2896 START();
2837 __ Mov(x0, 0x0); 2897 __ Mov(x0, 0x0);
2838 __ Mov(x1, 0x1); 2898 __ Mov(x1, 0x1);
2839 2899
2840 __ Add(x10, x0, Operand(0x1234567890abcdefUL)); 2900 __ Add(x10, x0, Operand(0x1234567890abcdefUL));
2841 __ Add(x11, x1, Operand(0xffffffff)); 2901 __ Add(x11, x1, Operand(0xffffffff));
2842 2902
2843 __ Add(w12, w0, Operand(0x12345678)); 2903 __ Add(w12, w0, Operand(0x12345678));
(...skipping 14 matching lines...) Expand all
2858 2918
2859 ASSERT_EQUAL_64(-0x1234567890abcdefUL, x20); 2919 ASSERT_EQUAL_64(-0x1234567890abcdefUL, x20);
2860 2920
2861 ASSERT_EQUAL_32(-0x12345678, w21); 2921 ASSERT_EQUAL_32(-0x12345678, w21);
2862 2922
2863 TEARDOWN(); 2923 TEARDOWN();
2864 } 2924 }
2865 2925
2866 2926
2867 TEST(add_sub_shifted) { 2927 TEST(add_sub_shifted) {
2928 INIT_V8();
2868 SETUP(); 2929 SETUP();
2869 2930
2870 START(); 2931 START();
2871 __ Mov(x0, 0); 2932 __ Mov(x0, 0);
2872 __ Mov(x1, 0x0123456789abcdefL); 2933 __ Mov(x1, 0x0123456789abcdefL);
2873 __ Mov(x2, 0xfedcba9876543210L); 2934 __ Mov(x2, 0xfedcba9876543210L);
2874 __ Mov(x3, 0xffffffffffffffffL); 2935 __ Mov(x3, 0xffffffffffffffffL);
2875 2936
2876 __ Add(x10, x1, Operand(x2)); 2937 __ Add(x10, x1, Operand(x2));
2877 __ Add(x11, x0, Operand(x1, LSL, 8)); 2938 __ Add(x11, x0, Operand(x1, LSL, 8));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 ASSERT_EQUAL_64(0x000123456789abcdL, x24); 2971 ASSERT_EQUAL_64(0x000123456789abcdL, x24);
2911 ASSERT_EQUAL_64(0x00765432, x25); 2972 ASSERT_EQUAL_64(0x00765432, x25);
2912 ASSERT_EQUAL_64(0x10765432, x26); 2973 ASSERT_EQUAL_64(0x10765432, x26);
2913 ASSERT_EQUAL_64(0x10fedcba98765432L, x27); 2974 ASSERT_EQUAL_64(0x10fedcba98765432L, x27);
2914 2975
2915 TEARDOWN(); 2976 TEARDOWN();
2916 } 2977 }
2917 2978
2918 2979
2919 TEST(add_sub_extended) { 2980 TEST(add_sub_extended) {
2981 INIT_V8();
2920 SETUP(); 2982 SETUP();
2921 2983
2922 START(); 2984 START();
2923 __ Mov(x0, 0); 2985 __ Mov(x0, 0);
2924 __ Mov(x1, 0x0123456789abcdefL); 2986 __ Mov(x1, 0x0123456789abcdefL);
2925 __ Mov(x2, 0xfedcba9876543210L); 2987 __ Mov(x2, 0xfedcba9876543210L);
2926 __ Mov(w3, 0x80); 2988 __ Mov(w3, 0x80);
2927 2989
2928 __ Add(x10, x0, Operand(x1, UXTB, 0)); 2990 __ Add(x10, x0, Operand(x1, UXTB, 0));
2929 __ Add(x11, x0, Operand(x1, UXTB, 1)); 2991 __ Add(x11, x0, Operand(x1, UXTB, 1));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 ASSERT_EQUAL_32(0x4d5e6f78, w28); 3042 ASSERT_EQUAL_32(0x4d5e6f78, w28);
2981 ASSERT_EQUAL_64(0xfffffffc4d5e6f78L, x29); 3043 ASSERT_EQUAL_64(0xfffffffc4d5e6f78L, x29);
2982 3044
2983 ASSERT_EQUAL_64(256, x30); 3045 ASSERT_EQUAL_64(256, x30);
2984 3046
2985 TEARDOWN(); 3047 TEARDOWN();
2986 } 3048 }
2987 3049
2988 3050
2989 TEST(add_sub_negative) { 3051 TEST(add_sub_negative) {
3052 INIT_V8();
2990 SETUP(); 3053 SETUP();
2991 3054
2992 START(); 3055 START();
2993 __ Mov(x0, 0); 3056 __ Mov(x0, 0);
2994 __ Mov(x1, 4687); 3057 __ Mov(x1, 4687);
2995 __ Mov(x2, 0x1122334455667788); 3058 __ Mov(x2, 0x1122334455667788);
2996 __ Mov(w3, 0x11223344); 3059 __ Mov(w3, 0x11223344);
2997 __ Mov(w4, 400000); 3060 __ Mov(w4, 400000);
2998 3061
2999 __ Add(x10, x0, -42); 3062 __ Add(x10, x0, -42);
(...skipping 25 matching lines...) Expand all
3025 ASSERT_EQUAL_32(398000, w20); 3088 ASSERT_EQUAL_32(398000, w20);
3026 3089
3027 ASSERT_EQUAL_32(0x11223400, w21); 3090 ASSERT_EQUAL_32(0x11223400, w21);
3028 ASSERT_EQUAL_32(402000, w22); 3091 ASSERT_EQUAL_32(402000, w22);
3029 3092
3030 TEARDOWN(); 3093 TEARDOWN();
3031 } 3094 }
3032 3095
3033 3096
3034 TEST(add_sub_zero) { 3097 TEST(add_sub_zero) {
3098 INIT_V8();
3035 SETUP(); 3099 SETUP();
3036 3100
3037 START(); 3101 START();
3038 __ Mov(x0, 0); 3102 __ Mov(x0, 0);
3039 __ Mov(x1, 0); 3103 __ Mov(x1, 0);
3040 __ Mov(x2, 0); 3104 __ Mov(x2, 0);
3041 3105
3042 Label blob1; 3106 Label blob1;
3043 __ Bind(&blob1); 3107 __ Bind(&blob1);
3044 __ Add(x0, x0, 0); 3108 __ Add(x0, x0, 0);
(...skipping 17 matching lines...) Expand all
3062 3126
3063 ASSERT_EQUAL_64(0, x0); 3127 ASSERT_EQUAL_64(0, x0);
3064 ASSERT_EQUAL_64(0, x1); 3128 ASSERT_EQUAL_64(0, x1);
3065 ASSERT_EQUAL_64(0, x2); 3129 ASSERT_EQUAL_64(0, x2);
3066 3130
3067 TEARDOWN(); 3131 TEARDOWN();
3068 } 3132 }
3069 3133
3070 3134
3071 TEST(claim_drop_zero) { 3135 TEST(claim_drop_zero) {
3136 INIT_V8();
3072 SETUP(); 3137 SETUP();
3073 3138
3074 START(); 3139 START();
3075 3140
3076 Label start; 3141 Label start;
3077 __ Bind(&start); 3142 __ Bind(&start);
3078 __ Claim(0); 3143 __ Claim(0);
3079 __ Drop(0); 3144 __ Drop(0);
3080 __ Claim(xzr, 8); 3145 __ Claim(xzr, 8);
3081 __ Drop(xzr, 8); 3146 __ Drop(xzr, 8);
3082 __ Claim(xzr, 0); 3147 __ Claim(xzr, 0);
3083 __ Drop(xzr, 0); 3148 __ Drop(xzr, 0);
3084 __ Claim(x7, 0); 3149 __ Claim(x7, 0);
3085 __ Drop(x7, 0); 3150 __ Drop(x7, 0);
3086 __ ClaimBySMI(xzr, 8); 3151 __ ClaimBySMI(xzr, 8);
3087 __ DropBySMI(xzr, 8); 3152 __ DropBySMI(xzr, 8);
3088 __ ClaimBySMI(xzr, 0); 3153 __ ClaimBySMI(xzr, 0);
3089 __ DropBySMI(xzr, 0); 3154 __ DropBySMI(xzr, 0);
3090 CHECK_EQ(0, __ SizeOfCodeGeneratedSince(&start)); 3155 CHECK_EQ(0, __ SizeOfCodeGeneratedSince(&start));
3091 3156
3092 END(); 3157 END();
3093 3158
3094 RUN(); 3159 RUN();
3095 3160
3096 TEARDOWN(); 3161 TEARDOWN();
3097 } 3162 }
3098 3163
3099 3164
3100 TEST(neg) { 3165 TEST(neg) {
3166 INIT_V8();
3101 SETUP(); 3167 SETUP();
3102 3168
3103 START(); 3169 START();
3104 __ Mov(x0, 0xf123456789abcdefL); 3170 __ Mov(x0, 0xf123456789abcdefL);
3105 3171
3106 // Immediate. 3172 // Immediate.
3107 __ Neg(x1, 0x123); 3173 __ Neg(x1, 0x123);
3108 __ Neg(w2, 0x123); 3174 __ Neg(w2, 0x123);
3109 3175
3110 // Shifted. 3176 // Shifted.
(...skipping 28 matching lines...) Expand all
3139 ASSERT_EQUAL_64(0xfffcc844, x11); 3205 ASSERT_EQUAL_64(0xfffcc844, x11);
3140 ASSERT_EQUAL_64(0x0000000000019088UL, x12); 3206 ASSERT_EQUAL_64(0x0000000000019088UL, x12);
3141 ASSERT_EQUAL_64(0x65432110, x13); 3207 ASSERT_EQUAL_64(0x65432110, x13);
3142 ASSERT_EQUAL_64(0x0000000765432110UL, x14); 3208 ASSERT_EQUAL_64(0x0000000765432110UL, x14);
3143 3209
3144 TEARDOWN(); 3210 TEARDOWN();
3145 } 3211 }
3146 3212
3147 3213
3148 TEST(adc_sbc_shift) { 3214 TEST(adc_sbc_shift) {
3215 INIT_V8();
3149 SETUP(); 3216 SETUP();
3150 3217
3151 START(); 3218 START();
3152 __ Mov(x0, 0); 3219 __ Mov(x0, 0);
3153 __ Mov(x1, 1); 3220 __ Mov(x1, 1);
3154 __ Mov(x2, 0x0123456789abcdefL); 3221 __ Mov(x2, 0x0123456789abcdefL);
3155 __ Mov(x3, 0xfedcba9876543210L); 3222 __ Mov(x3, 0xfedcba9876543210L);
3156 __ Mov(x4, 0xffffffffffffffffL); 3223 __ Mov(x4, 0xffffffffffffffffL);
3157 3224
3158 // Clear the C flag. 3225 // Clear the C flag.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 RUN(); 3403 RUN();
3337 3404
3338 ASSERT_EQUAL_NZCV(NFlag); 3405 ASSERT_EQUAL_NZCV(NFlag);
3339 ASSERT_EQUAL_64(0x8000000000000001L, x10); 3406 ASSERT_EQUAL_64(0x8000000000000001L, x10);
3340 3407
3341 TEARDOWN(); 3408 TEARDOWN();
3342 } 3409 }
3343 3410
3344 3411
3345 TEST(adc_sbc_extend) { 3412 TEST(adc_sbc_extend) {
3413 INIT_V8();
3346 SETUP(); 3414 SETUP();
3347 3415
3348 START(); 3416 START();
3349 // Clear the C flag. 3417 // Clear the C flag.
3350 __ Adds(x0, x0, Operand(0)); 3418 __ Adds(x0, x0, Operand(0));
3351 3419
3352 __ Mov(x0, 0); 3420 __ Mov(x0, 0);
3353 __ Mov(x1, 1); 3421 __ Mov(x1, 1);
3354 __ Mov(x2, 0x0123456789abcdefL); 3422 __ Mov(x2, 0x0123456789abcdefL);
3355 3423
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3429 3497
3430 RUN(); 3498 RUN();
3431 3499
3432 ASSERT_EQUAL_NZCV(NVFlag); 3500 ASSERT_EQUAL_NZCV(NVFlag);
3433 3501
3434 TEARDOWN(); 3502 TEARDOWN();
3435 } 3503 }
3436 3504
3437 3505
3438 TEST(adc_sbc_wide_imm) { 3506 TEST(adc_sbc_wide_imm) {
3507 INIT_V8();
3439 SETUP(); 3508 SETUP();
3440 3509
3441 START(); 3510 START();
3442 __ Mov(x0, 0); 3511 __ Mov(x0, 0);
3443 3512
3444 // Clear the C flag. 3513 // Clear the C flag.
3445 __ Adds(x0, x0, Operand(0)); 3514 __ Adds(x0, x0, Operand(0));
3446 3515
3447 __ Adc(x7, x0, Operand(0x1234567890abcdefUL)); 3516 __ Adc(x7, x0, Operand(0x1234567890abcdefUL));
3448 __ Adc(w8, w0, Operand(0xffffffff)); 3517 __ Adc(w8, w0, Operand(0xffffffff));
(...skipping 27 matching lines...) Expand all
3476 ASSERT_EQUAL_64(0xedcba9876f543211UL, x20); 3545 ASSERT_EQUAL_64(0xedcba9876f543211UL, x20);
3477 ASSERT_EQUAL_64(1, x21); 3546 ASSERT_EQUAL_64(1, x21);
3478 ASSERT_EQUAL_64(0x100000000UL, x22); 3547 ASSERT_EQUAL_64(0x100000000UL, x22);
3479 ASSERT_EQUAL_64(0x10000, x23); 3548 ASSERT_EQUAL_64(0x10000, x23);
3480 3549
3481 TEARDOWN(); 3550 TEARDOWN();
3482 } 3551 }
3483 3552
3484 3553
3485 TEST(flags) { 3554 TEST(flags) {
3555 INIT_V8();
3486 SETUP(); 3556 SETUP();
3487 3557
3488 START(); 3558 START();
3489 __ Mov(x0, 0); 3559 __ Mov(x0, 0);
3490 __ Mov(x1, 0x1111111111111111L); 3560 __ Mov(x1, 0x1111111111111111L);
3491 __ Neg(x10, Operand(x0)); 3561 __ Neg(x10, Operand(x0));
3492 __ Neg(x11, Operand(x1)); 3562 __ Neg(x11, Operand(x1));
3493 __ Neg(w12, Operand(w1)); 3563 __ Neg(w12, Operand(w1));
3494 // Clear the C flag. 3564 // Clear the C flag.
3495 __ Adds(x0, x0, Operand(0)); 3565 __ Adds(x0, x0, Operand(0));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 3695
3626 RUN(); 3696 RUN();
3627 3697
3628 ASSERT_EQUAL_NZCV(ZCFlag); 3698 ASSERT_EQUAL_NZCV(ZCFlag);
3629 3699
3630 TEARDOWN(); 3700 TEARDOWN();
3631 } 3701 }
3632 3702
3633 3703
3634 TEST(cmp_shift) { 3704 TEST(cmp_shift) {
3705 INIT_V8();
3635 SETUP(); 3706 SETUP();
3636 3707
3637 START(); 3708 START();
3638 __ Mov(x18, 0xf0000000); 3709 __ Mov(x18, 0xf0000000);
3639 __ Mov(x19, 0xf000000010000000UL); 3710 __ Mov(x19, 0xf000000010000000UL);
3640 __ Mov(x20, 0xf0000000f0000000UL); 3711 __ Mov(x20, 0xf0000000f0000000UL);
3641 __ Mov(x21, 0x7800000078000000UL); 3712 __ Mov(x21, 0x7800000078000000UL);
3642 __ Mov(x22, 0x3c0000003c000000UL); 3713 __ Mov(x22, 0x3c0000003c000000UL);
3643 __ Mov(x23, 0x8000000780000000UL); 3714 __ Mov(x23, 0x8000000780000000UL);
3644 __ Mov(x24, 0x0000000f00000000UL); 3715 __ Mov(x24, 0x0000000f00000000UL);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 ASSERT_EQUAL_32(ZCFlag, w4); 3751 ASSERT_EQUAL_32(ZCFlag, w4);
3681 ASSERT_EQUAL_32(ZCFlag, w5); 3752 ASSERT_EQUAL_32(ZCFlag, w5);
3682 ASSERT_EQUAL_32(ZCFlag, w6); 3753 ASSERT_EQUAL_32(ZCFlag, w6);
3683 ASSERT_EQUAL_32(ZCFlag, w7); 3754 ASSERT_EQUAL_32(ZCFlag, w7);
3684 3755
3685 TEARDOWN(); 3756 TEARDOWN();
3686 } 3757 }
3687 3758
3688 3759
3689 TEST(cmp_extend) { 3760 TEST(cmp_extend) {
3761 INIT_V8();
3690 SETUP(); 3762 SETUP();
3691 3763
3692 START(); 3764 START();
3693 __ Mov(w20, 0x2); 3765 __ Mov(w20, 0x2);
3694 __ Mov(w21, 0x1); 3766 __ Mov(w21, 0x1);
3695 __ Mov(x22, 0xffffffffffffffffUL); 3767 __ Mov(x22, 0xffffffffffffffffUL);
3696 __ Mov(x23, 0xff); 3768 __ Mov(x23, 0xff);
3697 __ Mov(x24, 0xfffffffffffffffeUL); 3769 __ Mov(x24, 0xfffffffffffffffeUL);
3698 __ Mov(x25, 0xffff); 3770 __ Mov(x25, 0xffff);
3699 __ Mov(x26, 0xffffffff); 3771 __ Mov(x26, 0xffffffff);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3732 ASSERT_EQUAL_32(NCFlag, w4); 3804 ASSERT_EQUAL_32(NCFlag, w4);
3733 ASSERT_EQUAL_32(ZCFlag, w5); 3805 ASSERT_EQUAL_32(ZCFlag, w5);
3734 ASSERT_EQUAL_32(NCFlag, w6); 3806 ASSERT_EQUAL_32(NCFlag, w6);
3735 ASSERT_EQUAL_32(ZCFlag, w7); 3807 ASSERT_EQUAL_32(ZCFlag, w7);
3736 3808
3737 TEARDOWN(); 3809 TEARDOWN();
3738 } 3810 }
3739 3811
3740 3812
3741 TEST(ccmp) { 3813 TEST(ccmp) {
3814 INIT_V8();
3742 SETUP(); 3815 SETUP();
3743 3816
3744 START(); 3817 START();
3745 __ Mov(w16, 0); 3818 __ Mov(w16, 0);
3746 __ Mov(w17, 1); 3819 __ Mov(w17, 1);
3747 __ Cmp(w16, w16); 3820 __ Cmp(w16, w16);
3748 __ Ccmp(w16, w17, NCFlag, eq); 3821 __ Ccmp(w16, w17, NCFlag, eq);
3749 __ Mrs(x0, NZCV); 3822 __ Mrs(x0, NZCV);
3750 3823
3751 __ Cmp(w16, w16); 3824 __ Cmp(w16, w16);
(...skipping 23 matching lines...) Expand all
3775 ASSERT_EQUAL_32(NoFlag, w2); 3848 ASSERT_EQUAL_32(NoFlag, w2);
3776 ASSERT_EQUAL_32(NZCVFlag, w3); 3849 ASSERT_EQUAL_32(NZCVFlag, w3);
3777 ASSERT_EQUAL_32(ZCFlag, w4); 3850 ASSERT_EQUAL_32(ZCFlag, w4);
3778 ASSERT_EQUAL_32(ZCFlag, w5); 3851 ASSERT_EQUAL_32(ZCFlag, w5);
3779 3852
3780 TEARDOWN(); 3853 TEARDOWN();
3781 } 3854 }
3782 3855
3783 3856
3784 TEST(ccmp_wide_imm) { 3857 TEST(ccmp_wide_imm) {
3858 INIT_V8();
3785 SETUP(); 3859 SETUP();
3786 3860
3787 START(); 3861 START();
3788 __ Mov(w20, 0); 3862 __ Mov(w20, 0);
3789 3863
3790 __ Cmp(w20, Operand(w20)); 3864 __ Cmp(w20, Operand(w20));
3791 __ Ccmp(w20, Operand(0x12345678), NZCVFlag, eq); 3865 __ Ccmp(w20, Operand(0x12345678), NZCVFlag, eq);
3792 __ Mrs(x0, NZCV); 3866 __ Mrs(x0, NZCV);
3793 3867
3794 __ Cmp(w20, Operand(w20)); 3868 __ Cmp(w20, Operand(w20));
3795 __ Ccmp(x20, Operand(0xffffffffffffffffUL), NZCVFlag, eq); 3869 __ Ccmp(x20, Operand(0xffffffffffffffffUL), NZCVFlag, eq);
3796 __ Mrs(x1, NZCV); 3870 __ Mrs(x1, NZCV);
3797 END(); 3871 END();
3798 3872
3799 RUN(); 3873 RUN();
3800 3874
3801 ASSERT_EQUAL_32(NFlag, w0); 3875 ASSERT_EQUAL_32(NFlag, w0);
3802 ASSERT_EQUAL_32(NoFlag, w1); 3876 ASSERT_EQUAL_32(NoFlag, w1);
3803 3877
3804 TEARDOWN(); 3878 TEARDOWN();
3805 } 3879 }
3806 3880
3807 3881
3808 TEST(ccmp_shift_extend) { 3882 TEST(ccmp_shift_extend) {
3883 INIT_V8();
3809 SETUP(); 3884 SETUP();
3810 3885
3811 START(); 3886 START();
3812 __ Mov(w20, 0x2); 3887 __ Mov(w20, 0x2);
3813 __ Mov(w21, 0x1); 3888 __ Mov(w21, 0x1);
3814 __ Mov(x22, 0xffffffffffffffffUL); 3889 __ Mov(x22, 0xffffffffffffffffUL);
3815 __ Mov(x23, 0xff); 3890 __ Mov(x23, 0xff);
3816 __ Mov(x24, 0xfffffffffffffffeUL); 3891 __ Mov(x24, 0xfffffffffffffffeUL);
3817 3892
3818 __ Cmp(w20, Operand(w20)); 3893 __ Cmp(w20, Operand(w20));
(...skipping 23 matching lines...) Expand all
3842 ASSERT_EQUAL_32(ZCFlag, w1); 3917 ASSERT_EQUAL_32(ZCFlag, w1);
3843 ASSERT_EQUAL_32(ZCFlag, w2); 3918 ASSERT_EQUAL_32(ZCFlag, w2);
3844 ASSERT_EQUAL_32(NCFlag, w3); 3919 ASSERT_EQUAL_32(NCFlag, w3);
3845 ASSERT_EQUAL_32(NZCVFlag, w4); 3920 ASSERT_EQUAL_32(NZCVFlag, w4);
3846 3921
3847 TEARDOWN(); 3922 TEARDOWN();
3848 } 3923 }
3849 3924
3850 3925
3851 TEST(csel) { 3926 TEST(csel) {
3927 INIT_V8();
3852 SETUP(); 3928 SETUP();
3853 3929
3854 START(); 3930 START();
3855 __ Mov(x16, 0); 3931 __ Mov(x16, 0);
3856 __ Mov(x24, 0x0000000f0000000fUL); 3932 __ Mov(x24, 0x0000000f0000000fUL);
3857 __ Mov(x25, 0x0000001f0000001fUL); 3933 __ Mov(x25, 0x0000001f0000001fUL);
3858 __ Mov(x26, 0); 3934 __ Mov(x26, 0);
3859 __ Mov(x27, 0); 3935 __ Mov(x27, 0);
3860 3936
3861 __ Cmp(w16, 0); 3937 __ Cmp(w16, 0);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3911 ASSERT_EQUAL_64(0, x24); 3987 ASSERT_EQUAL_64(0, x24);
3912 ASSERT_EQUAL_64(0x0000001f0000001fUL, x25); 3988 ASSERT_EQUAL_64(0x0000001f0000001fUL, x25);
3913 ASSERT_EQUAL_64(0x0000001f0000001fUL, x26); 3989 ASSERT_EQUAL_64(0x0000001f0000001fUL, x26);
3914 ASSERT_EQUAL_64(0, x27); 3990 ASSERT_EQUAL_64(0, x27);
3915 3991
3916 TEARDOWN(); 3992 TEARDOWN();
3917 } 3993 }
3918 3994
3919 3995
3920 TEST(csel_imm) { 3996 TEST(csel_imm) {
3997 INIT_V8();
3921 SETUP(); 3998 SETUP();
3922 3999
3923 START(); 4000 START();
3924 __ Mov(x18, 0); 4001 __ Mov(x18, 0);
3925 __ Mov(x19, 0x80000000); 4002 __ Mov(x19, 0x80000000);
3926 __ Mov(x20, 0x8000000000000000UL); 4003 __ Mov(x20, 0x8000000000000000UL);
3927 4004
3928 __ Cmp(x18, Operand(0)); 4005 __ Cmp(x18, Operand(0));
3929 __ Csel(w0, w19, -2, ne); 4006 __ Csel(w0, w19, -2, ne);
3930 __ Csel(w1, w19, -1, ne); 4007 __ Csel(w1, w19, -1, ne);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3964 ASSERT_EQUAL_64(2, x12); 4041 ASSERT_EQUAL_64(2, x12);
3965 ASSERT_EQUAL_64(-1, x13); 4042 ASSERT_EQUAL_64(-1, x13);
3966 ASSERT_EQUAL_64(0x4000000000000000UL, x14); 4043 ASSERT_EQUAL_64(0x4000000000000000UL, x14);
3967 ASSERT_EQUAL_64(0x8000000000000000UL, x15); 4044 ASSERT_EQUAL_64(0x8000000000000000UL, x15);
3968 4045
3969 TEARDOWN(); 4046 TEARDOWN();
3970 } 4047 }
3971 4048
3972 4049
3973 TEST(lslv) { 4050 TEST(lslv) {
4051 INIT_V8();
3974 SETUP(); 4052 SETUP();
3975 4053
3976 uint64_t value = 0x0123456789abcdefUL; 4054 uint64_t value = 0x0123456789abcdefUL;
3977 int shift[] = {1, 3, 5, 9, 17, 33}; 4055 int shift[] = {1, 3, 5, 9, 17, 33};
3978 4056
3979 START(); 4057 START();
3980 __ Mov(x0, value); 4058 __ Mov(x0, value);
3981 __ Mov(w1, shift[0]); 4059 __ Mov(w1, shift[0]);
3982 __ Mov(w2, shift[1]); 4060 __ Mov(w2, shift[1]);
3983 __ Mov(w3, shift[2]); 4061 __ Mov(w3, shift[2]);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 ASSERT_EQUAL_32(value << (shift[2] & 31), w24); 4094 ASSERT_EQUAL_32(value << (shift[2] & 31), w24);
4017 ASSERT_EQUAL_32(value << (shift[3] & 31), w25); 4095 ASSERT_EQUAL_32(value << (shift[3] & 31), w25);
4018 ASSERT_EQUAL_32(value << (shift[4] & 31), w26); 4096 ASSERT_EQUAL_32(value << (shift[4] & 31), w26);
4019 ASSERT_EQUAL_32(value << (shift[5] & 31), w27); 4097 ASSERT_EQUAL_32(value << (shift[5] & 31), w27);
4020 4098
4021 TEARDOWN(); 4099 TEARDOWN();
4022 } 4100 }
4023 4101
4024 4102
4025 TEST(lsrv) { 4103 TEST(lsrv) {
4104 INIT_V8();
4026 SETUP(); 4105 SETUP();
4027 4106
4028 uint64_t value = 0x0123456789abcdefUL; 4107 uint64_t value = 0x0123456789abcdefUL;
4029 int shift[] = {1, 3, 5, 9, 17, 33}; 4108 int shift[] = {1, 3, 5, 9, 17, 33};
4030 4109
4031 START(); 4110 START();
4032 __ Mov(x0, value); 4111 __ Mov(x0, value);
4033 __ Mov(w1, shift[0]); 4112 __ Mov(w1, shift[0]);
4034 __ Mov(w2, shift[1]); 4113 __ Mov(w2, shift[1]);
4035 __ Mov(w3, shift[2]); 4114 __ Mov(w3, shift[2]);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 ASSERT_EQUAL_32(value >> (shift[2] & 31), w24); 4149 ASSERT_EQUAL_32(value >> (shift[2] & 31), w24);
4071 ASSERT_EQUAL_32(value >> (shift[3] & 31), w25); 4150 ASSERT_EQUAL_32(value >> (shift[3] & 31), w25);
4072 ASSERT_EQUAL_32(value >> (shift[4] & 31), w26); 4151 ASSERT_EQUAL_32(value >> (shift[4] & 31), w26);
4073 ASSERT_EQUAL_32(value >> (shift[5] & 31), w27); 4152 ASSERT_EQUAL_32(value >> (shift[5] & 31), w27);
4074 4153
4075 TEARDOWN(); 4154 TEARDOWN();
4076 } 4155 }
4077 4156
4078 4157
4079 TEST(asrv) { 4158 TEST(asrv) {
4159 INIT_V8();
4080 SETUP(); 4160 SETUP();
4081 4161
4082 int64_t value = 0xfedcba98fedcba98UL; 4162 int64_t value = 0xfedcba98fedcba98UL;
4083 int shift[] = {1, 3, 5, 9, 17, 33}; 4163 int shift[] = {1, 3, 5, 9, 17, 33};
4084 4164
4085 START(); 4165 START();
4086 __ Mov(x0, value); 4166 __ Mov(x0, value);
4087 __ Mov(w1, shift[0]); 4167 __ Mov(w1, shift[0]);
4088 __ Mov(w2, shift[1]); 4168 __ Mov(w2, shift[1]);
4089 __ Mov(w3, shift[2]); 4169 __ Mov(w3, shift[2]);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 ASSERT_EQUAL_32(value32 >> (shift[2] & 31), w24); 4204 ASSERT_EQUAL_32(value32 >> (shift[2] & 31), w24);
4125 ASSERT_EQUAL_32(value32 >> (shift[3] & 31), w25); 4205 ASSERT_EQUAL_32(value32 >> (shift[3] & 31), w25);
4126 ASSERT_EQUAL_32(value32 >> (shift[4] & 31), w26); 4206 ASSERT_EQUAL_32(value32 >> (shift[4] & 31), w26);
4127 ASSERT_EQUAL_32(value32 >> (shift[5] & 31), w27); 4207 ASSERT_EQUAL_32(value32 >> (shift[5] & 31), w27);
4128 4208
4129 TEARDOWN(); 4209 TEARDOWN();
4130 } 4210 }
4131 4211
4132 4212
4133 TEST(rorv) { 4213 TEST(rorv) {
4214 INIT_V8();
4134 SETUP(); 4215 SETUP();
4135 4216
4136 uint64_t value = 0x0123456789abcdefUL; 4217 uint64_t value = 0x0123456789abcdefUL;
4137 int shift[] = {4, 8, 12, 16, 24, 36}; 4218 int shift[] = {4, 8, 12, 16, 24, 36};
4138 4219
4139 START(); 4220 START();
4140 __ Mov(x0, value); 4221 __ Mov(x0, value);
4141 __ Mov(w1, shift[0]); 4222 __ Mov(w1, shift[0]);
4142 __ Mov(w2, shift[1]); 4223 __ Mov(w2, shift[1]);
4143 __ Mov(w3, shift[2]); 4224 __ Mov(w3, shift[2]);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4176 ASSERT_EQUAL_32(0xdef89abc, w24); 4257 ASSERT_EQUAL_32(0xdef89abc, w24);
4177 ASSERT_EQUAL_32(0xcdef89ab, w25); 4258 ASSERT_EQUAL_32(0xcdef89ab, w25);
4178 ASSERT_EQUAL_32(0xabcdef89, w26); 4259 ASSERT_EQUAL_32(0xabcdef89, w26);
4179 ASSERT_EQUAL_32(0xf89abcde, w27); 4260 ASSERT_EQUAL_32(0xf89abcde, w27);
4180 4261
4181 TEARDOWN(); 4262 TEARDOWN();
4182 } 4263 }
4183 4264
4184 4265
4185 TEST(bfm) { 4266 TEST(bfm) {
4267 INIT_V8();
4186 SETUP(); 4268 SETUP();
4187 4269
4188 START(); 4270 START();
4189 __ Mov(x1, 0x0123456789abcdefL); 4271 __ Mov(x1, 0x0123456789abcdefL);
4190 4272
4191 __ Mov(x10, 0x8888888888888888L); 4273 __ Mov(x10, 0x8888888888888888L);
4192 __ Mov(x11, 0x8888888888888888L); 4274 __ Mov(x11, 0x8888888888888888L);
4193 __ Mov(x12, 0x8888888888888888L); 4275 __ Mov(x12, 0x8888888888888888L);
4194 __ Mov(x13, 0x8888888888888888L); 4276 __ Mov(x13, 0x8888888888888888L);
4195 __ Mov(w20, 0x88888888); 4277 __ Mov(w20, 0x88888888);
(...skipping 20 matching lines...) Expand all
4216 ASSERT_EQUAL_32(0x88cdef88, w21); 4298 ASSERT_EQUAL_32(0x88cdef88, w21);
4217 4299
4218 ASSERT_EQUAL_64(0x8888888888ef8888L, x12); 4300 ASSERT_EQUAL_64(0x8888888888ef8888L, x12);
4219 ASSERT_EQUAL_64(0x88888888888888abL, x13); 4301 ASSERT_EQUAL_64(0x88888888888888abL, x13);
4220 4302
4221 TEARDOWN(); 4303 TEARDOWN();
4222 } 4304 }
4223 4305
4224 4306
4225 TEST(sbfm) { 4307 TEST(sbfm) {
4308 INIT_V8();
4226 SETUP(); 4309 SETUP();
4227 4310
4228 START(); 4311 START();
4229 __ Mov(x1, 0x0123456789abcdefL); 4312 __ Mov(x1, 0x0123456789abcdefL);
4230 __ Mov(x2, 0xfedcba9876543210L); 4313 __ Mov(x2, 0xfedcba9876543210L);
4231 4314
4232 __ sbfm(x10, x1, 16, 31); 4315 __ sbfm(x10, x1, 16, 31);
4233 __ sbfm(x11, x1, 32, 15); 4316 __ sbfm(x11, x1, 32, 15);
4234 __ sbfm(x12, x1, 32, 47); 4317 __ sbfm(x12, x1, 32, 47);
4235 __ sbfm(x13, x1, 48, 35); 4318 __ sbfm(x13, x1, 48, 35);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4278 ASSERT_EQUAL_64(0xffffffffffffcdefL, x26); 4361 ASSERT_EQUAL_64(0xffffffffffffcdefL, x26);
4279 ASSERT_EQUAL_64(0x3210, x27); 4362 ASSERT_EQUAL_64(0x3210, x27);
4280 ASSERT_EQUAL_64(0xffffffff89abcdefL, x28); 4363 ASSERT_EQUAL_64(0xffffffff89abcdefL, x28);
4281 ASSERT_EQUAL_64(0x76543210, x29); 4364 ASSERT_EQUAL_64(0x76543210, x29);
4282 4365
4283 TEARDOWN(); 4366 TEARDOWN();
4284 } 4367 }
4285 4368
4286 4369
4287 TEST(ubfm) { 4370 TEST(ubfm) {
4371 INIT_V8();
4288 SETUP(); 4372 SETUP();
4289 4373
4290 START(); 4374 START();
4291 __ Mov(x1, 0x0123456789abcdefL); 4375 __ Mov(x1, 0x0123456789abcdefL);
4292 __ Mov(x2, 0xfedcba9876543210L); 4376 __ Mov(x2, 0xfedcba9876543210L);
4293 4377
4294 __ Mov(x10, 0x8888888888888888L); 4378 __ Mov(x10, 0x8888888888888888L);
4295 __ Mov(x11, 0x8888888888888888L); 4379 __ Mov(x11, 0x8888888888888888L);
4296 4380
4297 __ ubfm(x10, x1, 16, 31); 4381 __ ubfm(x10, x1, 16, 31);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 ASSERT_EQUAL_64(0xabcdL, x19); 4418 ASSERT_EQUAL_64(0xabcdL, x19);
4335 ASSERT_EQUAL_64(0xefL, x20); 4419 ASSERT_EQUAL_64(0xefL, x20);
4336 ASSERT_EQUAL_64(0xcdefL, x21); 4420 ASSERT_EQUAL_64(0xcdefL, x21);
4337 ASSERT_EQUAL_64(0x89abcdefL, x22); 4421 ASSERT_EQUAL_64(0x89abcdefL, x22);
4338 4422
4339 TEARDOWN(); 4423 TEARDOWN();
4340 } 4424 }
4341 4425
4342 4426
4343 TEST(extr) { 4427 TEST(extr) {
4428 INIT_V8();
4344 SETUP(); 4429 SETUP();
4345 4430
4346 START(); 4431 START();
4347 __ Mov(x1, 0x0123456789abcdefL); 4432 __ Mov(x1, 0x0123456789abcdefL);
4348 __ Mov(x2, 0xfedcba9876543210L); 4433 __ Mov(x2, 0xfedcba9876543210L);
4349 4434
4350 __ Extr(w10, w1, w2, 0); 4435 __ Extr(w10, w1, w2, 0);
4351 __ Extr(w11, w1, w2, 1); 4436 __ Extr(w11, w1, w2, 1);
4352 __ Extr(x12, x2, x1, 2); 4437 __ Extr(x12, x2, x1, 2);
4353 4438
(...skipping 13 matching lines...) Expand all
4367 ASSERT_EQUAL_64(0x19083b2a, x14); 4452 ASSERT_EQUAL_64(0x19083b2a, x14);
4368 ASSERT_EQUAL_64(0x13579bdf, x15); 4453 ASSERT_EQUAL_64(0x13579bdf, x15);
4369 ASSERT_EQUAL_64(0x7f6e5d4c3b2a1908UL, x18); 4454 ASSERT_EQUAL_64(0x7f6e5d4c3b2a1908UL, x18);
4370 ASSERT_EQUAL_64(0x02468acf13579bdeUL, x19); 4455 ASSERT_EQUAL_64(0x02468acf13579bdeUL, x19);
4371 4456
4372 TEARDOWN(); 4457 TEARDOWN();
4373 } 4458 }
4374 4459
4375 4460
4376 TEST(fmov_imm) { 4461 TEST(fmov_imm) {
4462 INIT_V8();
4377 SETUP(); 4463 SETUP();
4378 4464
4379 START(); 4465 START();
4380 __ Fmov(s11, 1.0); 4466 __ Fmov(s11, 1.0);
4381 __ Fmov(d22, -13.0); 4467 __ Fmov(d22, -13.0);
4382 __ Fmov(s1, 255.0); 4468 __ Fmov(s1, 255.0);
4383 __ Fmov(d2, 12.34567); 4469 __ Fmov(d2, 12.34567);
4384 __ Fmov(s3, 0.0); 4470 __ Fmov(s3, 0.0);
4385 __ Fmov(d4, 0.0); 4471 __ Fmov(d4, 0.0);
4386 __ Fmov(s5, kFP32PositiveInfinity); 4472 __ Fmov(s5, kFP32PositiveInfinity);
4387 __ Fmov(d6, kFP64NegativeInfinity); 4473 __ Fmov(d6, kFP64NegativeInfinity);
4388 END(); 4474 END();
4389 4475
4390 RUN(); 4476 RUN();
4391 4477
4392 ASSERT_EQUAL_FP32(1.0, s11); 4478 ASSERT_EQUAL_FP32(1.0, s11);
4393 ASSERT_EQUAL_FP64(-13.0, d22); 4479 ASSERT_EQUAL_FP64(-13.0, d22);
4394 ASSERT_EQUAL_FP32(255.0, s1); 4480 ASSERT_EQUAL_FP32(255.0, s1);
4395 ASSERT_EQUAL_FP64(12.34567, d2); 4481 ASSERT_EQUAL_FP64(12.34567, d2);
4396 ASSERT_EQUAL_FP32(0.0, s3); 4482 ASSERT_EQUAL_FP32(0.0, s3);
4397 ASSERT_EQUAL_FP64(0.0, d4); 4483 ASSERT_EQUAL_FP64(0.0, d4);
4398 ASSERT_EQUAL_FP32(kFP32PositiveInfinity, s5); 4484 ASSERT_EQUAL_FP32(kFP32PositiveInfinity, s5);
4399 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d6); 4485 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d6);
4400 4486
4401 TEARDOWN(); 4487 TEARDOWN();
4402 } 4488 }
4403 4489
4404 4490
4405 TEST(fmov_reg) { 4491 TEST(fmov_reg) {
4492 INIT_V8();
4406 SETUP(); 4493 SETUP();
4407 4494
4408 START(); 4495 START();
4409 __ Fmov(s20, 1.0); 4496 __ Fmov(s20, 1.0);
4410 __ Fmov(w10, s20); 4497 __ Fmov(w10, s20);
4411 __ Fmov(s30, w10); 4498 __ Fmov(s30, w10);
4412 __ Fmov(s5, s20); 4499 __ Fmov(s5, s20);
4413 __ Fmov(d1, -13.0); 4500 __ Fmov(d1, -13.0);
4414 __ Fmov(x1, d1); 4501 __ Fmov(x1, d1);
4415 __ Fmov(d2, x1); 4502 __ Fmov(d2, x1);
(...skipping 10 matching lines...) Expand all
4426 ASSERT_EQUAL_64(double_to_rawbits(-13.0), x1); 4513 ASSERT_EQUAL_64(double_to_rawbits(-13.0), x1);
4427 ASSERT_EQUAL_FP64(-13.0, d2); 4514 ASSERT_EQUAL_FP64(-13.0, d2);
4428 ASSERT_EQUAL_FP64(-13.0, d4); 4515 ASSERT_EQUAL_FP64(-13.0, d4);
4429 ASSERT_EQUAL_FP32(rawbits_to_float(0x89abcdef), s6); 4516 ASSERT_EQUAL_FP32(rawbits_to_float(0x89abcdef), s6);
4430 4517
4431 TEARDOWN(); 4518 TEARDOWN();
4432 } 4519 }
4433 4520
4434 4521
4435 TEST(fadd) { 4522 TEST(fadd) {
4523 INIT_V8();
4436 SETUP(); 4524 SETUP();
4437 4525
4438 START(); 4526 START();
4439 __ Fmov(s13, -0.0); 4527 __ Fmov(s13, -0.0);
4440 __ Fmov(s14, kFP32PositiveInfinity); 4528 __ Fmov(s14, kFP32PositiveInfinity);
4441 __ Fmov(s15, kFP32NegativeInfinity); 4529 __ Fmov(s15, kFP32NegativeInfinity);
4442 __ Fmov(s16, 3.25); 4530 __ Fmov(s16, 3.25);
4443 __ Fmov(s17, 1.0); 4531 __ Fmov(s17, 1.0);
4444 __ Fmov(s18, 0); 4532 __ Fmov(s18, 0);
4445 4533
(...skipping 28 matching lines...) Expand all
4474 ASSERT_EQUAL_FP64(2.25, d6); 4562 ASSERT_EQUAL_FP64(2.25, d6);
4475 ASSERT_EQUAL_FP64(2.25, d7); 4563 ASSERT_EQUAL_FP64(2.25, d7);
4476 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d8); 4564 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d8);
4477 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d9); 4565 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d9);
4478 4566
4479 TEARDOWN(); 4567 TEARDOWN();
4480 } 4568 }
4481 4569
4482 4570
4483 TEST(fsub) { 4571 TEST(fsub) {
4572 INIT_V8();
4484 SETUP(); 4573 SETUP();
4485 4574
4486 START(); 4575 START();
4487 __ Fmov(s13, -0.0); 4576 __ Fmov(s13, -0.0);
4488 __ Fmov(s14, kFP32PositiveInfinity); 4577 __ Fmov(s14, kFP32PositiveInfinity);
4489 __ Fmov(s15, kFP32NegativeInfinity); 4578 __ Fmov(s15, kFP32NegativeInfinity);
4490 __ Fmov(s16, 3.25); 4579 __ Fmov(s16, 3.25);
4491 __ Fmov(s17, 1.0); 4580 __ Fmov(s17, 1.0);
4492 __ Fmov(s18, 0); 4581 __ Fmov(s18, 0);
4493 4582
(...skipping 28 matching lines...) Expand all
4522 ASSERT_EQUAL_FP64(-2.25, d6); 4611 ASSERT_EQUAL_FP64(-2.25, d6);
4523 ASSERT_EQUAL_FP64(-2.25, d7); 4612 ASSERT_EQUAL_FP64(-2.25, d7);
4524 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d8); 4613 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d8);
4525 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d9); 4614 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d9);
4526 4615
4527 TEARDOWN(); 4616 TEARDOWN();
4528 } 4617 }
4529 4618
4530 4619
4531 TEST(fmul) { 4620 TEST(fmul) {
4621 INIT_V8();
4532 SETUP(); 4622 SETUP();
4533 4623
4534 START(); 4624 START();
4535 __ Fmov(s13, -0.0); 4625 __ Fmov(s13, -0.0);
4536 __ Fmov(s14, kFP32PositiveInfinity); 4626 __ Fmov(s14, kFP32PositiveInfinity);
4537 __ Fmov(s15, kFP32NegativeInfinity); 4627 __ Fmov(s15, kFP32NegativeInfinity);
4538 __ Fmov(s16, 3.25); 4628 __ Fmov(s16, 3.25);
4539 __ Fmov(s17, 2.0); 4629 __ Fmov(s17, 2.0);
4540 __ Fmov(s18, 0); 4630 __ Fmov(s18, 0);
4541 __ Fmov(s19, -2.0); 4631 __ Fmov(s19, -2.0);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4596 ASSERT_EQUAL_FP64(fmadd, d28); 4686 ASSERT_EQUAL_FP64(fmadd, d28);
4597 ASSERT_EQUAL_FP64(fmsub, d29); 4687 ASSERT_EQUAL_FP64(fmsub, d29);
4598 ASSERT_EQUAL_FP64(-fmadd, d30); 4688 ASSERT_EQUAL_FP64(-fmadd, d30);
4599 ASSERT_EQUAL_FP64(-fmsub, d31); 4689 ASSERT_EQUAL_FP64(-fmsub, d31);
4600 4690
4601 TEARDOWN(); 4691 TEARDOWN();
4602 } 4692 }
4603 4693
4604 4694
4605 TEST(fmadd_fmsub_double) { 4695 TEST(fmadd_fmsub_double) {
4696 INIT_V8();
4606 double inputs[] = { 4697 double inputs[] = {
4607 // Normal numbers, including -0.0. 4698 // Normal numbers, including -0.0.
4608 DBL_MAX, DBL_MIN, 3.25, 2.0, 0.0, 4699 DBL_MAX, DBL_MIN, 3.25, 2.0, 0.0,
4609 -DBL_MAX, -DBL_MIN, -3.25, -2.0, -0.0, 4700 -DBL_MAX, -DBL_MIN, -3.25, -2.0, -0.0,
4610 // Infinities. 4701 // Infinities.
4611 kFP64NegativeInfinity, kFP64PositiveInfinity, 4702 kFP64NegativeInfinity, kFP64PositiveInfinity,
4612 // Subnormal numbers. 4703 // Subnormal numbers.
4613 rawbits_to_double(0x000fffffffffffff), 4704 rawbits_to_double(0x000fffffffffffff),
4614 rawbits_to_double(0x0000000000000001), 4705 rawbits_to_double(0x0000000000000001),
4615 rawbits_to_double(0x000123456789abcd), 4706 rawbits_to_double(0x000123456789abcd),
(...skipping 16 matching lines...) Expand all
4632 double fmsub = fma(-n, m, a); 4723 double fmsub = fma(-n, m, a);
4633 4724
4634 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub); 4725 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub);
4635 } 4726 }
4636 } 4727 }
4637 } 4728 }
4638 } 4729 }
4639 4730
4640 4731
4641 TEST(fmadd_fmsub_double_rounding) { 4732 TEST(fmadd_fmsub_double_rounding) {
4733 INIT_V8();
4642 // Make sure we run plenty of tests where an intermediate rounding stage would 4734 // Make sure we run plenty of tests where an intermediate rounding stage would
4643 // produce an incorrect result. 4735 // produce an incorrect result.
4644 const int limit = 1000; 4736 const int limit = 1000;
4645 int count_fmadd = 0; 4737 int count_fmadd = 0;
4646 int count_fmsub = 0; 4738 int count_fmsub = 0;
4647 4739
4648 uint16_t seed[3] = {42, 43, 44}; 4740 uint16_t seed[3] = {42, 43, 44};
4649 seed48(seed); 4741 seed48(seed);
4650 4742
4651 while ((count_fmadd < limit) || (count_fmsub < limit)) { 4743 while ((count_fmadd < limit) || (count_fmsub < limit)) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4700 RUN(); 4792 RUN();
4701 4793
4702 ASSERT_EQUAL_FP32(fmadd, s30); 4794 ASSERT_EQUAL_FP32(fmadd, s30);
4703 ASSERT_EQUAL_FP32(fmsub, s31); 4795 ASSERT_EQUAL_FP32(fmsub, s31);
4704 4796
4705 TEARDOWN(); 4797 TEARDOWN();
4706 } 4798 }
4707 4799
4708 4800
4709 TEST(fmadd_fmsub_float) { 4801 TEST(fmadd_fmsub_float) {
4802 INIT_V8();
4710 float inputs[] = { 4803 float inputs[] = {
4711 // Normal numbers, including -0.0f. 4804 // Normal numbers, including -0.0f.
4712 FLT_MAX, FLT_MIN, 3.25f, 2.0f, 0.0f, 4805 FLT_MAX, FLT_MIN, 3.25f, 2.0f, 0.0f,
4713 -FLT_MAX, -FLT_MIN, -3.25f, -2.0f, -0.0f, 4806 -FLT_MAX, -FLT_MIN, -3.25f, -2.0f, -0.0f,
4714 // Infinities. 4807 // Infinities.
4715 kFP32NegativeInfinity, kFP32PositiveInfinity, 4808 kFP32NegativeInfinity, kFP32PositiveInfinity,
4716 // Subnormal numbers. 4809 // Subnormal numbers.
4717 rawbits_to_float(0x07ffffff), 4810 rawbits_to_float(0x07ffffff),
4718 rawbits_to_float(0x00000001), 4811 rawbits_to_float(0x00000001),
4719 rawbits_to_float(0x01234567), 4812 rawbits_to_float(0x01234567),
(...skipping 16 matching lines...) Expand all
4736 float fmsub = fmaf(-n, m, a); 4829 float fmsub = fmaf(-n, m, a);
4737 4830
4738 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub); 4831 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub);
4739 } 4832 }
4740 } 4833 }
4741 } 4834 }
4742 } 4835 }
4743 4836
4744 4837
4745 TEST(fmadd_fmsub_float_rounding) { 4838 TEST(fmadd_fmsub_float_rounding) {
4839 INIT_V8();
4746 // Make sure we run plenty of tests where an intermediate rounding stage would 4840 // Make sure we run plenty of tests where an intermediate rounding stage would
4747 // produce an incorrect result. 4841 // produce an incorrect result.
4748 const int limit = 1000; 4842 const int limit = 1000;
4749 int count_fmadd = 0; 4843 int count_fmadd = 0;
4750 int count_fmsub = 0; 4844 int count_fmsub = 0;
4751 4845
4752 uint16_t seed[3] = {42, 43, 44}; 4846 uint16_t seed[3] = {42, 43, 44};
4753 seed48(seed); 4847 seed48(seed);
4754 4848
4755 while ((count_fmadd < limit) || (count_fmsub < limit)) { 4849 while ((count_fmadd < limit) || (count_fmsub < limit)) {
(...skipping 24 matching lines...) Expand all
4780 count_fmsub += test_fmsub; 4874 count_fmsub += test_fmsub;
4781 4875
4782 if (test_fmadd || test_fmsub) { 4876 if (test_fmadd || test_fmsub) {
4783 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub); 4877 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub);
4784 } 4878 }
4785 } 4879 }
4786 } 4880 }
4787 4881
4788 4882
4789 TEST(fdiv) { 4883 TEST(fdiv) {
4884 INIT_V8();
4790 SETUP(); 4885 SETUP();
4791 4886
4792 START(); 4887 START();
4793 __ Fmov(s13, -0.0); 4888 __ Fmov(s13, -0.0);
4794 __ Fmov(s14, kFP32PositiveInfinity); 4889 __ Fmov(s14, kFP32PositiveInfinity);
4795 __ Fmov(s15, kFP32NegativeInfinity); 4890 __ Fmov(s15, kFP32NegativeInfinity);
4796 __ Fmov(s16, 3.25); 4891 __ Fmov(s16, 3.25);
4797 __ Fmov(s17, 2.0); 4892 __ Fmov(s17, 2.0);
4798 __ Fmov(s18, 2.0); 4893 __ Fmov(s18, 2.0);
4799 __ Fmov(s19, -2.0); 4894 __ Fmov(s19, -2.0);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 ASSERT_EQUAL_FP64(min, d28); 5031 ASSERT_EQUAL_FP64(min, d28);
4937 ASSERT_EQUAL_FP64(max, d29); 5032 ASSERT_EQUAL_FP64(max, d29);
4938 ASSERT_EQUAL_FP64(minnm, d30); 5033 ASSERT_EQUAL_FP64(minnm, d30);
4939 ASSERT_EQUAL_FP64(maxnm, d31); 5034 ASSERT_EQUAL_FP64(maxnm, d31);
4940 5035
4941 TEARDOWN(); 5036 TEARDOWN();
4942 } 5037 }
4943 5038
4944 5039
4945 TEST(fmax_fmin_d) { 5040 TEST(fmax_fmin_d) {
5041 INIT_V8();
4946 // Bootstrap tests. 5042 // Bootstrap tests.
4947 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0); 5043 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0);
4948 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1); 5044 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1);
4949 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity, 5045 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity,
4950 kFP64NegativeInfinity, kFP64PositiveInfinity, 5046 kFP64NegativeInfinity, kFP64PositiveInfinity,
4951 kFP64NegativeInfinity, kFP64PositiveInfinity); 5047 kFP64NegativeInfinity, kFP64PositiveInfinity);
4952 FminFmaxDoubleHelper(kFP64SignallingNaN, 0, 5048 FminFmaxDoubleHelper(kFP64SignallingNaN, 0,
4953 kFP64SignallingNaN, kFP64SignallingNaN, 5049 kFP64SignallingNaN, kFP64SignallingNaN,
4954 kFP64SignallingNaN, kFP64SignallingNaN); 5050 kFP64SignallingNaN, kFP64SignallingNaN);
4955 FminFmaxDoubleHelper(kFP64QuietNaN, 0, 5051 FminFmaxDoubleHelper(kFP64QuietNaN, 0,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5005 ASSERT_EQUAL_FP32(min, s28); 5101 ASSERT_EQUAL_FP32(min, s28);
5006 ASSERT_EQUAL_FP32(max, s29); 5102 ASSERT_EQUAL_FP32(max, s29);
5007 ASSERT_EQUAL_FP32(minnm, s30); 5103 ASSERT_EQUAL_FP32(minnm, s30);
5008 ASSERT_EQUAL_FP32(maxnm, s31); 5104 ASSERT_EQUAL_FP32(maxnm, s31);
5009 5105
5010 TEARDOWN(); 5106 TEARDOWN();
5011 } 5107 }
5012 5108
5013 5109
5014 TEST(fmax_fmin_s) { 5110 TEST(fmax_fmin_s) {
5111 INIT_V8();
5015 // Bootstrap tests. 5112 // Bootstrap tests.
5016 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0); 5113 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0);
5017 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1); 5114 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1);
5018 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity, 5115 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity,
5019 kFP32NegativeInfinity, kFP32PositiveInfinity, 5116 kFP32NegativeInfinity, kFP32PositiveInfinity,
5020 kFP32NegativeInfinity, kFP32PositiveInfinity); 5117 kFP32NegativeInfinity, kFP32PositiveInfinity);
5021 FminFmaxFloatHelper(kFP32SignallingNaN, 0, 5118 FminFmaxFloatHelper(kFP32SignallingNaN, 0,
5022 kFP32SignallingNaN, kFP32SignallingNaN, 5119 kFP32SignallingNaN, kFP32SignallingNaN,
5023 kFP32SignallingNaN, kFP32SignallingNaN); 5120 kFP32SignallingNaN, kFP32SignallingNaN);
5024 FminFmaxFloatHelper(kFP32QuietNaN, 0, 5121 FminFmaxFloatHelper(kFP32QuietNaN, 0,
(...skipping 19 matching lines...) Expand all
5044 MinMaxHelper(n, m, true), 5141 MinMaxHelper(n, m, true),
5045 MinMaxHelper(n, m, false), 5142 MinMaxHelper(n, m, false),
5046 MinMaxHelper(n, m, true, kFP32PositiveInfinity), 5143 MinMaxHelper(n, m, true, kFP32PositiveInfinity),
5047 MinMaxHelper(n, m, false, kFP32NegativeInfinity)); 5144 MinMaxHelper(n, m, false, kFP32NegativeInfinity));
5048 } 5145 }
5049 } 5146 }
5050 } 5147 }
5051 5148
5052 5149
5053 TEST(fccmp) { 5150 TEST(fccmp) {
5151 INIT_V8();
5054 SETUP(); 5152 SETUP();
5055 5153
5056 START(); 5154 START();
5057 __ Fmov(s16, 0.0); 5155 __ Fmov(s16, 0.0);
5058 __ Fmov(s17, 0.5); 5156 __ Fmov(s17, 0.5);
5059 __ Fmov(d18, -0.5); 5157 __ Fmov(d18, -0.5);
5060 __ Fmov(d19, -1.0); 5158 __ Fmov(d19, -1.0);
5061 __ Mov(x20, 0); 5159 __ Mov(x20, 0);
5062 5160
5063 __ Cmp(x20, 0); 5161 __ Cmp(x20, 0);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 ASSERT_EQUAL_32(CFlag, w6); 5209 ASSERT_EQUAL_32(CFlag, w6);
5112 ASSERT_EQUAL_32(NFlag, w7); 5210 ASSERT_EQUAL_32(NFlag, w7);
5113 ASSERT_EQUAL_32(ZCFlag, w8); 5211 ASSERT_EQUAL_32(ZCFlag, w8);
5114 ASSERT_EQUAL_32(ZCFlag, w9); 5212 ASSERT_EQUAL_32(ZCFlag, w9);
5115 5213
5116 TEARDOWN(); 5214 TEARDOWN();
5117 } 5215 }
5118 5216
5119 5217
5120 TEST(fcmp) { 5218 TEST(fcmp) {
5219 INIT_V8();
5121 SETUP(); 5220 SETUP();
5122 5221
5123 START(); 5222 START();
5124 5223
5125 // Some of these tests require a floating-point scratch register assigned to 5224 // Some of these tests require a floating-point scratch register assigned to
5126 // the macro assembler, but most do not. 5225 // the macro assembler, but most do not.
5127 __ SetFPScratchRegister(NoFPReg); 5226 __ SetFPScratchRegister(NoFPReg);
5128 5227
5129 __ Fmov(s8, 0.0); 5228 __ Fmov(s8, 0.0);
5130 __ Fmov(s9, 0.5); 5229 __ Fmov(s9, 0.5);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5186 ASSERT_EQUAL_32(CVFlag, w13); 5285 ASSERT_EQUAL_32(CVFlag, w13);
5187 ASSERT_EQUAL_32(CVFlag, w14); 5286 ASSERT_EQUAL_32(CVFlag, w14);
5188 ASSERT_EQUAL_32(ZCFlag, w15); 5287 ASSERT_EQUAL_32(ZCFlag, w15);
5189 ASSERT_EQUAL_32(NFlag, w16); 5288 ASSERT_EQUAL_32(NFlag, w16);
5190 5289
5191 TEARDOWN(); 5290 TEARDOWN();
5192 } 5291 }
5193 5292
5194 5293
5195 TEST(fcsel) { 5294 TEST(fcsel) {
5295 INIT_V8();
5196 SETUP(); 5296 SETUP();
5197 5297
5198 START(); 5298 START();
5199 __ Mov(x16, 0); 5299 __ Mov(x16, 0);
5200 __ Fmov(s16, 1.0); 5300 __ Fmov(s16, 1.0);
5201 __ Fmov(s17, 2.0); 5301 __ Fmov(s17, 2.0);
5202 __ Fmov(d18, 3.0); 5302 __ Fmov(d18, 3.0);
5203 __ Fmov(d19, 4.0); 5303 __ Fmov(d19, 4.0);
5204 5304
5205 __ Cmp(x16, 0); 5305 __ Cmp(x16, 0);
(...skipping 12 matching lines...) Expand all
5218 ASSERT_EQUAL_FP64(3.0, d2); 5318 ASSERT_EQUAL_FP64(3.0, d2);
5219 ASSERT_EQUAL_FP64(4.0, d3); 5319 ASSERT_EQUAL_FP64(4.0, d3);
5220 ASSERT_EQUAL_FP32(1.0, s4); 5320 ASSERT_EQUAL_FP32(1.0, s4);
5221 ASSERT_EQUAL_FP64(3.0, d5); 5321 ASSERT_EQUAL_FP64(3.0, d5);
5222 5322
5223 TEARDOWN(); 5323 TEARDOWN();
5224 } 5324 }
5225 5325
5226 5326
5227 TEST(fneg) { 5327 TEST(fneg) {
5328 INIT_V8();
5228 SETUP(); 5329 SETUP();
5229 5330
5230 START(); 5331 START();
5231 __ Fmov(s16, 1.0); 5332 __ Fmov(s16, 1.0);
5232 __ Fmov(s17, 0.0); 5333 __ Fmov(s17, 0.0);
5233 __ Fmov(s18, kFP32PositiveInfinity); 5334 __ Fmov(s18, kFP32PositiveInfinity);
5234 __ Fmov(d19, 1.0); 5335 __ Fmov(d19, 1.0);
5235 __ Fmov(d20, 0.0); 5336 __ Fmov(d20, 0.0);
5236 __ Fmov(d21, kFP64PositiveInfinity); 5337 __ Fmov(d21, kFP64PositiveInfinity);
5237 5338
(...skipping 24 matching lines...) Expand all
5262 ASSERT_EQUAL_FP64(-0.0, d8); 5363 ASSERT_EQUAL_FP64(-0.0, d8);
5263 ASSERT_EQUAL_FP64(0.0, d9); 5364 ASSERT_EQUAL_FP64(0.0, d9);
5264 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d10); 5365 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d10);
5265 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d11); 5366 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d11);
5266 5367
5267 TEARDOWN(); 5368 TEARDOWN();
5268 } 5369 }
5269 5370
5270 5371
5271 TEST(fabs) { 5372 TEST(fabs) {
5373 INIT_V8();
5272 SETUP(); 5374 SETUP();
5273 5375
5274 START(); 5376 START();
5275 __ Fmov(s16, -1.0); 5377 __ Fmov(s16, -1.0);
5276 __ Fmov(s17, -0.0); 5378 __ Fmov(s17, -0.0);
5277 __ Fmov(s18, kFP32NegativeInfinity); 5379 __ Fmov(s18, kFP32NegativeInfinity);
5278 __ Fmov(d19, -1.0); 5380 __ Fmov(d19, -1.0);
5279 __ Fmov(d20, -0.0); 5381 __ Fmov(d20, -0.0);
5280 __ Fmov(d21, kFP64NegativeInfinity); 5382 __ Fmov(d21, kFP64NegativeInfinity);
5281 5383
(...skipping 16 matching lines...) Expand all
5298 ASSERT_EQUAL_FP64(1.0, d4); 5400 ASSERT_EQUAL_FP64(1.0, d4);
5299 ASSERT_EQUAL_FP64(1.0, d5); 5401 ASSERT_EQUAL_FP64(1.0, d5);
5300 ASSERT_EQUAL_FP64(0.0, d6); 5402 ASSERT_EQUAL_FP64(0.0, d6);
5301 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d7); 5403 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d7);
5302 5404
5303 TEARDOWN(); 5405 TEARDOWN();
5304 } 5406 }
5305 5407
5306 5408
5307 TEST(fsqrt) { 5409 TEST(fsqrt) {
5410 INIT_V8();
5308 SETUP(); 5411 SETUP();
5309 5412
5310 START(); 5413 START();
5311 __ Fmov(s16, 0.0); 5414 __ Fmov(s16, 0.0);
5312 __ Fmov(s17, 1.0); 5415 __ Fmov(s17, 1.0);
5313 __ Fmov(s18, 0.25); 5416 __ Fmov(s18, 0.25);
5314 __ Fmov(s19, 65536.0); 5417 __ Fmov(s19, 65536.0);
5315 __ Fmov(s20, -0.0); 5418 __ Fmov(s20, -0.0);
5316 __ Fmov(s21, kFP32PositiveInfinity); 5419 __ Fmov(s21, kFP32PositiveInfinity);
5317 __ Fmov(d22, 0.0); 5420 __ Fmov(d22, 0.0);
(...skipping 30 matching lines...) Expand all
5348 ASSERT_EQUAL_FP64(0.5, d8); 5451 ASSERT_EQUAL_FP64(0.5, d8);
5349 ASSERT_EQUAL_FP64(65536.0, d9); 5452 ASSERT_EQUAL_FP64(65536.0, d9);
5350 ASSERT_EQUAL_FP64(-0.0, d10); 5453 ASSERT_EQUAL_FP64(-0.0, d10);
5351 ASSERT_EQUAL_FP64(kFP32PositiveInfinity, d11); 5454 ASSERT_EQUAL_FP64(kFP32PositiveInfinity, d11);
5352 5455
5353 TEARDOWN(); 5456 TEARDOWN();
5354 } 5457 }
5355 5458
5356 5459
5357 TEST(frinta) { 5460 TEST(frinta) {
5461 INIT_V8();
5358 SETUP(); 5462 SETUP();
5359 5463
5360 START(); 5464 START();
5361 __ Fmov(s16, 1.0); 5465 __ Fmov(s16, 1.0);
5362 __ Fmov(s17, 1.1); 5466 __ Fmov(s17, 1.1);
5363 __ Fmov(s18, 1.5); 5467 __ Fmov(s18, 1.5);
5364 __ Fmov(s19, 1.9); 5468 __ Fmov(s19, 1.9);
5365 __ Fmov(s20, 2.5); 5469 __ Fmov(s20, 2.5);
5366 __ Fmov(s21, -1.5); 5470 __ Fmov(s21, -1.5);
5367 __ Fmov(s22, -2.5); 5471 __ Fmov(s22, -2.5);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5430 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18); 5534 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18);
5431 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19); 5535 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19);
5432 ASSERT_EQUAL_FP64(0.0, d20); 5536 ASSERT_EQUAL_FP64(0.0, d20);
5433 ASSERT_EQUAL_FP64(-0.0, d21); 5537 ASSERT_EQUAL_FP64(-0.0, d21);
5434 5538
5435 TEARDOWN(); 5539 TEARDOWN();
5436 } 5540 }
5437 5541
5438 5542
5439 TEST(frintn) { 5543 TEST(frintn) {
5544 INIT_V8();
5440 SETUP(); 5545 SETUP();
5441 5546
5442 START(); 5547 START();
5443 __ Fmov(s16, 1.0); 5548 __ Fmov(s16, 1.0);
5444 __ Fmov(s17, 1.1); 5549 __ Fmov(s17, 1.1);
5445 __ Fmov(s18, 1.5); 5550 __ Fmov(s18, 1.5);
5446 __ Fmov(s19, 1.9); 5551 __ Fmov(s19, 1.9);
5447 __ Fmov(s20, 2.5); 5552 __ Fmov(s20, 2.5);
5448 __ Fmov(s21, -1.5); 5553 __ Fmov(s21, -1.5);
5449 __ Fmov(s22, -2.5); 5554 __ Fmov(s22, -2.5);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5512 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18); 5617 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18);
5513 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19); 5618 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19);
5514 ASSERT_EQUAL_FP64(0.0, d20); 5619 ASSERT_EQUAL_FP64(0.0, d20);
5515 ASSERT_EQUAL_FP64(-0.0, d21); 5620 ASSERT_EQUAL_FP64(-0.0, d21);
5516 5621
5517 TEARDOWN(); 5622 TEARDOWN();
5518 } 5623 }
5519 5624
5520 5625
5521 TEST(frintz) { 5626 TEST(frintz) {
5627 INIT_V8();
5522 SETUP(); 5628 SETUP();
5523 5629
5524 START(); 5630 START();
5525 __ Fmov(s16, 1.0); 5631 __ Fmov(s16, 1.0);
5526 __ Fmov(s17, 1.1); 5632 __ Fmov(s17, 1.1);
5527 __ Fmov(s18, 1.5); 5633 __ Fmov(s18, 1.5);
5528 __ Fmov(s19, 1.9); 5634 __ Fmov(s19, 1.9);
5529 __ Fmov(s20, 2.5); 5635 __ Fmov(s20, 2.5);
5530 __ Fmov(s21, -1.5); 5636 __ Fmov(s21, -1.5);
5531 __ Fmov(s22, -2.5); 5637 __ Fmov(s22, -2.5);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5594 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18); 5700 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d18);
5595 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19); 5701 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d19);
5596 ASSERT_EQUAL_FP64(0.0, d20); 5702 ASSERT_EQUAL_FP64(0.0, d20);
5597 ASSERT_EQUAL_FP64(-0.0, d21); 5703 ASSERT_EQUAL_FP64(-0.0, d21);
5598 5704
5599 TEARDOWN(); 5705 TEARDOWN();
5600 } 5706 }
5601 5707
5602 5708
5603 TEST(fcvt_ds) { 5709 TEST(fcvt_ds) {
5710 INIT_V8();
5604 SETUP(); 5711 SETUP();
5605 5712
5606 START(); 5713 START();
5607 __ Fmov(s16, 1.0); 5714 __ Fmov(s16, 1.0);
5608 __ Fmov(s17, 1.1); 5715 __ Fmov(s17, 1.1);
5609 __ Fmov(s18, 1.5); 5716 __ Fmov(s18, 1.5);
5610 __ Fmov(s19, 1.9); 5717 __ Fmov(s19, 1.9);
5611 __ Fmov(s20, 2.5); 5718 __ Fmov(s20, 2.5);
5612 __ Fmov(s21, -1.5); 5719 __ Fmov(s21, -1.5);
5613 __ Fmov(s22, -2.5); 5720 __ Fmov(s22, -2.5);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5659 // - The remaining mantissa bits are copied until they run out. 5766 // - The remaining mantissa bits are copied until they run out.
5660 // - The low-order bits that haven't already been assigned are set to 0. 5767 // - The low-order bits that haven't already been assigned are set to 0.
5661 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d13); 5768 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d13);
5662 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d14); 5769 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d14);
5663 5770
5664 TEARDOWN(); 5771 TEARDOWN();
5665 } 5772 }
5666 5773
5667 5774
5668 TEST(fcvt_sd) { 5775 TEST(fcvt_sd) {
5776 INIT_V8();
5669 // There are a huge number of corner-cases to check, so this test iterates 5777 // There are a huge number of corner-cases to check, so this test iterates
5670 // through a list. The list is then negated and checked again (since the sign 5778 // through a list. The list is then negated and checked again (since the sign
5671 // is irrelevant in ties-to-even rounding), so the list shouldn't include any 5779 // is irrelevant in ties-to-even rounding), so the list shouldn't include any
5672 // negative values. 5780 // negative values.
5673 // 5781 //
5674 // Note that this test only checks ties-to-even rounding, because that is all 5782 // Note that this test only checks ties-to-even rounding, because that is all
5675 // that the simulator supports. 5783 // that the simulator supports.
5676 struct {double in; float expected;} test[] = { 5784 struct {double in; float expected;} test[] = {
5677 // Check some simple conversions. 5785 // Check some simple conversions.
5678 {0.0, 0.0f}, 5786 {0.0, 0.0f},
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
5773 END(); 5881 END();
5774 RUN(); 5882 RUN();
5775 ASSERT_EQUAL_FP32(expected, s20); 5883 ASSERT_EQUAL_FP32(expected, s20);
5776 ASSERT_EQUAL_FP32(-expected, s21); 5884 ASSERT_EQUAL_FP32(-expected, s21);
5777 TEARDOWN(); 5885 TEARDOWN();
5778 } 5886 }
5779 } 5887 }
5780 5888
5781 5889
5782 TEST(fcvtas) { 5890 TEST(fcvtas) {
5891 INIT_V8();
5783 SETUP(); 5892 SETUP();
5784 5893
5785 START(); 5894 START();
5786 __ Fmov(s0, 1.0); 5895 __ Fmov(s0, 1.0);
5787 __ Fmov(s1, 1.1); 5896 __ Fmov(s1, 1.1);
5788 __ Fmov(s2, 2.5); 5897 __ Fmov(s2, 2.5);
5789 __ Fmov(s3, -2.5); 5898 __ Fmov(s3, -2.5);
5790 __ Fmov(s4, kFP32PositiveInfinity); 5899 __ Fmov(s4, kFP32PositiveInfinity);
5791 __ Fmov(s5, kFP32NegativeInfinity); 5900 __ Fmov(s5, kFP32NegativeInfinity);
5792 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 5901 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
5877 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27); 5986 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27);
5878 ASSERT_EQUAL_64(0x8000000000000000UL, x28); 5987 ASSERT_EQUAL_64(0x8000000000000000UL, x28);
5879 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29); 5988 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29);
5880 ASSERT_EQUAL_64(0x8000000000000400UL, x30); 5989 ASSERT_EQUAL_64(0x8000000000000400UL, x30);
5881 5990
5882 TEARDOWN(); 5991 TEARDOWN();
5883 } 5992 }
5884 5993
5885 5994
5886 TEST(fcvtau) { 5995 TEST(fcvtau) {
5996 INIT_V8();
5887 SETUP(); 5997 SETUP();
5888 5998
5889 START(); 5999 START();
5890 __ Fmov(s0, 1.0); 6000 __ Fmov(s0, 1.0);
5891 __ Fmov(s1, 1.1); 6001 __ Fmov(s1, 1.1);
5892 __ Fmov(s2, 2.5); 6002 __ Fmov(s2, 2.5);
5893 __ Fmov(s3, -2.5); 6003 __ Fmov(s3, -2.5);
5894 __ Fmov(s4, kFP32PositiveInfinity); 6004 __ Fmov(s4, kFP32PositiveInfinity);
5895 __ Fmov(s5, kFP32NegativeInfinity); 6005 __ Fmov(s5, kFP32NegativeInfinity);
5896 __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX. 6006 __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5976 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27); 6086 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27);
5977 ASSERT_EQUAL_64(0, x28); 6087 ASSERT_EQUAL_64(0, x28);
5978 ASSERT_EQUAL_64(0xfffffffffffff800UL, x29); 6088 ASSERT_EQUAL_64(0xfffffffffffff800UL, x29);
5979 ASSERT_EQUAL_64(0xffffffff, x30); 6089 ASSERT_EQUAL_64(0xffffffff, x30);
5980 6090
5981 TEARDOWN(); 6091 TEARDOWN();
5982 } 6092 }
5983 6093
5984 6094
5985 TEST(fcvtms) { 6095 TEST(fcvtms) {
6096 INIT_V8();
5986 SETUP(); 6097 SETUP();
5987 6098
5988 START(); 6099 START();
5989 __ Fmov(s0, 1.0); 6100 __ Fmov(s0, 1.0);
5990 __ Fmov(s1, 1.1); 6101 __ Fmov(s1, 1.1);
5991 __ Fmov(s2, 1.5); 6102 __ Fmov(s2, 1.5);
5992 __ Fmov(s3, -1.5); 6103 __ Fmov(s3, -1.5);
5993 __ Fmov(s4, kFP32PositiveInfinity); 6104 __ Fmov(s4, kFP32PositiveInfinity);
5994 __ Fmov(s5, kFP32NegativeInfinity); 6105 __ Fmov(s5, kFP32NegativeInfinity);
5995 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 6106 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6080 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27); 6191 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27);
6081 ASSERT_EQUAL_64(0x8000000000000000UL, x28); 6192 ASSERT_EQUAL_64(0x8000000000000000UL, x28);
6082 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29); 6193 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29);
6083 ASSERT_EQUAL_64(0x8000000000000400UL, x30); 6194 ASSERT_EQUAL_64(0x8000000000000400UL, x30);
6084 6195
6085 TEARDOWN(); 6196 TEARDOWN();
6086 } 6197 }
6087 6198
6088 6199
6089 TEST(fcvtmu) { 6200 TEST(fcvtmu) {
6201 INIT_V8();
6090 SETUP(); 6202 SETUP();
6091 6203
6092 START(); 6204 START();
6093 __ Fmov(s0, 1.0); 6205 __ Fmov(s0, 1.0);
6094 __ Fmov(s1, 1.1); 6206 __ Fmov(s1, 1.1);
6095 __ Fmov(s2, 1.5); 6207 __ Fmov(s2, 1.5);
6096 __ Fmov(s3, -1.5); 6208 __ Fmov(s3, -1.5);
6097 __ Fmov(s4, kFP32PositiveInfinity); 6209 __ Fmov(s4, kFP32PositiveInfinity);
6098 __ Fmov(s5, kFP32NegativeInfinity); 6210 __ Fmov(s5, kFP32NegativeInfinity);
6099 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 6211 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6182 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27); 6294 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27);
6183 ASSERT_EQUAL_64(0x0UL, x28); 6295 ASSERT_EQUAL_64(0x0UL, x28);
6184 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29); 6296 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29);
6185 ASSERT_EQUAL_64(0x0UL, x30); 6297 ASSERT_EQUAL_64(0x0UL, x30);
6186 6298
6187 TEARDOWN(); 6299 TEARDOWN();
6188 } 6300 }
6189 6301
6190 6302
6191 TEST(fcvtns) { 6303 TEST(fcvtns) {
6304 INIT_V8();
6192 SETUP(); 6305 SETUP();
6193 6306
6194 START(); 6307 START();
6195 __ Fmov(s0, 1.0); 6308 __ Fmov(s0, 1.0);
6196 __ Fmov(s1, 1.1); 6309 __ Fmov(s1, 1.1);
6197 __ Fmov(s2, 1.5); 6310 __ Fmov(s2, 1.5);
6198 __ Fmov(s3, -1.5); 6311 __ Fmov(s3, -1.5);
6199 __ Fmov(s4, kFP32PositiveInfinity); 6312 __ Fmov(s4, kFP32PositiveInfinity);
6200 __ Fmov(s5, kFP32NegativeInfinity); 6313 __ Fmov(s5, kFP32NegativeInfinity);
6201 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 6314 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6286 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27); 6399 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27);
6287 // ASSERT_EQUAL_64(0x8000000000000000UL, x28); 6400 // ASSERT_EQUAL_64(0x8000000000000000UL, x28);
6288 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29); 6401 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29);
6289 ASSERT_EQUAL_64(0x8000000000000400UL, x30); 6402 ASSERT_EQUAL_64(0x8000000000000400UL, x30);
6290 6403
6291 TEARDOWN(); 6404 TEARDOWN();
6292 } 6405 }
6293 6406
6294 6407
6295 TEST(fcvtnu) { 6408 TEST(fcvtnu) {
6409 INIT_V8();
6296 SETUP(); 6410 SETUP();
6297 6411
6298 START(); 6412 START();
6299 __ Fmov(s0, 1.0); 6413 __ Fmov(s0, 1.0);
6300 __ Fmov(s1, 1.1); 6414 __ Fmov(s1, 1.1);
6301 __ Fmov(s2, 1.5); 6415 __ Fmov(s2, 1.5);
6302 __ Fmov(s3, -1.5); 6416 __ Fmov(s3, -1.5);
6303 __ Fmov(s4, kFP32PositiveInfinity); 6417 __ Fmov(s4, kFP32PositiveInfinity);
6304 __ Fmov(s5, kFP32NegativeInfinity); 6418 __ Fmov(s5, kFP32NegativeInfinity);
6305 __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX. 6419 __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
6385 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27); 6499 ASSERT_EQUAL_64(0xffffffffffffffffUL, x27);
6386 // ASSERT_EQUAL_64(0, x28); 6500 // ASSERT_EQUAL_64(0, x28);
6387 ASSERT_EQUAL_64(0xfffffffffffff800UL, x29); 6501 ASSERT_EQUAL_64(0xfffffffffffff800UL, x29);
6388 ASSERT_EQUAL_64(0xffffffff, x30); 6502 ASSERT_EQUAL_64(0xffffffff, x30);
6389 6503
6390 TEARDOWN(); 6504 TEARDOWN();
6391 } 6505 }
6392 6506
6393 6507
6394 TEST(fcvtzs) { 6508 TEST(fcvtzs) {
6509 INIT_V8();
6395 SETUP(); 6510 SETUP();
6396 6511
6397 START(); 6512 START();
6398 __ Fmov(s0, 1.0); 6513 __ Fmov(s0, 1.0);
6399 __ Fmov(s1, 1.1); 6514 __ Fmov(s1, 1.1);
6400 __ Fmov(s2, 1.5); 6515 __ Fmov(s2, 1.5);
6401 __ Fmov(s3, -1.5); 6516 __ Fmov(s3, -1.5);
6402 __ Fmov(s4, kFP32PositiveInfinity); 6517 __ Fmov(s4, kFP32PositiveInfinity);
6403 __ Fmov(s5, kFP32NegativeInfinity); 6518 __ Fmov(s5, kFP32NegativeInfinity);
6404 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 6519 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6489 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27); 6604 ASSERT_EQUAL_64(0x7fffffffffffffffUL, x27);
6490 ASSERT_EQUAL_64(0x8000000000000000UL, x28); 6605 ASSERT_EQUAL_64(0x8000000000000000UL, x28);
6491 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29); 6606 ASSERT_EQUAL_64(0x7ffffffffffffc00UL, x29);
6492 ASSERT_EQUAL_64(0x8000000000000400UL, x30); 6607 ASSERT_EQUAL_64(0x8000000000000400UL, x30);
6493 6608
6494 TEARDOWN(); 6609 TEARDOWN();
6495 } 6610 }
6496 6611
6497 6612
6498 TEST(fcvtzu) { 6613 TEST(fcvtzu) {
6614 INIT_V8();
6499 SETUP(); 6615 SETUP();
6500 6616
6501 START(); 6617 START();
6502 __ Fmov(s0, 1.0); 6618 __ Fmov(s0, 1.0);
6503 __ Fmov(s1, 1.1); 6619 __ Fmov(s1, 1.1);
6504 __ Fmov(s2, 1.5); 6620 __ Fmov(s2, 1.5);
6505 __ Fmov(s3, -1.5); 6621 __ Fmov(s3, -1.5);
6506 __ Fmov(s4, kFP32PositiveInfinity); 6622 __ Fmov(s4, kFP32PositiveInfinity);
6507 __ Fmov(s5, kFP32NegativeInfinity); 6623 __ Fmov(s5, kFP32NegativeInfinity);
6508 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. 6624 __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
6689 double expected_ucvtf = expected_ucvtf_base / pow(2, fbits); 6805 double expected_ucvtf = expected_ucvtf_base / pow(2, fbits);
6690 ASSERT_EQUAL_FP64(expected_scvtf, results_scvtf_x[fbits]); 6806 ASSERT_EQUAL_FP64(expected_scvtf, results_scvtf_x[fbits]);
6691 ASSERT_EQUAL_FP64(expected_ucvtf, results_ucvtf_x[fbits]); 6807 ASSERT_EQUAL_FP64(expected_ucvtf, results_ucvtf_x[fbits]);
6692 } 6808 }
6693 6809
6694 TEARDOWN(); 6810 TEARDOWN();
6695 } 6811 }
6696 6812
6697 6813
6698 TEST(scvtf_ucvtf_double) { 6814 TEST(scvtf_ucvtf_double) {
6815 INIT_V8();
6699 // Simple conversions of positive numbers which require no rounding; the 6816 // Simple conversions of positive numbers which require no rounding; the
6700 // results should not depened on the rounding mode, and ucvtf and scvtf should 6817 // results should not depened on the rounding mode, and ucvtf and scvtf should
6701 // produce the same result. 6818 // produce the same result.
6702 TestUScvtfHelper(0x0000000000000000, 0x0000000000000000, 0x0000000000000000); 6819 TestUScvtfHelper(0x0000000000000000, 0x0000000000000000, 0x0000000000000000);
6703 TestUScvtfHelper(0x0000000000000001, 0x3ff0000000000000, 0x3ff0000000000000); 6820 TestUScvtfHelper(0x0000000000000001, 0x3ff0000000000000, 0x3ff0000000000000);
6704 TestUScvtfHelper(0x0000000040000000, 0x41d0000000000000, 0x41d0000000000000); 6821 TestUScvtfHelper(0x0000000040000000, 0x41d0000000000000, 0x41d0000000000000);
6705 TestUScvtfHelper(0x0000000100000000, 0x41f0000000000000, 0x41f0000000000000); 6822 TestUScvtfHelper(0x0000000100000000, 0x41f0000000000000, 0x41f0000000000000);
6706 TestUScvtfHelper(0x4000000000000000, 0x43d0000000000000, 0x43d0000000000000); 6823 TestUScvtfHelper(0x4000000000000000, 0x43d0000000000000, 0x43d0000000000000);
6707 // Test mantissa extremities. 6824 // Test mantissa extremities.
6708 TestUScvtfHelper(0x4000000000000400, 0x43d0000000000001, 0x43d0000000000001); 6825 TestUScvtfHelper(0x4000000000000400, 0x43d0000000000001, 0x43d0000000000001);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
6845 float expected_ucvtf = expected_ucvtf_base / powf(2, fbits); 6962 float expected_ucvtf = expected_ucvtf_base / powf(2, fbits);
6846 ASSERT_EQUAL_FP32(expected_scvtf, results_scvtf_x[fbits]); 6963 ASSERT_EQUAL_FP32(expected_scvtf, results_scvtf_x[fbits]);
6847 ASSERT_EQUAL_FP32(expected_ucvtf, results_ucvtf_x[fbits]); 6964 ASSERT_EQUAL_FP32(expected_ucvtf, results_ucvtf_x[fbits]);
6848 } 6965 }
6849 6966
6850 TEARDOWN(); 6967 TEARDOWN();
6851 } 6968 }
6852 6969
6853 6970
6854 TEST(scvtf_ucvtf_float) { 6971 TEST(scvtf_ucvtf_float) {
6972 INIT_V8();
6855 // Simple conversions of positive numbers which require no rounding; the 6973 // Simple conversions of positive numbers which require no rounding; the
6856 // results should not depened on the rounding mode, and ucvtf and scvtf should 6974 // results should not depened on the rounding mode, and ucvtf and scvtf should
6857 // produce the same result. 6975 // produce the same result.
6858 TestUScvtf32Helper(0x0000000000000000, 0x00000000, 0x00000000); 6976 TestUScvtf32Helper(0x0000000000000000, 0x00000000, 0x00000000);
6859 TestUScvtf32Helper(0x0000000000000001, 0x3f800000, 0x3f800000); 6977 TestUScvtf32Helper(0x0000000000000001, 0x3f800000, 0x3f800000);
6860 TestUScvtf32Helper(0x0000000040000000, 0x4e800000, 0x4e800000); 6978 TestUScvtf32Helper(0x0000000040000000, 0x4e800000, 0x4e800000);
6861 TestUScvtf32Helper(0x0000000100000000, 0x4f800000, 0x4f800000); 6979 TestUScvtf32Helper(0x0000000100000000, 0x4f800000, 0x4f800000);
6862 TestUScvtf32Helper(0x4000000000000000, 0x5e800000, 0x5e800000); 6980 TestUScvtf32Helper(0x4000000000000000, 0x5e800000, 0x5e800000);
6863 // Test mantissa extremities. 6981 // Test mantissa extremities.
6864 TestUScvtf32Helper(0x0000000000800001, 0x4b000001, 0x4b000001); 6982 TestUScvtf32Helper(0x0000000000800001, 0x4b000001, 0x4b000001);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
6913 TestUScvtf32Helper(0x00000000ffffff80, 0x4f800000, 0x4f800000); 7031 TestUScvtf32Helper(0x00000000ffffff80, 0x4f800000, 0x4f800000);
6914 TestUScvtf32Helper(0x00000000ffffffff, 0x4f800000, 0x4f800000); 7032 TestUScvtf32Helper(0x00000000ffffffff, 0x4f800000, 0x4f800000);
6915 TestUScvtf32Helper(0x7fffffc000000000, 0x5f000000, 0x5f000000); 7033 TestUScvtf32Helper(0x7fffffc000000000, 0x5f000000, 0x5f000000);
6916 TestUScvtf32Helper(0x7fffffffffffffff, 0x5f000000, 0x5f000000); 7034 TestUScvtf32Helper(0x7fffffffffffffff, 0x5f000000, 0x5f000000);
6917 TestUScvtf32Helper(0xffffff8000000000, 0xd3000000, 0x5f800000); 7035 TestUScvtf32Helper(0xffffff8000000000, 0xd3000000, 0x5f800000);
6918 TestUScvtf32Helper(0xffffffffffffffff, 0xbf800000, 0x5f800000); 7036 TestUScvtf32Helper(0xffffffffffffffff, 0xbf800000, 0x5f800000);
6919 } 7037 }
6920 7038
6921 7039
6922 TEST(system_mrs) { 7040 TEST(system_mrs) {
7041 INIT_V8();
6923 SETUP(); 7042 SETUP();
6924 7043
6925 START(); 7044 START();
6926 __ Mov(w0, 0); 7045 __ Mov(w0, 0);
6927 __ Mov(w1, 1); 7046 __ Mov(w1, 1);
6928 __ Mov(w2, 0x80000000); 7047 __ Mov(w2, 0x80000000);
6929 7048
6930 // Set the Z and C flags. 7049 // Set the Z and C flags.
6931 __ Cmp(w0, w0); 7050 __ Cmp(w0, w0);
6932 __ Mrs(x3, NZCV); 7051 __ Mrs(x3, NZCV);
(...skipping 19 matching lines...) Expand all
6952 7071
6953 // FPCR 7072 // FPCR
6954 // The default FPCR on Linux-based platforms is 0. 7073 // The default FPCR on Linux-based platforms is 0.
6955 ASSERT_EQUAL_32(0, w6); 7074 ASSERT_EQUAL_32(0, w6);
6956 7075
6957 TEARDOWN(); 7076 TEARDOWN();
6958 } 7077 }
6959 7078
6960 7079
6961 TEST(system_msr) { 7080 TEST(system_msr) {
7081 INIT_V8();
6962 // All FPCR fields that must be implemented: AHP, DN, FZ, RMode 7082 // All FPCR fields that must be implemented: AHP, DN, FZ, RMode
6963 const uint64_t fpcr_core = 0x07c00000; 7083 const uint64_t fpcr_core = 0x07c00000;
6964 7084
6965 // All FPCR fields (including fields which may be read-as-zero): 7085 // All FPCR fields (including fields which may be read-as-zero):
6966 // Stride, Len 7086 // Stride, Len
6967 // IDE, IXE, UFE, OFE, DZE, IOE 7087 // IDE, IXE, UFE, OFE, DZE, IOE
6968 const uint64_t fpcr_all = fpcr_core | 0x00379f00; 7088 const uint64_t fpcr_all = fpcr_core | 0x00379f00;
6969 7089
6970 SETUP(); 7090 SETUP();
6971 7091
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
7023 7143
7024 ASSERT_EQUAL_64(fpcr_core, x8); 7144 ASSERT_EQUAL_64(fpcr_core, x8);
7025 ASSERT_EQUAL_64(fpcr_core, x9); 7145 ASSERT_EQUAL_64(fpcr_core, x9);
7026 ASSERT_EQUAL_64(0, x10); 7146 ASSERT_EQUAL_64(0, x10);
7027 7147
7028 TEARDOWN(); 7148 TEARDOWN();
7029 } 7149 }
7030 7150
7031 7151
7032 TEST(system_nop) { 7152 TEST(system_nop) {
7153 INIT_V8();
7033 SETUP(); 7154 SETUP();
7034 RegisterDump before; 7155 RegisterDump before;
7035 7156
7036 START(); 7157 START();
7037 before.Dump(&masm); 7158 before.Dump(&masm);
7038 __ Nop(); 7159 __ Nop();
7039 END(); 7160 END();
7040 7161
7041 RUN(); 7162 RUN();
7042 7163
7043 ASSERT_EQUAL_REGISTERS(before); 7164 ASSERT_EQUAL_REGISTERS(before);
7044 ASSERT_EQUAL_NZCV(before.flags_nzcv()); 7165 ASSERT_EQUAL_NZCV(before.flags_nzcv());
7045 7166
7046 TEARDOWN(); 7167 TEARDOWN();
7047 } 7168 }
7048 7169
7049 7170
7050 TEST(zero_dest) { 7171 TEST(zero_dest) {
7172 INIT_V8();
7051 SETUP(); 7173 SETUP();
7052 RegisterDump before; 7174 RegisterDump before;
7053 7175
7054 START(); 7176 START();
7055 // Preserve the system stack pointer, in case we clobber it. 7177 // Preserve the system stack pointer, in case we clobber it.
7056 __ Mov(x30, csp); 7178 __ Mov(x30, csp);
7057 // Initialize the other registers used in this test. 7179 // Initialize the other registers used in this test.
7058 uint64_t literal_base = 0x0100001000100101UL; 7180 uint64_t literal_base = 0x0100001000100101UL;
7059 __ Mov(x0, 0); 7181 __ Mov(x0, 0);
7060 __ Mov(x1, literal_base); 7182 __ Mov(x1, literal_base);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
7107 RUN(); 7229 RUN();
7108 7230
7109 ASSERT_EQUAL_REGISTERS(before); 7231 ASSERT_EQUAL_REGISTERS(before);
7110 ASSERT_EQUAL_NZCV(before.flags_nzcv()); 7232 ASSERT_EQUAL_NZCV(before.flags_nzcv());
7111 7233
7112 TEARDOWN(); 7234 TEARDOWN();
7113 } 7235 }
7114 7236
7115 7237
7116 TEST(zero_dest_setflags) { 7238 TEST(zero_dest_setflags) {
7239 INIT_V8();
7117 SETUP(); 7240 SETUP();
7118 RegisterDump before; 7241 RegisterDump before;
7119 7242
7120 START(); 7243 START();
7121 // Preserve the system stack pointer, in case we clobber it. 7244 // Preserve the system stack pointer, in case we clobber it.
7122 __ Mov(x30, csp); 7245 __ Mov(x30, csp);
7123 // Initialize the other registers used in this test. 7246 // Initialize the other registers used in this test.
7124 uint64_t literal_base = 0x0100001000100101UL; 7247 uint64_t literal_base = 0x0100001000100101UL;
7125 __ Mov(x0, 0); 7248 __ Mov(x0, 0);
7126 __ Mov(x1, literal_base); 7249 __ Mov(x1, literal_base);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
7203 CHECK(x10.Bit() == w10.Bit()); 7326 CHECK(x10.Bit() == w10.Bit());
7204 CHECK(jssp.Bit() == wjssp.Bit()); 7327 CHECK(jssp.Bit() == wjssp.Bit());
7205 CHECK(xzr.Bit() == wzr.Bit()); 7328 CHECK(xzr.Bit() == wzr.Bit());
7206 CHECK(csp.Bit() == wcsp.Bit()); 7329 CHECK(csp.Bit() == wcsp.Bit());
7207 } 7330 }
7208 7331
7209 7332
7210 TEST(stack_pointer_override) { 7333 TEST(stack_pointer_override) {
7211 // This test generates some stack maintenance code, but the test only checks 7334 // This test generates some stack maintenance code, but the test only checks
7212 // the reported state. 7335 // the reported state.
7336 INIT_V8();
7213 SETUP(); 7337 SETUP();
7214 START(); 7338 START();
7215 7339
7216 // The default stack pointer in V8 is jssp, but for compatibility with W16, 7340 // The default stack pointer in V8 is jssp, but for compatibility with W16,
7217 // the test framework sets it to csp before calling the test. 7341 // the test framework sets it to csp before calling the test.
7218 CHECK(csp.Is(__ StackPointer())); 7342 CHECK(csp.Is(__ StackPointer()));
7219 __ SetStackPointer(x0); 7343 __ SetStackPointer(x0);
7220 CHECK(x0.Is(__ StackPointer())); 7344 CHECK(x0.Is(__ StackPointer()));
7221 __ SetStackPointer(jssp); 7345 __ SetStackPointer(jssp);
7222 CHECK(jssp.Is(__ StackPointer())); 7346 CHECK(jssp.Is(__ StackPointer()));
7223 __ SetStackPointer(csp); 7347 __ SetStackPointer(csp);
7224 CHECK(csp.Is(__ StackPointer())); 7348 CHECK(csp.Is(__ StackPointer()));
7225 7349
7226 END(); 7350 END();
7227 RUN(); 7351 RUN();
7228 TEARDOWN(); 7352 TEARDOWN();
7229 } 7353 }
7230 7354
7231 7355
7232 TEST(peek_poke_simple) { 7356 TEST(peek_poke_simple) {
7357 INIT_V8();
7233 SETUP(); 7358 SETUP();
7234 START(); 7359 START();
7235 7360
7236 static const RegList x0_to_x3 = x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit(); 7361 static const RegList x0_to_x3 = x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit();
7237 static const RegList x10_to_x13 = x10.Bit() | x11.Bit() | 7362 static const RegList x10_to_x13 = x10.Bit() | x11.Bit() |
7238 x12.Bit() | x13.Bit(); 7363 x12.Bit() | x13.Bit();
7239 7364
7240 // The literal base is chosen to have two useful properties: 7365 // The literal base is chosen to have two useful properties:
7241 // * When multiplied by small values (such as a register index), this value 7366 // * When multiplied by small values (such as a register index), this value
7242 // is clearly readable in the result. 7367 // is clearly readable in the result.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
7289 ASSERT_EQUAL_64((literal_base * 1) & 0xffffffff, x10); 7414 ASSERT_EQUAL_64((literal_base * 1) & 0xffffffff, x10);
7290 ASSERT_EQUAL_64((literal_base * 2) & 0xffffffff, x11); 7415 ASSERT_EQUAL_64((literal_base * 2) & 0xffffffff, x11);
7291 ASSERT_EQUAL_64((literal_base * 3) & 0xffffffff, x12); 7416 ASSERT_EQUAL_64((literal_base * 3) & 0xffffffff, x12);
7292 ASSERT_EQUAL_64((literal_base * 4) & 0xffffffff, x13); 7417 ASSERT_EQUAL_64((literal_base * 4) & 0xffffffff, x13);
7293 7418
7294 TEARDOWN(); 7419 TEARDOWN();
7295 } 7420 }
7296 7421
7297 7422
7298 TEST(peek_poke_unaligned) { 7423 TEST(peek_poke_unaligned) {
7424 INIT_V8();
7299 SETUP(); 7425 SETUP();
7300 START(); 7426 START();
7301 7427
7302 // The literal base is chosen to have two useful properties: 7428 // The literal base is chosen to have two useful properties:
7303 // * When multiplied by small values (such as a register index), this value 7429 // * When multiplied by small values (such as a register index), this value
7304 // is clearly readable in the result. 7430 // is clearly readable in the result.
7305 // * The value is not formed from repeating fixed-size smaller values, so it 7431 // * The value is not formed from repeating fixed-size smaller values, so it
7306 // can be used to detect endianness-related errors. 7432 // can be used to detect endianness-related errors.
7307 uint64_t literal_base = 0x0100001000100101UL; 7433 uint64_t literal_base = 0x0100001000100101UL;
7308 7434
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
7368 7494
7369 ASSERT_EQUAL_64((literal_base * 1) & 0xffffffff, x10); 7495 ASSERT_EQUAL_64((literal_base * 1) & 0xffffffff, x10);
7370 ASSERT_EQUAL_64((literal_base * 2) & 0xffffffff, x11); 7496 ASSERT_EQUAL_64((literal_base * 2) & 0xffffffff, x11);
7371 ASSERT_EQUAL_64((literal_base * 3) & 0xffffffff, x12); 7497 ASSERT_EQUAL_64((literal_base * 3) & 0xffffffff, x12);
7372 7498
7373 TEARDOWN(); 7499 TEARDOWN();
7374 } 7500 }
7375 7501
7376 7502
7377 TEST(peek_poke_endianness) { 7503 TEST(peek_poke_endianness) {
7504 INIT_V8();
7378 SETUP(); 7505 SETUP();
7379 START(); 7506 START();
7380 7507
7381 // The literal base is chosen to have two useful properties: 7508 // The literal base is chosen to have two useful properties:
7382 // * When multiplied by small values (such as a register index), this value 7509 // * When multiplied by small values (such as a register index), this value
7383 // is clearly readable in the result. 7510 // is clearly readable in the result.
7384 // * The value is not formed from repeating fixed-size smaller values, so it 7511 // * The value is not formed from repeating fixed-size smaller values, so it
7385 // can be used to detect endianness-related errors. 7512 // can be used to detect endianness-related errors.
7386 uint64_t literal_base = 0x0100001000100101UL; 7513 uint64_t literal_base = 0x0100001000100101UL;
7387 7514
(...skipping 29 matching lines...) Expand all
7417 ASSERT_EQUAL_64(x0_expected, x0); 7544 ASSERT_EQUAL_64(x0_expected, x0);
7418 ASSERT_EQUAL_64(x1_expected, x1); 7545 ASSERT_EQUAL_64(x1_expected, x1);
7419 ASSERT_EQUAL_64(x4_expected, x4); 7546 ASSERT_EQUAL_64(x4_expected, x4);
7420 ASSERT_EQUAL_64(x5_expected, x5); 7547 ASSERT_EQUAL_64(x5_expected, x5);
7421 7548
7422 TEARDOWN(); 7549 TEARDOWN();
7423 } 7550 }
7424 7551
7425 7552
7426 TEST(peek_poke_mixed) { 7553 TEST(peek_poke_mixed) {
7554 INIT_V8();
7427 SETUP(); 7555 SETUP();
7428 START(); 7556 START();
7429 7557
7430 // The literal base is chosen to have two useful properties: 7558 // The literal base is chosen to have two useful properties:
7431 // * When multiplied by small values (such as a register index), this value 7559 // * When multiplied by small values (such as a register index), this value
7432 // is clearly readable in the result. 7560 // is clearly readable in the result.
7433 // * The value is not formed from repeating fixed-size smaller values, so it 7561 // * The value is not formed from repeating fixed-size smaller values, so it
7434 // can be used to detect endianness-related errors. 7562 // can be used to detect endianness-related errors.
7435 uint64_t literal_base = 0x0100001000100101UL; 7563 uint64_t literal_base = 0x0100001000100101UL;
7436 7564
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
7627 } else { 7755 } else {
7628 ASSERT_EQUAL_64(literal_base * i, x[i]); 7756 ASSERT_EQUAL_64(literal_base * i, x[i]);
7629 } 7757 }
7630 } 7758 }
7631 7759
7632 TEARDOWN(); 7760 TEARDOWN();
7633 } 7761 }
7634 7762
7635 7763
7636 TEST(push_pop_jssp_simple_32) { 7764 TEST(push_pop_jssp_simple_32) {
7765 INIT_V8();
7637 for (int claim = 0; claim <= 8; claim++) { 7766 for (int claim = 0; claim <= 8; claim++) {
7638 for (int count = 0; count <= 8; count++) { 7767 for (int count = 0; count <= 8; count++) {
7639 PushPopJsspSimpleHelper(count, claim, kWRegSize, 7768 PushPopJsspSimpleHelper(count, claim, kWRegSize,
7640 PushPopByFour, PushPopByFour); 7769 PushPopByFour, PushPopByFour);
7641 PushPopJsspSimpleHelper(count, claim, kWRegSize, 7770 PushPopJsspSimpleHelper(count, claim, kWRegSize,
7642 PushPopByFour, PushPopRegList); 7771 PushPopByFour, PushPopRegList);
7643 PushPopJsspSimpleHelper(count, claim, kWRegSize, 7772 PushPopJsspSimpleHelper(count, claim, kWRegSize,
7644 PushPopRegList, PushPopByFour); 7773 PushPopRegList, PushPopByFour);
7645 PushPopJsspSimpleHelper(count, claim, kWRegSize, 7774 PushPopJsspSimpleHelper(count, claim, kWRegSize,
7646 PushPopRegList, PushPopRegList); 7775 PushPopRegList, PushPopRegList);
7647 } 7776 }
7648 // Test with the maximum number of registers. 7777 // Test with the maximum number of registers.
7649 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, 7778 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize,
7650 PushPopByFour, PushPopByFour); 7779 PushPopByFour, PushPopByFour);
7651 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, 7780 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize,
7652 PushPopByFour, PushPopRegList); 7781 PushPopByFour, PushPopRegList);
7653 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, 7782 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize,
7654 PushPopRegList, PushPopByFour); 7783 PushPopRegList, PushPopByFour);
7655 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, 7784 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize,
7656 PushPopRegList, PushPopRegList); 7785 PushPopRegList, PushPopRegList);
7657 } 7786 }
7658 } 7787 }
7659 7788
7660 7789
7661 TEST(push_pop_jssp_simple_64) { 7790 TEST(push_pop_jssp_simple_64) {
7791 INIT_V8();
7662 for (int claim = 0; claim <= 8; claim++) { 7792 for (int claim = 0; claim <= 8; claim++) {
7663 for (int count = 0; count <= 8; count++) { 7793 for (int count = 0; count <= 8; count++) {
7664 PushPopJsspSimpleHelper(count, claim, kXRegSize, 7794 PushPopJsspSimpleHelper(count, claim, kXRegSize,
7665 PushPopByFour, PushPopByFour); 7795 PushPopByFour, PushPopByFour);
7666 PushPopJsspSimpleHelper(count, claim, kXRegSize, 7796 PushPopJsspSimpleHelper(count, claim, kXRegSize,
7667 PushPopByFour, PushPopRegList); 7797 PushPopByFour, PushPopRegList);
7668 PushPopJsspSimpleHelper(count, claim, kXRegSize, 7798 PushPopJsspSimpleHelper(count, claim, kXRegSize,
7669 PushPopRegList, PushPopByFour); 7799 PushPopRegList, PushPopByFour);
7670 PushPopJsspSimpleHelper(count, claim, kXRegSize, 7800 PushPopJsspSimpleHelper(count, claim, kXRegSize,
7671 PushPopRegList, PushPopRegList); 7801 PushPopRegList, PushPopRegList);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
7808 double expected; 7938 double expected;
7809 memcpy(&expected, &literal, sizeof(expected)); 7939 memcpy(&expected, &literal, sizeof(expected));
7810 ASSERT_EQUAL_FP64(expected, d[i]); 7940 ASSERT_EQUAL_FP64(expected, d[i]);
7811 } 7941 }
7812 7942
7813 TEARDOWN(); 7943 TEARDOWN();
7814 } 7944 }
7815 7945
7816 7946
7817 TEST(push_pop_fp_jssp_simple_32) { 7947 TEST(push_pop_fp_jssp_simple_32) {
7948 INIT_V8();
7818 for (int claim = 0; claim <= 8; claim++) { 7949 for (int claim = 0; claim <= 8; claim++) {
7819 for (int count = 0; count <= 8; count++) { 7950 for (int count = 0; count <= 8; count++) {
7820 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, 7951 PushPopFPJsspSimpleHelper(count, claim, kSRegSize,
7821 PushPopByFour, PushPopByFour); 7952 PushPopByFour, PushPopByFour);
7822 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, 7953 PushPopFPJsspSimpleHelper(count, claim, kSRegSize,
7823 PushPopByFour, PushPopRegList); 7954 PushPopByFour, PushPopRegList);
7824 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, 7955 PushPopFPJsspSimpleHelper(count, claim, kSRegSize,
7825 PushPopRegList, PushPopByFour); 7956 PushPopRegList, PushPopByFour);
7826 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, 7957 PushPopFPJsspSimpleHelper(count, claim, kSRegSize,
7827 PushPopRegList, PushPopRegList); 7958 PushPopRegList, PushPopRegList);
7828 } 7959 }
7829 // Test with the maximum number of registers. 7960 // Test with the maximum number of registers.
7830 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, 7961 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize,
7831 PushPopByFour, PushPopByFour); 7962 PushPopByFour, PushPopByFour);
7832 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, 7963 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize,
7833 PushPopByFour, PushPopRegList); 7964 PushPopByFour, PushPopRegList);
7834 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, 7965 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize,
7835 PushPopRegList, PushPopByFour); 7966 PushPopRegList, PushPopByFour);
7836 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, 7967 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize,
7837 PushPopRegList, PushPopRegList); 7968 PushPopRegList, PushPopRegList);
7838 } 7969 }
7839 } 7970 }
7840 7971
7841 7972
7842 TEST(push_pop_fp_jssp_simple_64) { 7973 TEST(push_pop_fp_jssp_simple_64) {
7974 INIT_V8();
7843 for (int claim = 0; claim <= 8; claim++) { 7975 for (int claim = 0; claim <= 8; claim++) {
7844 for (int count = 0; count <= 8; count++) { 7976 for (int count = 0; count <= 8; count++) {
7845 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, 7977 PushPopFPJsspSimpleHelper(count, claim, kDRegSize,
7846 PushPopByFour, PushPopByFour); 7978 PushPopByFour, PushPopByFour);
7847 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, 7979 PushPopFPJsspSimpleHelper(count, claim, kDRegSize,
7848 PushPopByFour, PushPopRegList); 7980 PushPopByFour, PushPopRegList);
7849 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, 7981 PushPopFPJsspSimpleHelper(count, claim, kDRegSize,
7850 PushPopRegList, PushPopByFour); 7982 PushPopRegList, PushPopByFour);
7851 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, 7983 PushPopFPJsspSimpleHelper(count, claim, kDRegSize,
7852 PushPopRegList, PushPopRegList); 7984 PushPopRegList, PushPopRegList);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
7947 ASSERT_EQUAL_64(literal_base * 0, x[7]); 8079 ASSERT_EQUAL_64(literal_base * 0, x[7]);
7948 ASSERT_EQUAL_64(literal_base * 3, x[6]); 8080 ASSERT_EQUAL_64(literal_base * 3, x[6]);
7949 ASSERT_EQUAL_64(literal_base * 1, x[5]); 8081 ASSERT_EQUAL_64(literal_base * 1, x[5]);
7950 ASSERT_EQUAL_64(literal_base * 2, x[4]); 8082 ASSERT_EQUAL_64(literal_base * 2, x[4]);
7951 8083
7952 TEARDOWN(); 8084 TEARDOWN();
7953 } 8085 }
7954 8086
7955 8087
7956 TEST(push_pop_jssp_mixed_methods_64) { 8088 TEST(push_pop_jssp_mixed_methods_64) {
8089 INIT_V8();
7957 for (int claim = 0; claim <= 8; claim++) { 8090 for (int claim = 0; claim <= 8; claim++) {
7958 PushPopJsspMixedMethodsHelper(claim, kXRegSize); 8091 PushPopJsspMixedMethodsHelper(claim, kXRegSize);
7959 } 8092 }
7960 } 8093 }
7961 8094
7962 8095
7963 TEST(push_pop_jssp_mixed_methods_32) { 8096 TEST(push_pop_jssp_mixed_methods_32) {
8097 INIT_V8();
7964 for (int claim = 0; claim <= 8; claim++) { 8098 for (int claim = 0; claim <= 8; claim++) {
7965 PushPopJsspMixedMethodsHelper(claim, kWRegSize); 8099 PushPopJsspMixedMethodsHelper(claim, kWRegSize);
7966 } 8100 }
7967 } 8101 }
7968 8102
7969 8103
7970 // Push and pop data using overlapping X- and W-sized quantities. 8104 // Push and pop data using overlapping X- and W-sized quantities.
7971 static void PushPopJsspWXOverlapHelper(int reg_count, int claim) { 8105 static void PushPopJsspWXOverlapHelper(int reg_count, int claim) {
7972 // This test emits rather a lot of code. 8106 // This test emits rather a lot of code.
7973 SETUP_SIZE(BUF_SIZE * 2); 8107 SETUP_SIZE(BUF_SIZE * 2);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
8149 ASSERT_EQUAL_64(expected, x[i]); 8283 ASSERT_EQUAL_64(expected, x[i]);
8150 } 8284 }
8151 } 8285 }
8152 ASSERT(slot == requested_w_slots); 8286 ASSERT(slot == requested_w_slots);
8153 8287
8154 TEARDOWN(); 8288 TEARDOWN();
8155 } 8289 }
8156 8290
8157 8291
8158 TEST(push_pop_jssp_wx_overlap) { 8292 TEST(push_pop_jssp_wx_overlap) {
8293 INIT_V8();
8159 for (int claim = 0; claim <= 8; claim++) { 8294 for (int claim = 0; claim <= 8; claim++) {
8160 for (int count = 1; count <= 8; count++) { 8295 for (int count = 1; count <= 8; count++) {
8161 PushPopJsspWXOverlapHelper(count, claim); 8296 PushPopJsspWXOverlapHelper(count, claim);
8162 PushPopJsspWXOverlapHelper(count, claim); 8297 PushPopJsspWXOverlapHelper(count, claim);
8163 PushPopJsspWXOverlapHelper(count, claim); 8298 PushPopJsspWXOverlapHelper(count, claim);
8164 PushPopJsspWXOverlapHelper(count, claim); 8299 PushPopJsspWXOverlapHelper(count, claim);
8165 } 8300 }
8166 // Test with the maximum number of registers. 8301 // Test with the maximum number of registers.
8167 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); 8302 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim);
8168 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); 8303 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim);
8169 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); 8304 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim);
8170 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); 8305 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim);
8171 } 8306 }
8172 } 8307 }
8173 8308
8174 8309
8175 TEST(push_pop_csp) { 8310 TEST(push_pop_csp) {
8311 INIT_V8();
8176 SETUP(); 8312 SETUP();
8177 8313
8178 START(); 8314 START();
8179 8315
8180 ASSERT(csp.Is(__ StackPointer())); 8316 ASSERT(csp.Is(__ StackPointer()));
8181 8317
8182 __ Mov(x3, 0x3333333333333333UL); 8318 __ Mov(x3, 0x3333333333333333UL);
8183 __ Mov(x2, 0x2222222222222222UL); 8319 __ Mov(x2, 0x2222222222222222UL);
8184 __ Mov(x1, 0x1111111111111111UL); 8320 __ Mov(x1, 0x1111111111111111UL);
8185 __ Mov(x0, 0x0000000000000000UL); 8321 __ Mov(x0, 0x0000000000000000UL);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
8254 8390
8255 ASSERT_EQUAL_32(0x33333333U, w25); 8391 ASSERT_EQUAL_32(0x33333333U, w25);
8256 ASSERT_EQUAL_32(0x00000000U, w27); 8392 ASSERT_EQUAL_32(0x00000000U, w27);
8257 ASSERT_EQUAL_32(0x22222222U, w28); 8393 ASSERT_EQUAL_32(0x22222222U, w28);
8258 ASSERT_EQUAL_32(0x33333333U, w29); 8394 ASSERT_EQUAL_32(0x33333333U, w29);
8259 TEARDOWN(); 8395 TEARDOWN();
8260 } 8396 }
8261 8397
8262 8398
8263 TEST(jump_both_smi) { 8399 TEST(jump_both_smi) {
8400 INIT_V8();
8264 SETUP(); 8401 SETUP();
8265 8402
8266 Label cond_pass_00, cond_pass_01, cond_pass_10, cond_pass_11; 8403 Label cond_pass_00, cond_pass_01, cond_pass_10, cond_pass_11;
8267 Label cond_fail_00, cond_fail_01, cond_fail_10, cond_fail_11; 8404 Label cond_fail_00, cond_fail_01, cond_fail_10, cond_fail_11;
8268 Label return1, return2, return3, done; 8405 Label return1, return2, return3, done;
8269 8406
8270 START(); 8407 START();
8271 8408
8272 __ Mov(x0, 0x5555555500000001UL); // A pointer. 8409 __ Mov(x0, 0x5555555500000001UL); // A pointer.
8273 __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer. 8410 __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
8326 ASSERT_EQUAL_64(0, x4); 8463 ASSERT_EQUAL_64(0, x4);
8327 ASSERT_EQUAL_64(0, x5); 8464 ASSERT_EQUAL_64(0, x5);
8328 ASSERT_EQUAL_64(0, x6); 8465 ASSERT_EQUAL_64(0, x6);
8329 ASSERT_EQUAL_64(1, x7); 8466 ASSERT_EQUAL_64(1, x7);
8330 8467
8331 TEARDOWN(); 8468 TEARDOWN();
8332 } 8469 }
8333 8470
8334 8471
8335 TEST(jump_either_smi) { 8472 TEST(jump_either_smi) {
8473 INIT_V8();
8336 SETUP(); 8474 SETUP();
8337 8475
8338 Label cond_pass_00, cond_pass_01, cond_pass_10, cond_pass_11; 8476 Label cond_pass_00, cond_pass_01, cond_pass_10, cond_pass_11;
8339 Label cond_fail_00, cond_fail_01, cond_fail_10, cond_fail_11; 8477 Label cond_fail_00, cond_fail_01, cond_fail_10, cond_fail_11;
8340 Label return1, return2, return3, done; 8478 Label return1, return2, return3, done;
8341 8479
8342 START(); 8480 START();
8343 8481
8344 __ Mov(x0, 0x5555555500000001UL); // A pointer. 8482 __ Mov(x0, 0x5555555500000001UL); // A pointer.
8345 __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer. 8483 __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
8741 CHECK(fpreg64.PopHighestIndex().IsNone()); 8879 CHECK(fpreg64.PopHighestIndex().IsNone());
8742 8880
8743 CHECK(reg32.IsEmpty()); 8881 CHECK(reg32.IsEmpty());
8744 CHECK(reg64.IsEmpty()); 8882 CHECK(reg64.IsEmpty());
8745 CHECK(fpreg32.IsEmpty()); 8883 CHECK(fpreg32.IsEmpty());
8746 CHECK(fpreg64.IsEmpty()); 8884 CHECK(fpreg64.IsEmpty());
8747 } 8885 }
8748 8886
8749 8887
8750 TEST(printf) { 8888 TEST(printf) {
8889 INIT_V8();
8751 SETUP(); 8890 SETUP();
8752 START(); 8891 START();
8753 8892
8754 char const * test_plain_string = "Printf with no arguments.\n"; 8893 char const * test_plain_string = "Printf with no arguments.\n";
8755 char const * test_substring = "'This is a substring.'"; 8894 char const * test_substring = "'This is a substring.'";
8756 RegisterDump before; 8895 RegisterDump before;
8757 8896
8758 // Initialize x29 to the value of the stack pointer. We will use x29 as a 8897 // Initialize x29 to the value of the stack pointer. We will use x29 as a
8759 // temporary stack pointer later, and initializing it in this way allows the 8898 // temporary stack pointer later, and initializing it in this way allows the
8760 // RegisterDump check to pass. 8899 // RegisterDump check to pass.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
8831 // Printf preserves all registers by default, we can't look at the number of 8970 // Printf preserves all registers by default, we can't look at the number of
8832 // bytes that were printed. However, the printf_no_preserve test should check 8971 // bytes that were printed. However, the printf_no_preserve test should check
8833 // that, and here we just test that we didn't clobber any registers. 8972 // that, and here we just test that we didn't clobber any registers.
8834 ASSERT_EQUAL_REGISTERS(before); 8973 ASSERT_EQUAL_REGISTERS(before);
8835 8974
8836 TEARDOWN(); 8975 TEARDOWN();
8837 } 8976 }
8838 8977
8839 8978
8840 TEST(printf_no_preserve) { 8979 TEST(printf_no_preserve) {
8980 INIT_V8();
8841 SETUP(); 8981 SETUP();
8842 START(); 8982 START();
8843 8983
8844 char const * test_plain_string = "Printf with no arguments.\n"; 8984 char const * test_plain_string = "Printf with no arguments.\n";
8845 char const * test_substring = "'This is a substring.'"; 8985 char const * test_substring = "'This is a substring.'";
8846 8986
8847 __ PrintfNoPreserve(test_plain_string); // NOLINT(runtime/printf) 8987 __ PrintfNoPreserve(test_plain_string); // NOLINT(runtime/printf)
8848 __ Mov(x19, x0); 8988 __ Mov(x19, x0);
8849 8989
8850 // Test simple integer arguments. 8990 // Test simple integer arguments.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
9001 for (unsigned j = 0; j < i; j++) { 9141 for (unsigned j = 0; j < i; j++) {
9002 CHECK(src[j] == dst[i][j]); 9142 CHECK(src[j] == dst[i][j]);
9003 } 9143 }
9004 delete [] dst[i]; 9144 delete [] dst[i];
9005 } 9145 }
9006 } 9146 }
9007 9147
9008 9148
9009 // This is a V8-specific test. 9149 // This is a V8-specific test.
9010 TEST(copyfields) { 9150 TEST(copyfields) {
9151 INIT_V8();
9011 CopyFieldsHelper(CPURegList(x10)); 9152 CopyFieldsHelper(CPURegList(x10));
9012 CopyFieldsHelper(CPURegList(x10, x11)); 9153 CopyFieldsHelper(CPURegList(x10, x11));
9013 CopyFieldsHelper(CPURegList(x10, x11, x12)); 9154 CopyFieldsHelper(CPURegList(x10, x11, x12));
9014 CopyFieldsHelper(CPURegList(x10, x11, x12, x13)); 9155 CopyFieldsHelper(CPURegList(x10, x11, x12, x13));
9015 } 9156 }
9016 9157
9017 9158
9018 static void DoSmiAbsTest(int32_t value, bool must_fail = false) { 9159 static void DoSmiAbsTest(int32_t value, bool must_fail = false) {
9019 SETUP(); 9160 SETUP();
9020 9161
(...skipping 24 matching lines...) Expand all
9045 9186
9046 // Check that we didn't jump on slow. 9187 // Check that we didn't jump on slow.
9047 ASSERT_EQUAL_64(0xc001c0de, x2); 9188 ASSERT_EQUAL_64(0xc001c0de, x2);
9048 } 9189 }
9049 9190
9050 TEARDOWN(); 9191 TEARDOWN();
9051 } 9192 }
9052 9193
9053 9194
9054 TEST(smi_abs) { 9195 TEST(smi_abs) {
9196 INIT_V8();
9055 // Simple and edge cases. 9197 // Simple and edge cases.
9056 DoSmiAbsTest(0); 9198 DoSmiAbsTest(0);
9057 DoSmiAbsTest(0x12345); 9199 DoSmiAbsTest(0x12345);
9058 DoSmiAbsTest(0x40000000); 9200 DoSmiAbsTest(0x40000000);
9059 DoSmiAbsTest(0x7fffffff); 9201 DoSmiAbsTest(0x7fffffff);
9060 DoSmiAbsTest(-1); 9202 DoSmiAbsTest(-1);
9061 DoSmiAbsTest(-12345); 9203 DoSmiAbsTest(-12345);
9062 DoSmiAbsTest(0x80000001); 9204 DoSmiAbsTest(0x80000001);
9063 9205
9064 // Check that the most negative SMI is detected. 9206 // Check that the most negative SMI is detected.
9065 DoSmiAbsTest(0x80000000, true); 9207 DoSmiAbsTest(0x80000000, true);
9066 } 9208 }
9067 9209
9068 9210
9069 TEST(blr_lr) { 9211 TEST(blr_lr) {
9070 // A simple test to check that the simulator correcty handle "blr lr". 9212 // A simple test to check that the simulator correcty handle "blr lr".
9213 INIT_V8();
9071 SETUP(); 9214 SETUP();
9072 9215
9073 START(); 9216 START();
9074 Label target; 9217 Label target;
9075 Label end; 9218 Label end;
9076 9219
9077 __ Mov(x0, 0x0); 9220 __ Mov(x0, 0x0);
9078 __ Adr(lr, &target); 9221 __ Adr(lr, &target);
9079 9222
9080 __ Blr(lr); 9223 __ Blr(lr);
9081 __ Mov(x0, 0xdeadbeef); 9224 __ Mov(x0, 0xdeadbeef);
9082 __ B(&end); 9225 __ B(&end);
9083 9226
9084 __ Bind(&target); 9227 __ Bind(&target);
9085 __ Mov(x0, 0xc001c0de); 9228 __ Mov(x0, 0xc001c0de);
9086 9229
9087 __ Bind(&end); 9230 __ Bind(&end);
9088 END(); 9231 END();
9089 9232
9090 RUN(); 9233 RUN();
9091 9234
9092 ASSERT_EQUAL_64(0xc001c0de, x0); 9235 ASSERT_EQUAL_64(0xc001c0de, x0);
9093 9236
9094 TEARDOWN(); 9237 TEARDOWN();
9095 } 9238 }
9096 9239
9097 9240
9098 TEST(barriers) { 9241 TEST(barriers) {
9099 // Generate all supported barriers, this is just a smoke test 9242 // Generate all supported barriers, this is just a smoke test
9243 INIT_V8();
9100 SETUP(); 9244 SETUP();
9101 9245
9102 START(); 9246 START();
9103 9247
9104 // DMB 9248 // DMB
9105 __ Dmb(FullSystem, BarrierAll); 9249 __ Dmb(FullSystem, BarrierAll);
9106 __ Dmb(FullSystem, BarrierReads); 9250 __ Dmb(FullSystem, BarrierReads);
9107 __ Dmb(FullSystem, BarrierWrites); 9251 __ Dmb(FullSystem, BarrierWrites);
9108 __ Dmb(FullSystem, BarrierOther); 9252 __ Dmb(FullSystem, BarrierOther);
9109 9253
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
9151 RUN(); 9295 RUN();
9152 9296
9153 TEARDOWN(); 9297 TEARDOWN();
9154 } 9298 }
9155 9299
9156 9300
9157 TEST(call_no_relocation) { 9301 TEST(call_no_relocation) {
9158 Address call_start; 9302 Address call_start;
9159 Address return_address; 9303 Address return_address;
9160 9304
9305 INIT_V8();
9161 SETUP(); 9306 SETUP();
9162 9307
9163 START(); 9308 START();
9164 9309
9165 Label function; 9310 Label function;
9166 Label test; 9311 Label test;
9167 9312
9168 __ B(&test); 9313 __ B(&test);
9169 9314
9170 __ Bind(&function); 9315 __ Bind(&function);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
9220 9365
9221 ASSERT_EQUAL_32(expected, w0); 9366 ASSERT_EQUAL_32(expected, w0);
9222 ASSERT_EQUAL_64(expected64, x1); 9367 ASSERT_EQUAL_64(expected64, x1);
9223 ASSERT_EQUAL_64(expected64 << kSmiShift | kSmiTag, x2); 9368 ASSERT_EQUAL_64(expected64 << kSmiShift | kSmiTag, x2);
9224 9369
9225 TEARDOWN(); 9370 TEARDOWN();
9226 } 9371 }
9227 9372
9228 9373
9229 TEST(ecma_262_to_int32) { 9374 TEST(ecma_262_to_int32) {
9375 INIT_V8();
9230 // ==== exponent < 64 ==== 9376 // ==== exponent < 64 ====
9231 9377
9232 ECMA262ToInt32Helper(0, 0.0); 9378 ECMA262ToInt32Helper(0, 0.0);
9233 ECMA262ToInt32Helper(0, -0.0); 9379 ECMA262ToInt32Helper(0, -0.0);
9234 ECMA262ToInt32Helper(1, 1.0); 9380 ECMA262ToInt32Helper(1, 1.0);
9235 ECMA262ToInt32Helper(-1, -1.0); 9381 ECMA262ToInt32Helper(-1, -1.0);
9236 9382
9237 // The largest representable value that is less than 1. 9383 // The largest representable value that is less than 1.
9238 ECMA262ToInt32Helper(0, 0x001fffffffffffff * pow(2, -53)); 9384 ECMA262ToInt32Helper(0, 0x001fffffffffffff * pow(2, -53));
9239 ECMA262ToInt32Helper(0, 0x001fffffffffffff * -pow(2, -53)); 9385 ECMA262ToInt32Helper(0, 0x001fffffffffffff * -pow(2, -53));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
9404 ASSERT_EQUAL_32(expected, w10); 9550 ASSERT_EQUAL_32(expected, w10);
9405 ASSERT_EQUAL_32(expected, w11); 9551 ASSERT_EQUAL_32(expected, w11);
9406 ASSERT_EQUAL_32(expected, w12); 9552 ASSERT_EQUAL_32(expected, w12);
9407 ASSERT_EQUAL_32(expected, w13); 9553 ASSERT_EQUAL_32(expected, w13);
9408 9554
9409 TEARDOWN(); 9555 TEARDOWN();
9410 } 9556 }
9411 9557
9412 9558
9413 TEST(abs) { 9559 TEST(abs) {
9560 INIT_V8();
9414 AbsHelperX(0); 9561 AbsHelperX(0);
9415 AbsHelperX(42); 9562 AbsHelperX(42);
9416 AbsHelperX(-42); 9563 AbsHelperX(-42);
9417 AbsHelperX(kXMinInt); 9564 AbsHelperX(kXMinInt);
9418 AbsHelperX(kXMaxInt); 9565 AbsHelperX(kXMaxInt);
9419 9566
9420 AbsHelperW(0); 9567 AbsHelperW(0);
9421 AbsHelperW(42); 9568 AbsHelperW(42);
9422 AbsHelperW(-42); 9569 AbsHelperW(-42);
9423 AbsHelperW(kWMinInt); 9570 AbsHelperW(kWMinInt);
9424 AbsHelperW(kWMaxInt); 9571 AbsHelperW(kWMaxInt);
9425 } 9572 }
9426 9573
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