OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 | 45 |
46 static void DummyStaticFunction(Object* result) { | 46 static void DummyStaticFunction(Object* result) { |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 TEST(DisasmIa320) { | 50 TEST(DisasmIa320) { |
51 CcTest::InitializeVM(); | 51 CcTest::InitializeVM(); |
52 Isolate* isolate = CcTest::i_isolate(); | 52 Isolate* isolate = CcTest::i_isolate(); |
53 HandleScope scope(isolate); | 53 HandleScope scope(isolate); |
54 v8::internal::byte buffer[4096]; | 54 v8::internal::byte buffer[8192]; |
55 Assembler assm(isolate, buffer, sizeof buffer); | 55 Assembler assm(isolate, buffer, sizeof buffer); |
56 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) | 56 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) |
57 // Short immediate instructions | 57 // Short immediate instructions |
58 __ adc(eax, 12345678); | 58 __ adc(eax, 12345678); |
59 __ add(eax, Immediate(12345678)); | 59 __ add(eax, Immediate(12345678)); |
60 __ or_(eax, 12345678); | 60 __ or_(eax, 12345678); |
61 __ sub(eax, Immediate(12345678)); | 61 __ sub(eax, Immediate(12345678)); |
62 __ xor_(eax, 12345678); | 62 __ xor_(eax, 12345678); |
63 __ and_(eax, 12345678); | 63 __ and_(eax, 12345678); |
64 Handle<FixedArray> foo = isolate->factory()->NewFixedArray(10, TENURED); | 64 Handle<FixedArray> foo = isolate->factory()->NewFixedArray(10, TENURED); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 __ pslld(xmm0, 17); | 488 __ pslld(xmm0, 17); |
489 __ psrlw(xmm0, 17); | 489 __ psrlw(xmm0, 17); |
490 __ psrld(xmm0, 17); | 490 __ psrld(xmm0, 17); |
491 __ psraw(xmm0, 17); | 491 __ psraw(xmm0, 17); |
492 __ psrad(xmm0, 17); | 492 __ psrad(xmm0, 17); |
493 __ psllq(xmm0, 17); | 493 __ psllq(xmm0, 17); |
494 __ psllq(xmm0, xmm1); | 494 __ psllq(xmm0, xmm1); |
495 __ psrlq(xmm0, 17); | 495 __ psrlq(xmm0, 17); |
496 __ psrlq(xmm0, xmm1); | 496 __ psrlq(xmm0, xmm1); |
497 | 497 |
| 498 __ pshuflw(xmm5, xmm1, 5); |
| 499 __ pshuflw(xmm5, Operand(edx, 4), 5); |
498 __ pshufd(xmm5, xmm1, 5); | 500 __ pshufd(xmm5, xmm1, 5); |
499 __ pshufd(xmm5, Operand(edx, 4), 5); | 501 __ pshufd(xmm5, Operand(edx, 4), 5); |
500 __ pinsrw(xmm5, edx, 5); | 502 __ pinsrw(xmm5, edx, 5); |
501 __ pinsrw(xmm5, Operand(edx, 4), 5); | 503 __ pinsrw(xmm5, Operand(edx, 4), 5); |
502 | 504 |
503 #define EMIT_SSE2_INSTR(instruction, notUsed1, notUsed2, notUsed3) \ | 505 #define EMIT_SSE2_INSTR(instruction, notUsed1, notUsed2, notUsed3) \ |
504 __ instruction(xmm5, xmm1); \ | 506 __ instruction(xmm5, xmm1); \ |
505 __ instruction(xmm5, Operand(edx, 4)); | 507 __ instruction(xmm5, Operand(edx, 4)); |
506 | 508 |
507 SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR) | 509 SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR) |
(...skipping 14 matching lines...) Expand all Loading... |
522 __ cmov(not_sign, eax, Operand(ecx, 1)); | 524 __ cmov(not_sign, eax, Operand(ecx, 1)); |
523 __ cmov(parity_even, eax, Operand(ecx, 2)); | 525 __ cmov(parity_even, eax, Operand(ecx, 2)); |
524 __ cmov(parity_odd, eax, Operand(ecx, 3)); | 526 __ cmov(parity_odd, eax, Operand(ecx, 3)); |
525 __ cmov(less, eax, Operand(edx, 0)); | 527 __ cmov(less, eax, Operand(edx, 0)); |
526 __ cmov(greater_equal, eax, Operand(edx, 1)); | 528 __ cmov(greater_equal, eax, Operand(edx, 1)); |
527 __ cmov(less_equal, eax, Operand(edx, 2)); | 529 __ cmov(less_equal, eax, Operand(edx, 2)); |
528 __ cmov(greater, eax, Operand(edx, 3)); | 530 __ cmov(greater, eax, Operand(edx, 3)); |
529 } | 531 } |
530 | 532 |
531 { | 533 { |
| 534 if (CpuFeatures::IsSupported(SSSE3)) { |
| 535 CpuFeatureScope scope(&assm, SSSE3); |
| 536 __ pshufb(xmm5, xmm1); |
| 537 __ pshufb(xmm5, Operand(edx, 4)); |
| 538 } |
| 539 } |
| 540 |
| 541 { |
532 if (CpuFeatures::IsSupported(SSE4_1)) { | 542 if (CpuFeatures::IsSupported(SSE4_1)) { |
533 CpuFeatureScope scope(&assm, SSE4_1); | 543 CpuFeatureScope scope(&assm, SSE4_1); |
| 544 __ pextrb(eax, xmm0, 1); |
| 545 __ pextrb(Operand(edx, 4), xmm0, 1); |
| 546 __ pextrw(eax, xmm0, 1); |
| 547 __ pextrw(Operand(edx, 4), xmm0, 1); |
534 __ pextrd(eax, xmm0, 1); | 548 __ pextrd(eax, xmm0, 1); |
535 __ pextrd(Operand(edx, 4), xmm0, 1); | 549 __ pextrd(Operand(edx, 4), xmm0, 1); |
| 550 __ pinsrb(xmm1, eax, 0); |
| 551 __ pinsrb(xmm1, Operand(edx, 4), 0); |
536 __ pinsrd(xmm1, eax, 0); | 552 __ pinsrd(xmm1, eax, 0); |
537 __ pinsrd(xmm1, Operand(edx, 4), 0); | 553 __ pinsrd(xmm1, Operand(edx, 4), 0); |
538 __ extractps(eax, xmm1, 0); | 554 __ extractps(eax, xmm1, 0); |
539 | 555 |
540 #define EMIT_SSE4_INSTR(instruction, notUsed1, notUsed2, notUsed3, notUsed4) \ | 556 #define EMIT_SSE4_INSTR(instruction, notUsed1, notUsed2, notUsed3, notUsed4) \ |
541 __ instruction(xmm5, xmm1); \ | 557 __ instruction(xmm5, xmm1); \ |
542 __ instruction(xmm5, Operand(edx, 4)); | 558 __ instruction(xmm5, Operand(edx, 4)); |
543 | 559 |
544 SSE4_INSTRUCTION_LIST(EMIT_SSE4_INSTR) | 560 SSE4_INSTRUCTION_LIST(EMIT_SSE4_INSTR) |
545 #undef EMIT_SSE4_INSTR | 561 #undef EMIT_SSE4_INSTR |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 __ vmaxpd(xmm0, xmm1, xmm2); | 639 __ vmaxpd(xmm0, xmm1, xmm2); |
624 __ vmaxpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); | 640 __ vmaxpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
625 | 641 |
626 __ vpsllw(xmm0, xmm7, 21); | 642 __ vpsllw(xmm0, xmm7, 21); |
627 __ vpslld(xmm0, xmm7, 21); | 643 __ vpslld(xmm0, xmm7, 21); |
628 __ vpsrlw(xmm0, xmm7, 21); | 644 __ vpsrlw(xmm0, xmm7, 21); |
629 __ vpsrld(xmm0, xmm7, 21); | 645 __ vpsrld(xmm0, xmm7, 21); |
630 __ vpsraw(xmm0, xmm7, 21); | 646 __ vpsraw(xmm0, xmm7, 21); |
631 __ vpsrad(xmm0, xmm7, 21); | 647 __ vpsrad(xmm0, xmm7, 21); |
632 | 648 |
| 649 __ vpshufb(xmm5, xmm0, xmm1); |
| 650 __ vpshufb(xmm5, xmm0, Operand(edx, 4)); |
| 651 __ vpshuflw(xmm5, xmm1, 5); |
| 652 __ vpshuflw(xmm5, Operand(edx, 4), 5); |
633 __ vpshufd(xmm5, xmm1, 5); | 653 __ vpshufd(xmm5, xmm1, 5); |
634 __ vpshufd(xmm5, Operand(edx, 4), 5); | 654 __ vpshufd(xmm5, Operand(edx, 4), 5); |
| 655 __ vpextrb(eax, xmm0, 1); |
| 656 __ vpextrb(Operand(edx, 4), xmm0, 1); |
| 657 __ vpextrw(eax, xmm0, 1); |
| 658 __ vpextrw(Operand(edx, 4), xmm0, 1); |
635 __ vpextrd(eax, xmm0, 1); | 659 __ vpextrd(eax, xmm0, 1); |
636 __ vpextrd(Operand(edx, 4), xmm0, 1); | 660 __ vpextrd(Operand(edx, 4), xmm0, 1); |
| 661 __ vpinsrb(xmm0, xmm1, eax, 0); |
| 662 __ vpinsrb(xmm0, xmm1, Operand(edx, 4), 0); |
| 663 __ vpinsrw(xmm0, xmm1, eax, 0); |
| 664 __ vpinsrw(xmm0, xmm1, Operand(edx, 4), 0); |
637 __ vpinsrd(xmm0, xmm1, eax, 0); | 665 __ vpinsrd(xmm0, xmm1, eax, 0); |
638 __ vpinsrd(xmm0, xmm1, Operand(edx, 4), 0); | 666 __ vpinsrd(xmm0, xmm1, Operand(edx, 4), 0); |
639 | 667 |
640 __ vcvtdq2ps(xmm1, xmm0); | 668 __ vcvtdq2ps(xmm1, xmm0); |
641 __ vcvtdq2ps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 669 __ vcvtdq2ps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
642 __ vcvttps2dq(xmm1, xmm0); | 670 __ vcvttps2dq(xmm1, xmm0); |
643 __ vcvttps2dq(xmm1, Operand(ebx, ecx, times_4, 10000)); | 671 __ vcvttps2dq(xmm1, Operand(ebx, ecx, times_4, 10000)); |
644 | 672 |
645 __ vmovd(xmm0, edi); | 673 __ vmovd(xmm0, edi); |
646 __ vmovd(xmm0, Operand(ebx, ecx, times_4, 10000)); | 674 __ vmovd(xmm0, Operand(ebx, ecx, times_4, 10000)); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 #ifdef OBJECT_PRINT | 854 #ifdef OBJECT_PRINT |
827 OFStream os(stdout); | 855 OFStream os(stdout); |
828 code->Print(os); | 856 code->Print(os); |
829 byte* begin = code->instruction_start(); | 857 byte* begin = code->instruction_start(); |
830 byte* end = begin + code->instruction_size(); | 858 byte* end = begin + code->instruction_size(); |
831 disasm::Disassembler::Disassemble(stdout, begin, end); | 859 disasm::Disassembler::Disassemble(stdout, begin, end); |
832 #endif | 860 #endif |
833 } | 861 } |
834 | 862 |
835 #undef __ | 863 #undef __ |
OLD | NEW |