| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 | 2043 |
| 2044 ASSEMBLER_TEST_RUN(IntToDoubleConversion2, test) { | 2044 ASSEMBLER_TEST_RUN(IntToDoubleConversion2, test) { |
| 2045 typedef double (*IntToDoubleConversion2Code)(int i); | 2045 typedef double (*IntToDoubleConversion2Code)(int i); |
| 2046 double res = reinterpret_cast<IntToDoubleConversion2Code>(test->entry())(3); | 2046 double res = reinterpret_cast<IntToDoubleConversion2Code>(test->entry())(3); |
| 2047 EXPECT_FLOAT_EQ(3.0, res, 0.001); | 2047 EXPECT_FLOAT_EQ(3.0, res, 0.001); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 | 2050 |
| 2051 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { |
| 2052 __ movl(EAX, Immediate(0)); |
| 2053 __ movl(EDX, Immediate(6)); |
| 2054 __ pushl(EAX); |
| 2055 __ pushl(EDX); |
| 2056 __ fildl(Address(ESP, 0)); |
| 2057 __ popl(EAX); |
| 2058 __ popl(EAX); |
| 2059 __ ret(); |
| 2060 } |
| 2061 |
| 2062 |
| 2063 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) { |
| 2064 typedef double (*Int64ToDoubleConversionCode)(); |
| 2065 double res = reinterpret_cast<Int64ToDoubleConversionCode>(test->entry())(); |
| 2066 EXPECT_EQ(6.0, res); |
| 2067 } |
| 2068 |
| 2069 |
| 2070 ASSEMBLER_TEST_GENERATE(NegativeInt64ToDoubleConversion, assembler) { |
| 2071 __ movl(EAX, Immediate(0xFFFFFFFF)); |
| 2072 __ movl(EDX, Immediate(0xFFFFFFFA)); |
| 2073 __ pushl(EAX); |
| 2074 __ pushl(EDX); |
| 2075 __ fildl(Address(ESP, 0)); |
| 2076 __ popl(EAX); |
| 2077 __ popl(EAX); |
| 2078 __ ret(); |
| 2079 } |
| 2080 |
| 2081 |
| 2082 ASSEMBLER_TEST_RUN(NegativeInt64ToDoubleConversion, test) { |
| 2083 typedef double (*NegativeInt64ToDoubleConversionCode)(); |
| 2084 double res = |
| 2085 reinterpret_cast<NegativeInt64ToDoubleConversionCode>(test->entry())(); |
| 2086 EXPECT_EQ(-6.0, res); |
| 2087 } |
| 2088 |
| 2089 |
| 2051 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { | 2090 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { |
| 2052 __ movl(EDX, Immediate(6)); | 2091 __ movl(EDX, Immediate(6)); |
| 2053 __ cvtsi2ss(XMM1, EDX); | 2092 __ cvtsi2ss(XMM1, EDX); |
| 2054 __ pushl(EAX); | 2093 __ pushl(EAX); |
| 2055 __ movss(Address(ESP, 0), XMM1); | 2094 __ movss(Address(ESP, 0), XMM1); |
| 2056 __ flds(Address(ESP, 0)); | 2095 __ flds(Address(ESP, 0)); |
| 2057 __ popl(EAX); | 2096 __ popl(EAX); |
| 2058 __ ret(); | 2097 __ ret(); |
| 2059 } | 2098 } |
| 2060 | 2099 |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 | 3380 |
| 3342 ASSEMBLER_TEST_RUN(BitTest, test) { | 3381 ASSEMBLER_TEST_RUN(BitTest, test) { |
| 3343 typedef int (*BitTest)(); | 3382 typedef int (*BitTest)(); |
| 3344 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); | 3383 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); |
| 3345 } | 3384 } |
| 3346 | 3385 |
| 3347 | 3386 |
| 3348 } // namespace dart | 3387 } // namespace dart |
| 3349 | 3388 |
| 3350 #endif // defined TARGET_ARCH_IA32 | 3389 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |