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

Side by Side Diff: runtime/vm/assembler_ia32_test.cc

Issue 9320023: Intrinisifed more core library methods: isNaN, isNegative, cos, sin. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 961 }
962 962
963 963
964 ASSEMBLER_TEST_RUN(IntToDoubleConversion, entry) { 964 ASSEMBLER_TEST_RUN(IntToDoubleConversion, entry) {
965 typedef double (*IntToDoubleConversionCode)(); 965 typedef double (*IntToDoubleConversionCode)();
966 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); 966 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)();
967 EXPECT_FLOAT_EQ(6.0, res, 0.001); 967 EXPECT_FLOAT_EQ(6.0, res, 0.001);
968 } 968 }
969 969
970 970
971 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion2, assembler) {
972 __ filds(Address(ESP, kWordSize));
973 __ ret();
974 }
975
976
977 ASSEMBLER_TEST_RUN(IntToDoubleConversion2, entry) {
978 typedef double (*IntToDoubleConversion2Code)(int i);
979 double res = reinterpret_cast<IntToDoubleConversion2Code>(entry)(3);
980 EXPECT_FLOAT_EQ(3.0, res, 0.001);
981 }
982
983
971 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { 984 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) {
972 __ movl(EDX, Immediate(6)); 985 __ movl(EDX, Immediate(6));
973 __ cvtsi2ss(XMM1, EDX); 986 __ cvtsi2ss(XMM1, EDX);
974 __ pushl(EAX); 987 __ pushl(EAX);
975 __ movss(Address(ESP, 0), XMM1); 988 __ movss(Address(ESP, 0), XMM1);
976 __ flds(Address(ESP, 0)); 989 __ flds(Address(ESP, 0));
977 __ popl(EAX); 990 __ popl(EAX);
978 __ ret(); 991 __ ret();
979 } 992 }
980 993
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 typedef double (*DoubleAbsCode)(double d); 1659 typedef double (*DoubleAbsCode)(double d);
1647 double val = -12.45; 1660 double val = -12.45;
1648 double res = reinterpret_cast<DoubleAbsCode>(entry)(val); 1661 double res = reinterpret_cast<DoubleAbsCode>(entry)(val);
1649 EXPECT_FLOAT_EQ(-val, res, 0.001); 1662 EXPECT_FLOAT_EQ(-val, res, 0.001);
1650 val = 12.45; 1663 val = 12.45;
1651 res = reinterpret_cast<DoubleAbsCode>(entry)(val); 1664 res = reinterpret_cast<DoubleAbsCode>(entry)(val);
1652 EXPECT_FLOAT_EQ(val, res, 0.001); 1665 EXPECT_FLOAT_EQ(val, res, 0.001);
1653 } 1666 }
1654 1667
1655 1668
1669 ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) {
1670 __ movsd(XMM0, Address(ESP, kWordSize));
1671 __ movmskpd(EAX, XMM0);
1672 __ ret();
1673 }
1674
1675
1676 ASSEMBLER_TEST_RUN(ExtractSignBits, entry) {
1677 typedef int (*ExtractSignBits)(double d);
1678 int res = reinterpret_cast<ExtractSignBits>(entry)(1.0);
1679 EXPECT_EQ(0, res);
1680 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0);
1681 EXPECT_EQ(1, res);
1682 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0);
1683 EXPECT_EQ(1, res);
1684 }
1685
1686
1656 // Return -1 if signed, 1 if not signed and 0 otherwise. 1687 // Return -1 if signed, 1 if not signed and 0 otherwise.
1657 ASSEMBLER_TEST_GENERATE(ConditionalMovesSign, assembler) { 1688 ASSEMBLER_TEST_GENERATE(ConditionalMovesSign, assembler) {
1658 // Preserve clobbered callee-saved register (EBX). 1689 // Preserve clobbered callee-saved register (EBX).
1659 __ pushl(EBX); 1690 __ pushl(EBX);
1660 1691
1661 __ movl(EDX, Address(ESP, 2 * kWordSize)); 1692 __ movl(EDX, Address(ESP, 2 * kWordSize));
1662 __ xorl(EAX, EAX); 1693 __ xorl(EAX, EAX);
1663 __ movl(EBX, Immediate(1)); 1694 __ movl(EBX, Immediate(1));
1664 __ movl(ECX, Immediate(-1)); 1695 __ movl(ECX, Immediate(-1));
1665 __ testl(EDX, EDX); 1696 __ testl(EDX, EDX);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) { 1833 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) {
1803 typedef int (*TestAlignLarge)(); 1834 typedef int (*TestAlignLarge)();
1804 int res = reinterpret_cast<TestAlignLarge>(entry)(); 1835 int res = reinterpret_cast<TestAlignLarge>(entry)();
1805 EXPECT_EQ(16, res); // 16 bytes emitted. 1836 EXPECT_EQ(16, res); // 16 bytes emitted.
1806 } 1837 }
1807 1838
1808 1839
1809 } // namespace dart 1840 } // namespace dart
1810 1841
1811 #endif // defined TARGET_ARCH_IA32 1842 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698