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_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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { | 1237 ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { |
1238 __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f))); | 1238 __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f))); |
1239 __ movd(XMM0, RAX); | 1239 __ movd(XMM0, RAX); |
1240 __ movss(XMM1, XMM0); | 1240 __ movss(XMM1, XMM0); |
1241 __ movss(XMM2, XMM1); | 1241 __ movss(XMM2, XMM1); |
1242 __ movss(XMM3, XMM2); | 1242 __ movss(XMM3, XMM2); |
1243 __ movss(XMM4, XMM3); | 1243 __ movss(XMM4, XMM3); |
1244 __ movss(XMM5, XMM4); | 1244 __ movss(XMM5, XMM4); |
1245 __ movss(XMM6, XMM5); | 1245 __ movss(XMM6, XMM5); |
1246 __ movss(XMM7, XMM6); | 1246 __ movss(XMM7, XMM6); |
| 1247 __ movss(XMM8, XMM7); |
| 1248 __ movss(XMM9, XMM8); |
| 1249 __ movss(XMM10, XMM9); |
| 1250 __ movss(XMM11, XMM10); |
| 1251 __ movss(XMM12, XMM11); |
| 1252 __ movss(XMM13, XMM12); |
| 1253 __ movss(XMM14, XMM13); |
| 1254 __ movss(XMM15, XMM14); |
1247 __ pushq(R15); // Callee saved. | 1255 __ pushq(R15); // Callee saved. |
1248 __ pushq(RAX); | 1256 __ pushq(RAX); |
1249 __ movq(Address(RSP, 0), Immediate(0)); | 1257 __ movq(Address(RSP, 0), Immediate(0)); |
1250 __ movss(XMM0, Address(RSP, 0)); | 1258 __ movss(XMM0, Address(RSP, 0)); |
1251 __ movss(Address(RSP, 0), XMM7); | 1259 __ movss(Address(RSP, 0), XMM7); |
1252 __ movss(XMM1, Address(RSP, 0)); | 1260 __ movss(XMM1, Address(RSP, 0)); |
1253 __ movq(R10, RSP); | 1261 __ movq(R10, RSP); |
1254 __ movss(Address(R10, 0), XMM1); | 1262 __ movss(Address(R10, 0), XMM1); |
1255 __ movss(XMM2, Address(R10, 0)); | 1263 __ movss(XMM2, Address(R10, 0)); |
1256 __ movq(R15, RSP); | 1264 __ movq(R15, RSP); |
1257 __ movss(Address(R15, 0), XMM2); | 1265 __ movss(Address(R15, 0), XMM2); |
1258 __ movss(XMM3, Address(R15, 0)); | 1266 __ movss(XMM3, Address(R15, 0)); |
1259 __ movq(RAX, RSP); | 1267 __ movq(RAX, RSP); |
1260 __ movss(Address(RAX, 0), XMM3); | 1268 __ movss(Address(RAX, 0), XMM3); |
1261 __ movss(XMM4, Address(RAX, 0)); | 1269 __ movss(XMM1, Address(RAX, 0)); |
1262 __ movss(XMM0, Address(RAX, 0)); | 1270 __ movss(XMM15, Address(RAX, 0)); |
| 1271 __ movss(XMM14, XMM15); |
| 1272 __ movss(XMM13, XMM14); |
| 1273 __ movss(XMM12, XMM13); |
| 1274 __ movss(XMM11, XMM12); |
| 1275 __ movss(XMM10, XMM11); |
| 1276 __ movss(XMM9, XMM10); |
| 1277 __ movss(XMM8, XMM9); |
| 1278 __ movss(XMM7, XMM8); |
| 1279 __ movss(XMM6, XMM7); |
| 1280 __ movss(XMM5, XMM6); |
| 1281 __ movss(XMM4, XMM5); |
| 1282 __ movss(XMM3, XMM4); |
| 1283 __ movss(XMM2, XMM3); |
| 1284 __ movss(XMM1, XMM2); |
| 1285 __ movss(XMM0, XMM1); |
1263 __ popq(RAX); | 1286 __ popq(RAX); |
1264 __ popq(R15); // Callee saved. | 1287 __ popq(R15); // Callee saved. |
1265 __ ret(); | 1288 __ ret(); |
1266 } | 1289 } |
1267 | 1290 |
1268 | 1291 |
1269 ASSEMBLER_TEST_RUN(SingleFPMoves, entry) { | 1292 ASSEMBLER_TEST_RUN(SingleFPMoves, entry) { |
1270 typedef float (*SingleFPMovesCode)(); | 1293 typedef float (*SingleFPMovesCode)(); |
1271 EXPECT_EQ(234, reinterpret_cast<SingleFPMovesCode>(entry)()); | 1294 EXPECT_EQ(234, reinterpret_cast<SingleFPMovesCode>(entry)()); |
1272 } | 1295 } |
1273 | 1296 |
1274 | 1297 |
1275 ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { | 1298 ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { |
1276 __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f))); | 1299 __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f))); |
1277 __ movd(XMM0, RAX); | 1300 __ movd(XMM0, RAX); |
1278 __ movss(XMM1, XMM0); | 1301 __ movd(XMM8, RAX); |
| 1302 __ movss(XMM1, XMM8); |
1279 __ pushq(RAX); | 1303 __ pushq(RAX); |
1280 __ movq(Address(RSP, 0), Immediate(0)); | 1304 __ movq(Address(RSP, 0), Immediate(0)); |
1281 __ movss(XMM0, Address(RSP, 0)); | 1305 __ movss(XMM0, Address(RSP, 0)); |
1282 __ movss(Address(RSP, 0), XMM1); | 1306 __ movss(Address(RSP, 0), XMM1); |
1283 __ movss(XMM0, Address(RSP, 0)); | 1307 __ movss(XMM0, Address(RSP, 0)); |
| 1308 __ movq(Address(RSP, 0), Immediate(0)); |
| 1309 __ movss(XMM9, XMM8); |
| 1310 __ movss(Address(RSP, 0), XMM9); |
| 1311 __ movss(XMM8, Address(RSP, 0)); |
| 1312 __ movss(XMM0, XMM8); |
1284 __ popq(RAX); | 1313 __ popq(RAX); |
1285 __ ret(); | 1314 __ ret(); |
1286 } | 1315 } |
1287 | 1316 |
1288 | 1317 |
1289 ASSEMBLER_TEST_RUN(SingleFPMoves2, entry) { | 1318 ASSEMBLER_TEST_RUN(SingleFPMoves2, entry) { |
1290 typedef float (*SingleFPMoves2Code)(); | 1319 typedef float (*SingleFPMoves2Code)(); |
1291 EXPECT_EQ(234, reinterpret_cast<SingleFPMoves2Code>(entry)()); | 1320 EXPECT_EQ(234, reinterpret_cast<SingleFPMoves2Code>(entry)()); |
1292 } | 1321 } |
1293 | 1322 |
1294 | 1323 |
1295 ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { | 1324 ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { |
1296 __ pushq(RBX); | 1325 __ pushq(RBX); |
1297 __ pushq(RCX); | 1326 __ pushq(RCX); |
1298 __ movq(RBX, Immediate(bit_cast<int32_t, float>(12.3f))); | 1327 __ movq(RBX, Immediate(bit_cast<int32_t, float>(12.3f))); |
1299 __ movd(XMM0, RBX); | 1328 __ movd(XMM0, RBX); |
| 1329 __ movd(XMM8, RBX); |
1300 __ movq(RCX, Immediate(bit_cast<int32_t, float>(3.4f))); | 1330 __ movq(RCX, Immediate(bit_cast<int32_t, float>(3.4f))); |
1301 __ movd(XMM1, RCX); | 1331 __ movd(XMM1, RCX); |
| 1332 __ movd(XMM9, RCX); |
1302 __ addss(XMM0, XMM1); // 15.7f | 1333 __ addss(XMM0, XMM1); // 15.7f |
1303 __ mulss(XMM0, XMM1); // 53.38f | 1334 __ mulss(XMM0, XMM1); // 53.38f |
1304 __ subss(XMM0, XMM1); // 49.98f | 1335 __ subss(XMM0, XMM1); // 49.98f |
1305 __ divss(XMM0, XMM1); // 14.7f | 1336 __ divss(XMM0, XMM1); // 14.7f |
| 1337 __ addss(XMM8, XMM9); // 15.7f |
| 1338 __ mulss(XMM8, XMM9); // 53.38f |
| 1339 __ subss(XMM8, XMM9); // 49.98f |
| 1340 __ divss(XMM8, XMM9); // 14.7f |
| 1341 __ subss(XMM0, XMM8); // 0.0f |
1306 __ popq(RCX); | 1342 __ popq(RCX); |
1307 __ popq(RBX); | 1343 __ popq(RBX); |
1308 __ ret(); | 1344 __ ret(); |
1309 } | 1345 } |
1310 | 1346 |
1311 | 1347 |
1312 ASSEMBLER_TEST_RUN(SingleFPOperations, entry) { | 1348 ASSEMBLER_TEST_RUN(SingleFPOperations, entry) { |
1313 typedef float (*SingleFPOperationsCode)(); | 1349 typedef float (*SingleFPOperationsCode)(); |
1314 float res = reinterpret_cast<SingleFPOperationsCode>(entry)(); | 1350 float res = reinterpret_cast<SingleFPOperationsCode>(entry)(); |
1315 EXPECT_FLOAT_EQ(14.7f, res, 0.001f); | 1351 EXPECT_FLOAT_EQ(0.0f, res, 0.001f); |
1316 } | 1352 } |
1317 | 1353 |
1318 | 1354 |
1319 ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { | 1355 ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { |
1320 __ movq(RAX, Immediate(bit_cast<int64_t, double>(1024.67))); | 1356 __ movq(RAX, Immediate(bit_cast<int64_t, double>(1024.67))); |
1321 __ pushq(R15); // Callee saved. | 1357 __ pushq(R15); // Callee saved. |
1322 __ pushq(RAX); | 1358 __ pushq(RAX); |
1323 __ movsd(XMM0, Address(RSP, 0)); | 1359 __ movsd(XMM0, Address(RSP, 0)); |
1324 __ movsd(XMM1, XMM0); | 1360 __ movsd(XMM1, XMM0); |
1325 __ movsd(XMM2, XMM1); | 1361 __ movsd(XMM2, XMM1); |
1326 __ movsd(XMM3, XMM2); | 1362 __ movsd(XMM3, XMM2); |
1327 __ movsd(XMM4, XMM3); | 1363 __ movsd(XMM4, XMM3); |
1328 __ movsd(XMM5, XMM4); | 1364 __ movsd(XMM5, XMM4); |
1329 __ movsd(XMM6, XMM5); | 1365 __ movsd(XMM6, XMM5); |
1330 __ movsd(XMM7, XMM6); | 1366 __ movsd(XMM7, XMM6); |
| 1367 __ movsd(XMM8, XMM7); |
| 1368 __ movsd(XMM9, XMM8); |
| 1369 __ movsd(XMM10, XMM9); |
| 1370 __ movsd(XMM11, XMM10); |
| 1371 __ movsd(XMM12, XMM11); |
| 1372 __ movsd(XMM13, XMM12); |
| 1373 __ movsd(XMM14, XMM13); |
| 1374 __ movsd(XMM15, XMM14); |
1331 __ movq(Address(RSP, 0), Immediate(0)); | 1375 __ movq(Address(RSP, 0), Immediate(0)); |
1332 __ movsd(XMM0, Address(RSP, 0)); | 1376 __ movsd(XMM0, Address(RSP, 0)); |
1333 __ movsd(Address(RSP, 0), XMM7); | 1377 __ movsd(Address(RSP, 0), XMM15); |
1334 __ movsd(XMM1, Address(RSP, 0)); | 1378 __ movsd(XMM1, Address(RSP, 0)); |
1335 __ movq(R10, RSP); | 1379 __ movq(R10, RSP); |
1336 __ movsd(Address(R10, 0), XMM1); | 1380 __ movsd(Address(R10, 0), XMM1); |
1337 __ movsd(XMM2, Address(R10, 0)); | 1381 __ movsd(XMM2, Address(R10, 0)); |
1338 __ movq(R15, RSP); | 1382 __ movq(R15, RSP); |
1339 __ movsd(Address(R15, 0), XMM2); | 1383 __ movsd(Address(R15, 0), XMM2); |
1340 __ movsd(XMM3, Address(R15, 0)); | 1384 __ movsd(XMM3, Address(R15, 0)); |
1341 __ movq(RAX, RSP); | 1385 __ movq(RAX, RSP); |
1342 __ movsd(Address(RAX, 0), XMM3); | 1386 __ movsd(Address(RAX, 0), XMM3); |
1343 __ movsd(XMM4, Address(RAX, 0)); | 1387 __ movsd(XMM4, Address(RAX, 0)); |
1344 __ movsd(XMM7, Address(RSP, 0)); | 1388 __ movsd(XMM15, Address(RSP, 0)); |
| 1389 __ movaps(XMM14, XMM15); |
| 1390 __ movaps(XMM13, XMM14); |
| 1391 __ movaps(XMM12, XMM13); |
| 1392 __ movaps(XMM11, XMM12); |
| 1393 __ movaps(XMM10, XMM11); |
| 1394 __ movaps(XMM9, XMM10); |
| 1395 __ movaps(XMM8, XMM9); |
| 1396 __ movaps(XMM7, XMM8); |
1345 __ movaps(XMM6, XMM7); | 1397 __ movaps(XMM6, XMM7); |
1346 __ movaps(XMM5, XMM6); | 1398 __ movaps(XMM5, XMM6); |
1347 __ movaps(XMM4, XMM5); | 1399 __ movaps(XMM4, XMM5); |
1348 __ movaps(XMM3, XMM4); | 1400 __ movaps(XMM3, XMM4); |
1349 __ movaps(XMM2, XMM3); | 1401 __ movaps(XMM2, XMM3); |
1350 __ movaps(XMM1, XMM2); | 1402 __ movaps(XMM1, XMM2); |
1351 __ movaps(XMM0, XMM1); | 1403 __ movaps(XMM0, XMM1); |
1352 __ popq(RAX); | 1404 __ popq(RAX); |
1353 __ popq(R15); // Callee saved. | 1405 __ popq(R15); // Callee saved. |
1354 __ ret(); | 1406 __ ret(); |
1355 } | 1407 } |
1356 | 1408 |
1357 | 1409 |
1358 ASSEMBLER_TEST_RUN(DoubleFPMoves, entry) { | 1410 ASSEMBLER_TEST_RUN(DoubleFPMoves, entry) { |
1359 typedef double (*DoubleFPMovesCode)(); | 1411 typedef double (*DoubleFPMovesCode)(); |
1360 EXPECT_FLOAT_EQ(1024.67, reinterpret_cast<DoubleFPMovesCode>(entry)(), 0.001); | 1412 EXPECT_FLOAT_EQ(1024.67, reinterpret_cast<DoubleFPMovesCode>(entry)(), 0.001); |
1361 } | 1413 } |
1362 | 1414 |
1363 | 1415 |
1364 ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { | 1416 ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { |
1365 __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3))); | 1417 __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3))); |
1366 __ pushq(RAX); | 1418 __ pushq(RAX); |
1367 __ movsd(XMM0, Address(RSP, 0)); | 1419 __ movsd(XMM0, Address(RSP, 0)); |
| 1420 __ movsd(XMM8, Address(RSP, 0)); |
1368 __ movq(RAX, Immediate(bit_cast<int64_t, double>(3.4))); | 1421 __ movq(RAX, Immediate(bit_cast<int64_t, double>(3.4))); |
1369 __ movq(Address(RSP, 0), RAX); | 1422 __ movq(Address(RSP, 0), RAX); |
| 1423 __ movsd(XMM12, Address(RSP, 0)); |
| 1424 __ addsd(XMM8, XMM12); // 15.7 |
| 1425 __ mulsd(XMM8, XMM12); // 53.38 |
| 1426 __ subsd(XMM8, XMM12); // 49.98 |
| 1427 __ divsd(XMM8, XMM12); // 14.7 |
| 1428 __ sqrtsd(XMM8, XMM8); // 3.834 |
1370 __ movsd(XMM1, Address(RSP, 0)); | 1429 __ movsd(XMM1, Address(RSP, 0)); |
1371 __ addsd(XMM0, XMM1); // 15.7 | 1430 __ addsd(XMM0, XMM1); // 15.7 |
1372 __ mulsd(XMM0, XMM1); // 53.38 | 1431 __ mulsd(XMM0, XMM1); // 53.38 |
1373 __ subsd(XMM0, XMM1); // 49.98 | 1432 __ subsd(XMM0, XMM1); // 49.98 |
1374 __ divsd(XMM0, XMM1); // 14.7 | 1433 __ divsd(XMM0, XMM1); // 14.7 |
| 1434 __ sqrtsd(XMM0, XMM0); // 3.834057902 |
| 1435 __ addsd(XMM0, XMM8); // 7.6681 |
1375 __ popq(RAX); | 1436 __ popq(RAX); |
1376 __ ret(); | 1437 __ ret(); |
1377 } | 1438 } |
1378 | 1439 |
1379 | 1440 |
1380 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { | 1441 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { |
1381 typedef double (*SingleFPOperationsCode)(); | 1442 typedef double (*SingleFPOperationsCode)(); |
1382 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); | 1443 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); |
1383 EXPECT_FLOAT_EQ(14.7, res, 0.001); | 1444 EXPECT_FLOAT_EQ(7.668, res, 0.001); |
1384 } | 1445 } |
1385 | 1446 |
1386 | 1447 |
1387 ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { | 1448 ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { |
1388 __ movl(RDX, Immediate(6)); | 1449 __ movl(RDX, Immediate(6)); |
1389 __ cvtsi2sd(XMM0, RDX); | 1450 __ cvtsi2sd(XMM0, RDX); |
| 1451 __ movl(RDX, Immediate(8)); |
| 1452 __ cvtsi2sd(XMM8, RDX); |
| 1453 __ subsd(XMM0, XMM8); |
1390 __ ret(); | 1454 __ ret(); |
1391 } | 1455 } |
1392 | 1456 |
1393 | 1457 |
1394 ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, entry) { | 1458 ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, entry) { |
1395 typedef double (*IntToDoubleConversionCode)(); | 1459 typedef double (*IntToDoubleConversionCode)(); |
1396 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); | 1460 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); |
1397 EXPECT_FLOAT_EQ(6.0, res, 0.001); | 1461 EXPECT_FLOAT_EQ(-2.0, res, 0.001); |
1398 } | 1462 } |
1399 | 1463 |
1400 | 1464 |
1401 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { | 1465 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { |
1402 __ movq(RDX, Immediate(12LL << 32)); | 1466 __ movq(RDX, Immediate(12LL << 32)); |
1403 __ cvtsi2sd(XMM0, RDX); | 1467 __ cvtsi2sd(XMM0, RDX); |
| 1468 __ movsd(XMM15, XMM0); // Move to high register |
| 1469 __ addsd(XMM0, XMM0); // Stomp XMM0 |
| 1470 __ movsd(XMM0, XMM15); // Move back to XMM0 |
1404 __ ret(); | 1471 __ ret(); |
1405 } | 1472 } |
1406 | 1473 |
1407 | 1474 |
1408 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, entry) { | 1475 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, entry) { |
1409 typedef double (*Int64ToDoubleConversionCode)(); | 1476 typedef double (*Int64ToDoubleConversionCode)(); |
1410 double res = reinterpret_cast<Int64ToDoubleConversionCode>(entry)(); | 1477 double res = reinterpret_cast<Int64ToDoubleConversionCode>(entry)(); |
1411 EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001); | 1478 EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001); |
1412 } | 1479 } |
1413 | 1480 |
1414 | 1481 |
1415 ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) { | 1482 ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) { |
1416 __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3))); | 1483 __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3))); |
1417 __ pushq(RAX); | 1484 __ pushq(RAX); |
| 1485 __ movsd(XMM9, Address(RSP, 0)); |
1418 __ movsd(XMM6, Address(RSP, 0)); | 1486 __ movsd(XMM6, Address(RSP, 0)); |
1419 __ popq(RAX); | 1487 __ popq(RAX); |
| 1488 __ cvttsd2siq(R10, XMM6); |
1420 __ cvttsd2siq(RDX, XMM6); | 1489 __ cvttsd2siq(RDX, XMM6); |
| 1490 __ cvttsd2siq(R10, XMM9); |
| 1491 __ cvttsd2siq(RDX, XMM9); |
| 1492 __ subq(RDX, R10); |
1421 __ movq(RAX, RDX); | 1493 __ movq(RAX, RDX); |
1422 __ ret(); | 1494 __ ret(); |
1423 } | 1495 } |
1424 | 1496 |
1425 | 1497 |
1426 ASSEMBLER_TEST_RUN(DoubleToInt64Conversion, entry) { | 1498 ASSEMBLER_TEST_RUN(DoubleToInt64Conversion, entry) { |
1427 typedef int64_t (*DoubleToInt64ConversionCode)(); | 1499 typedef int64_t (*DoubleToInt64ConversionCode)(); |
1428 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(entry)(); | 1500 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(entry)(); |
1429 EXPECT_EQ(12, res); | 1501 EXPECT_EQ(0, res); |
1430 } | 1502 } |
1431 | 1503 |
1432 | 1504 |
1433 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { | 1505 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { |
1434 ObjectStore* object_store = Isolate::Current()->object_store(); | 1506 ObjectStore* object_store = Isolate::Current()->object_store(); |
1435 const Object& obj = Object::ZoneHandle(object_store->smi_class()); | 1507 const Object& obj = Object::ZoneHandle(object_store->smi_class()); |
1436 Label fail; | 1508 Label fail; |
1437 __ LoadObject(RAX, obj); | 1509 __ LoadObject(RAX, obj); |
1438 __ CompareObject(RAX, obj); | 1510 __ CompareObject(RAX, obj); |
1439 __ j(NOT_EQUAL, &fail); | 1511 __ j(NOT_EQUAL, &fail); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 | 1670 |
1599 | 1671 |
1600 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) { | 1672 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) { |
1601 typedef double (*XorpdZeroingCode)(double d); | 1673 typedef double (*XorpdZeroingCode)(double d); |
1602 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3); | 1674 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3); |
1603 EXPECT_FLOAT_EQ(0.0, res, 0.0001); | 1675 EXPECT_FLOAT_EQ(0.0, res, 0.0001); |
1604 } | 1676 } |
1605 | 1677 |
1606 | 1678 |
1607 ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) { | 1679 ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) { |
| 1680 Label done; |
| 1681 __ xorpd(XMM15, XMM15); |
1608 __ xorpd(XMM0, XMM0); | 1682 __ xorpd(XMM0, XMM0); |
| 1683 __ xorpd(XMM0, XMM15); |
| 1684 __ comisd(XMM0, XMM15); |
| 1685 __ j(ZERO, &done); |
| 1686 __ int3(); |
| 1687 __ Bind(&done); |
1609 __ ret(); | 1688 __ ret(); |
1610 } | 1689 } |
1611 | 1690 |
1612 | 1691 |
1613 ASSEMBLER_TEST_RUN(XorpdZeroing2, entry) { | 1692 ASSEMBLER_TEST_RUN(XorpdZeroing2, entry) { |
1614 typedef double (*XorpdZeroing2Code)(double d); | 1693 typedef double (*XorpdZeroing2Code)(double d); |
1615 double res = reinterpret_cast<XorpdZeroing2Code>(entry)(12.56e3); | 1694 double res = reinterpret_cast<XorpdZeroing2Code>(entry)(12.56e3); |
1616 EXPECT_FLOAT_EQ(0.0, res, 0.0001); | 1695 EXPECT_FLOAT_EQ(0.0, res, 0.0001); |
1617 } | 1696 } |
1618 | 1697 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 EXPECT_EQ(0, res); | 1825 EXPECT_EQ(0, res); |
1747 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0); | 1826 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0); |
1748 EXPECT_EQ(1, res); | 1827 EXPECT_EQ(1, res); |
1749 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0); | 1828 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0); |
1750 EXPECT_EQ(1, res); | 1829 EXPECT_EQ(1, res); |
1751 } | 1830 } |
1752 | 1831 |
1753 } // namespace dart | 1832 } // namespace dart |
1754 | 1833 |
1755 #endif // defined TARGET_ARCH_X64 | 1834 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |