| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 | 2620 |
| 2621 ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { | 2621 ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { |
| 2622 typedef int (*ConditionalMovesSignCode)(int i); | 2622 typedef int (*ConditionalMovesSignCode)(int i); |
| 2623 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); | 2623 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); |
| 2624 EXPECT_EQ(1, res); | 2624 EXPECT_EQ(1, res); |
| 2625 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); | 2625 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); |
| 2626 EXPECT_EQ(-1, res); | 2626 EXPECT_EQ(-1, res); |
| 2627 } | 2627 } |
| 2628 | 2628 |
| 2629 | 2629 |
| 2630 ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { |
| 2631 __ movl(EDX, Immediate(1)); // Greater equal. |
| 2632 __ movl(ECX, Immediate(-1)); // Less |
| 2633 __ movl(EAX, Address(ESP, 1 * kWordSize)); |
| 2634 __ cmpl(EAX, Address(ESP, 2 * kWordSize)); |
| 2635 __ cmovlessl(EAX, ECX); |
| 2636 __ cmovgel(EAX, EDX); |
| 2637 __ ret(); |
| 2638 } |
| 2639 |
| 2640 |
| 2641 ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) { |
| 2642 typedef int (*ConditionalMovesCompareCode)(int i, int i); |
| 2643 int res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(10, 5); |
| 2644 EXPECT_EQ(1, res); // Greater equal. |
| 2645 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); |
| 2646 EXPECT_EQ(1, res); // Greater equal. |
| 2647 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); |
| 2648 EXPECT_EQ(-1, res); // Less. |
| 2649 } |
| 2650 |
| 2651 |
| 2630 ASSEMBLER_TEST_GENERATE(TestLoadDoubleConstant, assembler) { | 2652 ASSEMBLER_TEST_GENERATE(TestLoadDoubleConstant, assembler) { |
| 2631 __ LoadDoubleConstant(XMM3, -12.34); | 2653 __ LoadDoubleConstant(XMM3, -12.34); |
| 2632 __ pushl(EAX); | 2654 __ pushl(EAX); |
| 2633 __ pushl(EAX); | 2655 __ pushl(EAX); |
| 2634 __ movsd(Address(ESP, 0), XMM3); | 2656 __ movsd(Address(ESP, 0), XMM3); |
| 2635 __ fldl(Address(ESP, 0)); | 2657 __ fldl(Address(ESP, 0)); |
| 2636 __ popl(EAX); | 2658 __ popl(EAX); |
| 2637 __ popl(EAX); | 2659 __ popl(EAX); |
| 2638 __ ret(); | 2660 __ ret(); |
| 2639 } | 2661 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 FieldAddress(ECX, GrowableObjectArray::data_offset()), | 2828 FieldAddress(ECX, GrowableObjectArray::data_offset()), |
| 2807 EAX); | 2829 EAX); |
| 2808 __ popl(EAX); | 2830 __ popl(EAX); |
| 2809 __ popl(CTX); | 2831 __ popl(CTX); |
| 2810 __ ret(); | 2832 __ ret(); |
| 2811 } | 2833 } |
| 2812 | 2834 |
| 2813 } // namespace dart | 2835 } // namespace dart |
| 2814 | 2836 |
| 2815 #endif // defined TARGET_ARCH_IA32 | 2837 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |