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[2048]; | 54 v8::internal::byte buffer[4096]; |
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 | 57 |
58 // Short immediate instructions | 58 // Short immediate instructions |
59 __ adc(eax, 12345678); | 59 __ adc(eax, 12345678); |
60 __ add(eax, Immediate(12345678)); | 60 __ add(eax, Immediate(12345678)); |
61 __ or_(eax, 12345678); | 61 __ or_(eax, 12345678); |
62 __ sub(eax, Immediate(12345678)); | 62 __ sub(eax, Immediate(12345678)); |
63 __ xor_(eax, 12345678); | 63 __ xor_(eax, 12345678); |
64 __ and_(eax, 12345678); | 64 __ and_(eax, 12345678); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 // logic operation | 395 // logic operation |
396 __ andps(xmm0, xmm1); | 396 __ andps(xmm0, xmm1); |
397 __ andps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 397 __ andps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
398 __ orps(xmm0, xmm1); | 398 __ orps(xmm0, xmm1); |
399 __ orps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 399 __ orps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
400 __ xorps(xmm0, xmm1); | 400 __ xorps(xmm0, xmm1); |
401 __ xorps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 401 __ xorps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
402 | 402 |
403 // Arithmetic operation | 403 // Arithmetic operation |
| 404 __ addss(xmm1, xmm0); |
| 405 __ addss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 406 __ mulss(xmm1, xmm0); |
| 407 __ mulss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 408 __ subss(xmm1, xmm0); |
| 409 __ subss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 410 __ divss(xmm1, xmm0); |
| 411 __ divss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
404 __ addps(xmm1, xmm0); | 412 __ addps(xmm1, xmm0); |
405 __ addps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 413 __ addps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
406 __ subps(xmm1, xmm0); | 414 __ subps(xmm1, xmm0); |
407 __ subps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 415 __ subps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
408 __ mulps(xmm1, xmm0); | 416 __ mulps(xmm1, xmm0); |
409 __ mulps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 417 __ mulps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
410 __ divps(xmm1, xmm0); | 418 __ divps(xmm1, xmm0); |
411 __ divps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 419 __ divps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 420 |
| 421 __ ucomiss(xmm0, xmm1); |
| 422 __ ucomiss(xmm0, Operand(ebx, ecx, times_4, 10000)); |
412 } | 423 } |
413 { | 424 { |
414 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); | 425 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); |
415 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 426 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
416 __ cvtss2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 427 __ cvtss2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
417 __ cvtss2sd(xmm1, xmm0); | 428 __ cvtss2sd(xmm1, xmm0); |
418 __ movsd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 429 __ movsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
419 __ movsd(Operand(ebx, ecx, times_4, 10000), xmm1); | 430 __ movsd(Operand(ebx, ecx, times_4, 10000), xmm1); |
420 // 128 bit move instructions. | 431 // 128 bit move instructions. |
421 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); | 432 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 __ vaddsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); | 490 __ vaddsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
480 __ vmulsd(xmm0, xmm1, xmm2); | 491 __ vmulsd(xmm0, xmm1, xmm2); |
481 __ vmulsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); | 492 __ vmulsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
482 __ vsubsd(xmm0, xmm1, xmm2); | 493 __ vsubsd(xmm0, xmm1, xmm2); |
483 __ vsubsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); | 494 __ vsubsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
484 __ vdivsd(xmm0, xmm1, xmm2); | 495 __ vdivsd(xmm0, xmm1, xmm2); |
485 __ vdivsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); | 496 __ vdivsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
486 } | 497 } |
487 } | 498 } |
488 | 499 |
| 500 // FMA3 instruction |
| 501 { |
| 502 if (CpuFeatures::IsSupported(FMA3)) { |
| 503 CpuFeatureScope scope(&assm, FMA3); |
| 504 __ vfmadd132sd(xmm0, xmm1, xmm2); |
| 505 __ vfmadd132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 506 __ vfmadd213sd(xmm0, xmm1, xmm2); |
| 507 __ vfmadd213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 508 __ vfmadd231sd(xmm0, xmm1, xmm2); |
| 509 __ vfmadd231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 510 |
| 511 __ vfmsub132sd(xmm0, xmm1, xmm2); |
| 512 __ vfmsub132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 513 __ vfmsub213sd(xmm0, xmm1, xmm2); |
| 514 __ vfmsub213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 515 __ vfmsub231sd(xmm0, xmm1, xmm2); |
| 516 __ vfmsub231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 517 |
| 518 __ vfnmadd132sd(xmm0, xmm1, xmm2); |
| 519 __ vfnmadd132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 520 __ vfnmadd213sd(xmm0, xmm1, xmm2); |
| 521 __ vfnmadd213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 522 __ vfnmadd231sd(xmm0, xmm1, xmm2); |
| 523 __ vfnmadd231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 524 |
| 525 __ vfnmsub132sd(xmm0, xmm1, xmm2); |
| 526 __ vfnmsub132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 527 __ vfnmsub213sd(xmm0, xmm1, xmm2); |
| 528 __ vfnmsub213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 529 __ vfnmsub231sd(xmm0, xmm1, xmm2); |
| 530 __ vfnmsub231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 531 |
| 532 __ vfmadd132ss(xmm0, xmm1, xmm2); |
| 533 __ vfmadd132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 534 __ vfmadd213ss(xmm0, xmm1, xmm2); |
| 535 __ vfmadd213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 536 __ vfmadd231ss(xmm0, xmm1, xmm2); |
| 537 __ vfmadd231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 538 |
| 539 __ vfmsub132ss(xmm0, xmm1, xmm2); |
| 540 __ vfmsub132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 541 __ vfmsub213ss(xmm0, xmm1, xmm2); |
| 542 __ vfmsub213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 543 __ vfmsub231ss(xmm0, xmm1, xmm2); |
| 544 __ vfmsub231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 545 |
| 546 __ vfnmadd132ss(xmm0, xmm1, xmm2); |
| 547 __ vfnmadd132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 548 __ vfnmadd213ss(xmm0, xmm1, xmm2); |
| 549 __ vfnmadd213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 550 __ vfnmadd231ss(xmm0, xmm1, xmm2); |
| 551 __ vfnmadd231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 552 |
| 553 __ vfnmsub132ss(xmm0, xmm1, xmm2); |
| 554 __ vfnmsub132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 555 __ vfnmsub213ss(xmm0, xmm1, xmm2); |
| 556 __ vfnmsub213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 557 __ vfnmsub231ss(xmm0, xmm1, xmm2); |
| 558 __ vfnmsub231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 559 } |
| 560 } |
| 561 |
489 // xchg. | 562 // xchg. |
490 { | 563 { |
491 __ xchg(eax, eax); | 564 __ xchg(eax, eax); |
492 __ xchg(eax, ebx); | 565 __ xchg(eax, ebx); |
493 __ xchg(ebx, ebx); | 566 __ xchg(ebx, ebx); |
494 __ xchg(ebx, Operand(esp, 12)); | 567 __ xchg(ebx, Operand(esp, 12)); |
495 } | 568 } |
496 | 569 |
497 // Nop instructions | 570 // Nop instructions |
498 for (int i = 0; i < 16; i++) { | 571 for (int i = 0; i < 16; i++) { |
(...skipping 10 matching lines...) Expand all Loading... |
509 #ifdef OBJECT_PRINT | 582 #ifdef OBJECT_PRINT |
510 OFStream os(stdout); | 583 OFStream os(stdout); |
511 code->Print(os); | 584 code->Print(os); |
512 byte* begin = code->instruction_start(); | 585 byte* begin = code->instruction_start(); |
513 byte* end = begin + code->instruction_size(); | 586 byte* end = begin + code->instruction_size(); |
514 disasm::Disassembler::Disassemble(stdout, begin, end); | 587 disasm::Disassembler::Disassemble(stdout, begin, end); |
515 #endif | 588 #endif |
516 } | 589 } |
517 | 590 |
518 #undef __ | 591 #undef __ |
OLD | NEW |