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

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

Issue 10542167: Inline Math.sqrt in new compilers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
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_X64) 6 #if defined(TARGET_ARCH_X64)
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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 1270
1271 1271
1272 ASSEMBLER_TEST_RUN(TestNot, entry) { 1272 ASSEMBLER_TEST_RUN(TestNot, entry) {
1273 typedef int (*TestNot)(); 1273 typedef int (*TestNot)();
1274 unsigned int res = reinterpret_cast<TestNot>(entry)(); 1274 unsigned int res = reinterpret_cast<TestNot>(entry)();
1275 EXPECT_EQ(0xFFFFFFFF, res); 1275 EXPECT_EQ(0xFFFFFFFF, res);
1276 } 1276 }
1277 1277
1278 1278
1279 ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) { 1279 ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) {
1280 __ movsd(XMM0, Address(RSP, kWordSize)); 1280 __ pushq(RAX);
1281 __ xorpd(XMM0, Address(RSP, kWordSize)); 1281 __ movsd(Address(RSP, 0), XMM0);
1282 __ movq(RAX, Immediate(999)); 1282 __ xorpd(XMM0, Address(RSP, 0));
1283 __ popq(RAX);
1283 __ ret(); 1284 __ ret();
1284 } 1285 }
1285 1286
1286 1287
1287 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) { 1288 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) {
1288 typedef double (*XorpdZeroingCode)(double d); 1289 typedef double (*XorpdZeroingCode)(double d);
1289 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3); 1290 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3);
1290 EXPECT_FLOAT_EQ(0.0, res, 0.0001); 1291 EXPECT_FLOAT_EQ(0.0, res, 0.0001);
1291 } 1292 }
1292 1293
1294
1295 ASSEMBLER_TEST_GENERATE(SquareRootDouble, assembler) {
1296 __ sqrtsd(XMM0, XMM0);
1297 __ ret();
1298 }
1299
1300
1301 ASSEMBLER_TEST_RUN(SquareRootDouble, entry) {
1302 typedef double (*SquareRootDoubleCode)(double d);
1303 const double kDoubleConst = .7;
1304 double res = reinterpret_cast<SquareRootDoubleCode>(entry)(kDoubleConst);
1305 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001);
1306 }
1307
1293 } // namespace dart 1308 } // namespace dart
1294 1309
1295 #endif // defined TARGET_ARCH_X64 1310 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698