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

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 2546933002: [Turbofan] Add ARM NEON instructions for implementing SIMD. (Closed)
Patch Set: Fourth review comments. Created 4 years 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
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | test/cctest/test-disasm-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 (bit_cast<int64_t>(t.sub_result) >> 32) & 0x7fffffff); 1214 (bit_cast<int64_t>(t.sub_result) >> 32) & 0x7fffffff);
1215 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.sub_result) & 0xffffffffu); 1215 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.sub_result) & 0xffffffffu);
1216 CHECK_EQ(kArmNanUpper32, 1216 CHECK_EQ(kArmNanUpper32,
1217 (bit_cast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); 1217 (bit_cast<int64_t>(t.mul_result) >> 32) & 0x7fffffff);
1218 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.mul_result) & 0xffffffffu); 1218 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.mul_result) & 0xffffffffu);
1219 CHECK_EQ(kArmNanUpper32, 1219 CHECK_EQ(kArmNanUpper32,
1220 (bit_cast<int64_t>(t.div_result) >> 32) & 0x7fffffff); 1220 (bit_cast<int64_t>(t.div_result) >> 32) & 0x7fffffff);
1221 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.div_result) & 0xffffffffu); 1221 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.div_result) & 0xffffffffu);
1222 } 1222 }
1223 1223
1224 #define INT32_TO_FLOAT(val) \
1225 std::round(static_cast<float>(bit_cast<int32_t>(val)))
1226 #define UINT32_TO_FLOAT(val) \
1227 std::round(static_cast<float>(bit_cast<uint32_t>(val)))
1224 1228
1225 TEST(15) { 1229 TEST(15) {
1226 // Test the Neon instructions. 1230 // Test the Neon instructions.
1227 CcTest::InitializeVM(); 1231 CcTest::InitializeVM();
1228 Isolate* isolate = CcTest::i_isolate(); 1232 Isolate* isolate = CcTest::i_isolate();
1229 HandleScope scope(isolate); 1233 HandleScope scope(isolate);
1230 1234
1231 typedef struct { 1235 typedef struct {
1232 uint32_t src0; 1236 uint32_t src0;
1233 uint32_t src1; 1237 uint32_t src1;
(...skipping 14 matching lines...) Expand all
1248 uint32_t srcA0; 1252 uint32_t srcA0;
1249 uint32_t srcA1; 1253 uint32_t srcA1;
1250 uint32_t dstA0; 1254 uint32_t dstA0;
1251 uint32_t dstA1; 1255 uint32_t dstA1;
1252 uint32_t dstA2; 1256 uint32_t dstA2;
1253 uint32_t dstA3; 1257 uint32_t dstA3;
1254 uint32_t dstA4; 1258 uint32_t dstA4;
1255 uint32_t dstA5; 1259 uint32_t dstA5;
1256 uint32_t dstA6; 1260 uint32_t dstA6;
1257 uint32_t dstA7; 1261 uint32_t dstA7;
1258 uint32_t vmov_src[4], vmov_dst[4]; 1262 uint64_t vmov_to_scalar1, vmov_to_scalar2;
1259 uint32_t veor_src[4], veor_dst[4]; 1263 uint32_t vmov_from_scalar_s8, vmov_from_scalar_u8;
1264 uint32_t vmov_from_scalar_s16, vmov_from_scalar_u16;
1265 uint32_t vmov_from_scalar_32;
1266 uint32_t vmov_src[4], vmov_dst[4], vmvn[4];
1267 int32_t vcvt_s32_f32[4];
1268 uint32_t vcvt_u32_f32[4];
1269 float vcvt_f32_s32[4], vcvt_f32_u32[4];
1270 uint32_t vdup1[4], vdup2[4], vdup3[4], vdup4[4];
1271 uint32_t veor[4];
1272 uint32_t vadd8[4], vadd16[4], vadd32[4];
1273 uint32_t vsub8[4], vsub16[4], vsub32[4];
1274 uint32_t vtst[4], vceq[4], vbsl[4], vtbl[2], vtbx[2];
1275 float vaddf[4], vsubf[4];
1260 } T; 1276 } T;
1261 T t; 1277 T t;
1262 1278
1263 // Create a function that accepts &t, and loads, manipulates, and stores 1279 // Create a function that accepts &t, and loads, manipulates, and stores
1264 // the doubles and floats. 1280 // the doubles and floats.
1265 Assembler assm(isolate, NULL, 0); 1281 Assembler assm(isolate, NULL, 0);
1266 1282
1267 1283
1268 if (CpuFeatures::IsSupported(NEON)) { 1284 if (CpuFeatures::IsSupported(NEON)) {
1269 CpuFeatureScope scope(&assm, NEON); 1285 CpuFeatureScope scope(&assm, NEON);
1270 1286
1271 __ stm(db_w, sp, r4.bit() | lr.bit()); 1287 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit());
1272 // Move 32 bytes with neon. 1288 // Move 32 bytes with neon.
1273 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, src0)))); 1289 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, src0))));
1274 __ vld1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4)); 1290 __ vld1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4));
1275 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dst0)))); 1291 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dst0))));
1276 __ vst1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4)); 1292 __ vst1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4));
1277 1293
1278 // Expand 8 bytes into 8 words(16 bits). 1294 // Expand 8 bytes into 8 words(16 bits).
1279 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0)))); 1295 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0))));
1280 __ vld1(Neon8, NeonListOperand(d0), NeonMemOperand(r4)); 1296 __ vld1(Neon8, NeonListOperand(d0), NeonMemOperand(r4));
1281 __ vmovl(NeonU8, q0, d0); 1297 __ vmovl(NeonU8, q0, d0);
1282 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA0)))); 1298 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA0))));
1283 __ vst1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); 1299 __ vst1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4));
1284 1300
1285 // The same expansion, but with different source and destination registers. 1301 // The same expansion, but with different source and destination registers.
1286 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0)))); 1302 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0))));
1287 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4)); 1303 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4));
1288 __ vmovl(NeonU8, q1, d1); 1304 __ vmovl(NeonU8, q1, d1);
1289 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA4)))); 1305 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA4))));
1290 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); 1306 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4));
1291 1307
1292 // Test vmov for q-registers. 1308 // ARM core register to scalar.
1309 __ mov(r4, Operand(0xFFFFFFF8));
1310 __ vmov(d0, 0);
1311 __ vmov(NeonS8, d0, 1, r4);
1312 __ vmov(NeonS16, d0, 1, r4);
1313 __ vmov(NeonS32, d0, 1, r4);
1314 __ vstr(d0, r0, offsetof(T, vmov_to_scalar1));
1315 __ vmov(d0, 0);
1316 __ vmov(NeonS8, d0, 3, r4);
1317 __ vmov(NeonS16, d0, 3, r4);
1318 __ vstr(d0, r0, offsetof(T, vmov_to_scalar2));
1319
1320 // Scalar to ARM core register.
1321 __ mov(r4, Operand(0xFFFFFF00));
1322 __ mov(r5, Operand(0xFFFFFFFF));
1323 __ vmov(d0, r4, r5);
1324 __ vmov(NeonS8, r4, d0, 1);
1325 __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_s8)));
1326 __ vmov(NeonU8, r4, d0, 1);
1327 __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_u8)));
1328 __ vmov(NeonS16, r4, d0, 1);
1329 __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_s16)));
1330 __ vmov(NeonU16, r4, d0, 1);
1331 __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_u16)));
1332 __ vmov(NeonS32, r4, d0, 1);
1333 __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_32)));
1334
1335 // vmov for q-registers.
1293 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_src)))); 1336 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_src))));
1294 __ vld1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); 1337 __ vld1(Neon8, NeonListOperand(q0), NeonMemOperand(r4));
1295 __ vmov(q1, q0); 1338 __ vmov(q1, q0);
1296 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_dst)))); 1339 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_dst))));
1297 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); 1340 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1298 1341
1299 // Test veor for q-registers. 1342 // vmvn.
1300 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor_src)))); 1343 __ mov(r4, Operand(0xFF));
1301 __ vld1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); 1344 __ vdup(Neon16, q0, r4);
1302 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor_dst)))); 1345 __ vmvn(q1, q0);
1303 __ vld1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); 1346 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmvn))));
1347 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1348
1349 // vcvt for q-registers.
1350 __ vmov(s0, -1.5);
1351 __ vmov(s1, -1);
1352 __ vmov(s2, 1);
1353 __ vmov(s3, 1.5);
1354 __ vcvt_s32_f32(q1, q0);
1355 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcvt_s32_f32))));
1356 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1357 __ vcvt_u32_f32(q1, q0);
1358 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcvt_u32_f32))));
1359 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1360 __ mov(r4, Operand(kMinInt));
1361 __ mov(r5, Operand(kMaxInt));
1362 __ vmov(d0, r4, r5);
1363 __ mov(r4, Operand(kMaxUInt32));
1364 __ mov(r5, Operand(kMinInt + 1));
1365 __ vmov(d1, r4, r5); // q0 = [kMinInt, kMaxInt, kMaxUInt32, kMinInt + 1]
1366 __ vcvt_f32_s32(q1, q0);
1367 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcvt_f32_s32))));
1368 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1369 __ vcvt_f32_u32(q1, q0);
1370 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcvt_f32_u32))));
1371 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1372
1373 // int vdup.
1374 __ mov(r4, Operand(0xa));
1375 __ vdup(Neon8, q0, r4);
1376 __ vdup(Neon16, q1, r4);
1377 __ vdup(Neon32, q2, r4);
1378 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vdup1))));
1379 __ vst1(Neon8, NeonListOperand(q0), NeonMemOperand(r4));
1380 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vdup2))));
1381 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1382 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vdup3))));
1383 __ vst1(Neon8, NeonListOperand(q2), NeonMemOperand(r4));
1384 // float vdup.
1385 __ vmov(s0, -1.0);
1386 __ vdup(q0, s0);
1387 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vdup4))));
1388 __ vst1(Neon8, NeonListOperand(q0), NeonMemOperand(r4));
1389
1390 // veor.
1391 __ mov(r4, Operand(0x00aa));
1392 __ vdup(Neon16, q0, r4);
1393 __ mov(r4, Operand(0x0055));
1394 __ vdup(Neon16, q1, r4);
1304 __ veor(q1, q1, q0); 1395 __ veor(q1, q1, q0);
1305 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); 1396 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor))));
1397 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1398
1399 // vadd(integer).
1400 __ mov(r4, Operand(0x81));
1401 __ vdup(Neon8, q0, r4);
1402 __ mov(r4, Operand(0x82));
1403 __ vdup(Neon8, q1, r4);
1404 __ vadd(Neon8, q1, q1, q0);
1405 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vadd8))));
1406 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1407 __ mov(r4, Operand(0x8001));
1408 __ vdup(Neon16, q0, r4);
1409 __ mov(r4, Operand(0x8002));
1410 __ vdup(Neon16, q1, r4);
1411 __ vadd(Neon16, q1, q1, q0);
1412 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vadd16))));
1413 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1414 __ mov(r4, Operand(0x80000001));
1415 __ vdup(Neon32, q0, r4);
1416 __ mov(r4, Operand(0x80000002));
1417 __ vdup(Neon32, q1, r4);
1418 __ vadd(Neon32, q1, q1, q0);
1419 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vadd32))));
1420 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1421
1422 // vadd(float).
1423 __ vmov(s4, 1.0);
1424 __ vdup(q0, s4);
1425 __ vdup(q1, s4);
1426 __ vadd(q1, q1, q0);
1427 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vaddf))));
1428 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1429
1430 // vsub(integer).
1431 __ mov(r4, Operand(0x01));
1432 __ vdup(Neon8, q0, r4);
1433 __ mov(r4, Operand(0x02));
1434 __ vdup(Neon8, q1, r4);
1435 __ vsub(Neon8, q1, q0, q1);
1436 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vsub8))));
1437 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1438 __ mov(r4, Operand(0x0001));
1439 __ vdup(Neon16, q0, r4);
1440 __ mov(r4, Operand(0x0002));
1441 __ vdup(Neon16, q1, r4);
1442 __ vsub(Neon16, q1, q0, q1);
1443 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vsub16))));
1444 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1445 __ mov(r4, Operand(0x00000001));
1446 __ vdup(Neon32, q0, r4);
1447 __ mov(r4, Operand(0x00000002));
1448 __ vdup(Neon32, q1, r4);
1449 __ vsub(Neon32, q1, q0, q1);
1450 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vsub32))));
1451 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1452
1453 // vsub(float).
1454 __ vmov(s4, 2.0);
1455 __ vdup(q0, s4);
1456 __ vmov(s4, 1.0);
1457 __ vdup(q1, s4);
1458 __ vsub(q1, q1, q0);
1459 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vsubf))));
1460 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1461
1462 // vceq.
1463 __ mov(r4, Operand(0x03));
1464 __ vdup(Neon8, q0, r4);
1465 __ mov(r4, Operand(0x03));
1466 __ vdup(Neon16, q1, r4);
1467 __ vceq(Neon8, q1, q0, q1);
1468 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vceq))));
1469 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1470
1471 // vtst.
1472 __ mov(r4, Operand(0x03));
1473 __ vdup(Neon8, q0, r4);
1474 __ mov(r4, Operand(0x02));
1475 __ vdup(Neon16, q1, r4);
1476 __ vtst(Neon8, q1, q0, q1);
1477 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vtst))));
1478 __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4));
1479
1480 // vbsl.
1481 __ mov(r4, Operand(0x00ff));
1482 __ vdup(Neon16, q0, r4);
1483 __ mov(r4, Operand(0x01));
1484 __ vdup(Neon8, q1, r4);
1485 __ mov(r4, Operand(0x02));
1486 __ vdup(Neon8, q2, r4);
1487 __ vbsl(q0, q1, q2);
1488 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vbsl))));
1489 __ vst1(Neon8, NeonListOperand(q0), NeonMemOperand(r4));
1490
1491 // vtb[l/x].
1492 __ mov(r4, Operand(0x06040200));
1493 __ mov(r5, Operand(0xff050301));
1494 __ vmov(d2, r4, r5); // d2 = ff05030106040200
1495 __ vtbl(d0, NeonListOperand(d2, 1), d2);
1496 __ vstr(d0, r0, offsetof(T, vtbl));
1497 __ vtbx(d2, NeonListOperand(d2, 1), d2);
1498 __ vstr(d2, r0, offsetof(T, vtbx));
1306 1499
1307 // Restore and return. 1500 // Restore and return.
1308 __ ldm(ia_w, sp, r4.bit() | pc.bit()); 1501 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit());
1309 1502
1310 CodeDesc desc; 1503 CodeDesc desc;
1311 assm.GetCode(&desc); 1504 assm.GetCode(&desc);
1312 Handle<Code> code = isolate->factory()->NewCode( 1505 Handle<Code> code = isolate->factory()->NewCode(
1313 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1506 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1314 #ifdef DEBUG 1507 #ifdef DEBUG
1315 OFStream os(stdout); 1508 OFStream os(stdout);
1316 code->Print(os); 1509 code->Print(os);
1317 #endif 1510 #endif
1318 F3 f = FUNCTION_CAST<F3>(code->entry()); 1511 F3 f = FUNCTION_CAST<F3>(code->entry());
(...skipping 18 matching lines...) Expand all
1337 t.dstA0 = 0; 1530 t.dstA0 = 0;
1338 t.dstA1 = 0; 1531 t.dstA1 = 0;
1339 t.dstA2 = 0; 1532 t.dstA2 = 0;
1340 t.dstA3 = 0; 1533 t.dstA3 = 0;
1341 t.dstA4 = 0; 1534 t.dstA4 = 0;
1342 t.dstA5 = 0; 1535 t.dstA5 = 0;
1343 t.dstA6 = 0; 1536 t.dstA6 = 0;
1344 t.dstA7 = 0; 1537 t.dstA7 = 0;
1345 t.vmov_src[0] = t.vmov_src[1] = t.vmov_src[2] = t.vmov_src[3] = 1; 1538 t.vmov_src[0] = t.vmov_src[1] = t.vmov_src[2] = t.vmov_src[3] = 1;
1346 t.vmov_dst[0] = t.vmov_dst[1] = t.vmov_dst[2] = t.vmov_dst[3] = 0; 1539 t.vmov_dst[0] = t.vmov_dst[1] = t.vmov_dst[2] = t.vmov_dst[3] = 0;
1347 t.veor_src[0] = t.veor_src[1] = t.veor_src[2] = t.veor_src[3] = 0xAA;
1348 t.veor_dst[0] = t.veor_dst[1] = t.veor_dst[2] = t.veor_dst[3] = 0x55;
1349 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); 1540 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1350 USE(dummy); 1541 USE(dummy);
1542
1351 CHECK_EQ(0x01020304u, t.dst0); 1543 CHECK_EQ(0x01020304u, t.dst0);
1352 CHECK_EQ(0x11121314u, t.dst1); 1544 CHECK_EQ(0x11121314u, t.dst1);
1353 CHECK_EQ(0x21222324u, t.dst2); 1545 CHECK_EQ(0x21222324u, t.dst2);
1354 CHECK_EQ(0x31323334u, t.dst3); 1546 CHECK_EQ(0x31323334u, t.dst3);
1355 CHECK_EQ(0x41424344u, t.dst4); 1547 CHECK_EQ(0x41424344u, t.dst4);
1356 CHECK_EQ(0x51525354u, t.dst5); 1548 CHECK_EQ(0x51525354u, t.dst5);
1357 CHECK_EQ(0x61626364u, t.dst6); 1549 CHECK_EQ(0x61626364u, t.dst6);
1358 CHECK_EQ(0x71727374u, t.dst7); 1550 CHECK_EQ(0x71727374u, t.dst7);
1359 CHECK_EQ(0x00430044u, t.dstA0); 1551 CHECK_EQ(0x00430044u, t.dstA0);
1360 CHECK_EQ(0x00410042u, t.dstA1); 1552 CHECK_EQ(0x00410042u, t.dstA1);
1361 CHECK_EQ(0x00830084u, t.dstA2); 1553 CHECK_EQ(0x00830084u, t.dstA2);
1362 CHECK_EQ(0x00810082u, t.dstA3); 1554 CHECK_EQ(0x00810082u, t.dstA3);
1363 CHECK_EQ(0x00430044u, t.dstA4); 1555 CHECK_EQ(0x00430044u, t.dstA4);
1364 CHECK_EQ(0x00410042u, t.dstA5); 1556 CHECK_EQ(0x00410042u, t.dstA5);
1365 CHECK_EQ(0x00830084u, t.dstA6); 1557 CHECK_EQ(0x00830084u, t.dstA6);
1366 CHECK_EQ(0x00810082u, t.dstA7); 1558 CHECK_EQ(0x00810082u, t.dstA7);
1559 CHECK_EQ(0xfffffff8fff8f800u, t.vmov_to_scalar1);
1560 CHECK_EQ(0xfff80000f8000000u, t.vmov_to_scalar2);
1561 CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_s8);
1562 CHECK_EQ(0xFFu, t.vmov_from_scalar_u8);
1563 CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_s16);
1564 CHECK_EQ(0xFFFFu, t.vmov_from_scalar_u16);
1565 CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_32);
1367 CHECK_EQ(1u, t.vmov_dst[0]); 1566 CHECK_EQ(1u, t.vmov_dst[0]);
1368 CHECK_EQ(1u, t.vmov_dst[1]); 1567 CHECK_EQ(1u, t.vmov_dst[1]);
1369 CHECK_EQ(1u, t.vmov_dst[2]); 1568 CHECK_EQ(1u, t.vmov_dst[2]);
1370 CHECK_EQ(1u, t.vmov_dst[3]); 1569 CHECK_EQ(1u, t.vmov_dst[3]);
1371 CHECK_EQ(0xFFu, t.veor_dst[0]); 1570 CHECK_EQ(-1, t.vcvt_s32_f32[0]);
1372 CHECK_EQ(0xFFu, t.veor_dst[1]); 1571 CHECK_EQ(-1, t.vcvt_s32_f32[1]);
1373 CHECK_EQ(0xFFu, t.veor_dst[2]); 1572 CHECK_EQ(1, t.vcvt_s32_f32[2]);
1374 CHECK_EQ(0xFFu, t.veor_dst[3]); 1573 CHECK_EQ(1, t.vcvt_s32_f32[3]);
1574 CHECK_EQ(0u, t.vcvt_u32_f32[0]);
1575 CHECK_EQ(0u, t.vcvt_u32_f32[1]);
1576 CHECK_EQ(1u, t.vcvt_u32_f32[2]);
1577 CHECK_EQ(1u, t.vcvt_u32_f32[3]);
1578
1579 // src: [kMinInt, kMaxInt, kMaxUInt32, kMinInt + 1]
1580 CHECK_EQ(INT32_TO_FLOAT(kMinInt), t.vcvt_f32_s32[0]);
1581 CHECK_EQ(INT32_TO_FLOAT(kMaxInt), t.vcvt_f32_s32[1]);
1582 CHECK_EQ(INT32_TO_FLOAT(kMaxUInt32), t.vcvt_f32_s32[2]);
1583 CHECK_EQ(INT32_TO_FLOAT(kMinInt + 1), t.vcvt_f32_s32[3]);
1584 CHECK_EQ(UINT32_TO_FLOAT(kMinInt), t.vcvt_f32_u32[0]);
1585 CHECK_EQ(UINT32_TO_FLOAT(kMaxInt), t.vcvt_f32_u32[1]);
1586 CHECK_EQ(UINT32_TO_FLOAT(kMaxUInt32), t.vcvt_f32_u32[2]);
1587 CHECK_EQ(UINT32_TO_FLOAT(kMinInt + 1), t.vcvt_f32_u32[3]);
1588
1589 for (int i = 0; i < 4; i++) CHECK_EQ(0xFF00FF00, t.vmvn[i]);
1590 for (int i = 0; i < 4; i++) CHECK_EQ(0x0a0a0a0au, t.vdup1[i]);
1591 for (int i = 0; i < 4; i++) CHECK_EQ(0x000a000au, t.vdup2[i]);
1592 for (int i = 0; i < 4; i++) CHECK_EQ(0x0000000au, t.vdup3[i]);
1593 for (int i = 0; i < 4; i++) CHECK_EQ(0xbf800000u, t.vdup4[i]); // -1.0f
1594 for (int i = 0; i < 4; i++) CHECK_EQ(0x00ff00ffu, t.veor[i]);
1595 for (int i = 0; i < 4; i++) CHECK_EQ(2.0, t.vaddf[i]);
1596 for (int i = 0; i < 4; i++) CHECK_EQ(0x03030303u, t.vadd8[i]);
1597 for (int i = 0; i < 4; i++) CHECK_EQ(0x00030003u, t.vadd16[i]);
1598 for (int i = 0; i < 4; i++) CHECK_EQ(0x00000003u, t.vadd32[i]);
1599 for (int i = 0; i < 4; i++) CHECK_EQ(-1.0, t.vsubf[i]);
1600 for (int i = 0; i < 4; i++) CHECK_EQ(0xffffffffu, t.vsub8[i]);
1601 for (int i = 0; i < 4; i++) CHECK_EQ(0xffffffffu, t.vsub16[i]);
1602 for (int i = 0; i < 4; i++) CHECK_EQ(0xffffffffu, t.vsub32[i]);
1603 for (int i = 0; i < 4; i++) CHECK_EQ(0x00ff00ffu, t.vceq[i]);
1604 for (int i = 0; i < 4; i++) CHECK_EQ(0x00ff00ffu, t.vtst[i]);
1605 for (int i = 0; i < 4; i++) CHECK_EQ(0x02010201u, t.vbsl[i]);
1606 CHECK_EQ(0x05010400u, t.vtbl[0]);
1607 CHECK_EQ(0x00030602u, t.vtbl[1]);
1608 CHECK_EQ(0x05010400u, t.vtbx[0]);
1609 CHECK_EQ(0xff030602u, t.vtbx[1]);
1375 } 1610 }
1376 } 1611 }
1377 1612
1378 1613
1379 TEST(16) { 1614 TEST(16) {
1380 // Test the pkh, uxtb, uxtab and uxtb16 instructions. 1615 // Test the pkh, uxtb, uxtab and uxtb16 instructions.
1381 CcTest::InitializeVM(); 1616 CcTest::InitializeVM();
1382 Isolate* isolate = CcTest::i_isolate(); 1617 Isolate* isolate = CcTest::i_isolate();
1383 HandleScope scope(isolate); 1618 HandleScope scope(isolate);
1384 1619
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 const uint32_t test_2 = 0x89abcdef; 3191 const uint32_t test_2 = 0x89abcdef;
2957 __ mov(r4, Operand(test_1)); 3192 __ mov(r4, Operand(test_1));
2958 __ mov(r5, Operand(test_2)); 3193 __ mov(r5, Operand(test_2));
2959 // TODO(bbudge) replace with vdup when implemented. 3194 // TODO(bbudge) replace with vdup when implemented.
2960 __ vmov(d8, r4, r4); 3195 __ vmov(d8, r4, r4);
2961 __ vmov(d9, r4, r4); // q4 = [1.0, 1.0] 3196 __ vmov(d9, r4, r4); // q4 = [1.0, 1.0]
2962 __ vmov(d10, r5, r5); 3197 __ vmov(d10, r5, r5);
2963 __ vmov(d11, r5, r5); // q5 = [-1.0, -1.0] 3198 __ vmov(d11, r5, r5); // q5 = [-1.0, -1.0]
2964 __ vswp(q4, q5); 3199 __ vswp(q4, q5);
2965 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q4)))); 3200 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q4))));
2966 __ vst1(Neon8, NeonListOperand(d8, 2), NeonMemOperand(r6)); 3201 __ vst1(Neon8, NeonListOperand(q4), NeonMemOperand(r6));
2967 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q5)))); 3202 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q5))));
2968 __ vst1(Neon8, NeonListOperand(d10, 2), NeonMemOperand(r6)); 3203 __ vst1(Neon8, NeonListOperand(q5), NeonMemOperand(r6));
2969 3204
2970 __ ldm(ia_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | pc.bit()); 3205 __ ldm(ia_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | pc.bit());
2971 __ bx(lr); 3206 __ bx(lr);
2972 3207
2973 CodeDesc desc; 3208 CodeDesc desc;
2974 assm.GetCode(&desc); 3209 assm.GetCode(&desc);
2975 Handle<Code> code = isolate->factory()->NewCode( 3210 Handle<Code> code = isolate->factory()->NewCode(
2976 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 3211 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
2977 #ifdef DEBUG 3212 #ifdef DEBUG
2978 OFStream os(stdout); 3213 OFStream os(stdout);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 HandleScope scope(isolate); 3283 HandleScope scope(isolate);
3049 3284
3050 Assembler assm(isolate, NULL, 0); 3285 Assembler assm(isolate, NULL, 0);
3051 __ mov(r0, Operand(isolate->factory()->infinity_value())); 3286 __ mov(r0, Operand(isolate->factory()->infinity_value()));
3052 __ BlockConstPoolFor(1019); 3287 __ BlockConstPoolFor(1019);
3053 for (int i = 0; i < 1019; ++i) __ nop(); 3288 for (int i = 0; i < 1019; ++i) __ nop();
3054 __ vldr(d0, MemOperand(r0, 0)); 3289 __ vldr(d0, MemOperand(r0, 0));
3055 } 3290 }
3056 3291
3057 #undef __ 3292 #undef __
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698