OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 #endif | 669 #endif |
670 | 670 |
671 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 671 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
672 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); | 672 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); |
673 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); | 673 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); |
674 uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678); | 674 uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678); |
675 CHECK_EQ(0x87654321, f(uint64_to_double(value2))); | 675 CHECK_EQ(0x87654321, f(uint64_to_double(value2))); |
676 } | 676 } |
677 | 677 |
678 | 678 |
| 679 typedef int (*F6)(float x, float y); |
| 680 TEST(AssemblerX64SSE) { |
| 681 CcTest::InitializeVM(); |
| 682 |
| 683 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
| 684 HandleScope scope(isolate); |
| 685 v8::internal::byte buffer[256]; |
| 686 MacroAssembler assm(isolate, buffer, sizeof buffer); |
| 687 { |
| 688 __ shufps(xmm0, xmm0, 0x0); // brocast first argument |
| 689 __ shufps(xmm1, xmm1, 0x0); // brocast second argument |
| 690 __ movaps(xmm2, xmm1); |
| 691 __ addps(xmm2, xmm0); |
| 692 __ mulps(xmm2, xmm1); |
| 693 __ subps(xmm2, xmm0); |
| 694 __ divps(xmm2, xmm1); |
| 695 __ cvttss2si(rax, xmm2); |
| 696 __ ret(0); |
| 697 } |
| 698 |
| 699 CodeDesc desc; |
| 700 assm.GetCode(&desc); |
| 701 Code* code = Code::cast(isolate->heap()->CreateCode( |
| 702 desc, |
| 703 Code::ComputeFlags(Code::STUB), |
| 704 Handle<Code>())->ToObjectChecked()); |
| 705 CHECK(code->IsCode()); |
| 706 #ifdef OBJECT_PRINT |
| 707 Code::cast(code)->Print(); |
| 708 #endif |
| 709 |
| 710 F6 f = FUNCTION_CAST<F6>(Code::cast(code)->entry()); |
| 711 CHECK_EQ(2, f(1.0, 2.0)); |
| 712 } |
679 #undef __ | 713 #undef __ |
OLD | NEW |