OLD | NEW |
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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.add_result) >> 32) & 0x7fffffff); | 1219 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.add_result) >> 32) & 0x7fffffff); |
1220 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.add_result) & 0xffffffffu); | 1220 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.add_result) & 0xffffffffu); |
1221 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.sub_result) >> 32) & 0x7fffffff); | 1221 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.sub_result) >> 32) & 0x7fffffff); |
1222 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.sub_result) & 0xffffffffu); | 1222 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.sub_result) & 0xffffffffu); |
1223 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); | 1223 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); |
1224 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.mul_result) & 0xffffffffu); | 1224 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.mul_result) & 0xffffffffu); |
1225 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.div_result) >> 32) & 0x7fffffff); | 1225 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.div_result) >> 32) & 0x7fffffff); |
1226 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.div_result) & 0xffffffffu); | 1226 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.div_result) & 0xffffffffu); |
1227 } | 1227 } |
1228 | 1228 |
| 1229 |
| 1230 TEST(15) { |
| 1231 // Test the Neon instructions. |
| 1232 CcTest::InitializeVM(); |
| 1233 Isolate* isolate = Isolate::Current(); |
| 1234 HandleScope scope(isolate); |
| 1235 |
| 1236 typedef struct { |
| 1237 uint32_t src0; |
| 1238 uint32_t src1; |
| 1239 uint32_t src2; |
| 1240 uint32_t src3; |
| 1241 uint32_t src4; |
| 1242 uint32_t src5; |
| 1243 uint32_t src6; |
| 1244 uint32_t src7; |
| 1245 uint32_t dst0; |
| 1246 uint32_t dst1; |
| 1247 uint32_t dst2; |
| 1248 uint32_t dst3; |
| 1249 uint32_t dst4; |
| 1250 uint32_t dst5; |
| 1251 uint32_t dst6; |
| 1252 uint32_t dst7; |
| 1253 uint32_t srcA0; |
| 1254 uint32_t srcA1; |
| 1255 uint32_t dstA0; |
| 1256 uint32_t dstA1; |
| 1257 uint32_t dstA2; |
| 1258 uint32_t dstA3; |
| 1259 } T; |
| 1260 T t; |
| 1261 |
| 1262 // Create a function that accepts &t, and loads, manipulates, and stores |
| 1263 // the doubles and floats. |
| 1264 Assembler assm(isolate, NULL, 0); |
| 1265 |
| 1266 |
| 1267 if (CpuFeatures::IsSupported(NEON)) { |
| 1268 CpuFeatureScope scope(&assm, NEON); |
| 1269 |
| 1270 __ stm(db_w, sp, r4.bit() | lr.bit()); |
| 1271 // Move 32 bytes with neon. |
| 1272 __ add(r4, r0, Operand(OFFSET_OF(T, src0))); |
| 1273 __ vld1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4)); |
| 1274 __ add(r4, r0, Operand(OFFSET_OF(T, dst0))); |
| 1275 __ vst1(Neon8, NeonListOperand(d0, 4), NeonMemOperand(r4)); |
| 1276 |
| 1277 // Expand 8 bytes into 8 words(16 bits). |
| 1278 __ add(r4, r0, Operand(OFFSET_OF(T, srcA0))); |
| 1279 __ vld1(Neon8, NeonListOperand(d0), NeonMemOperand(r4)); |
| 1280 __ vmovl(NeonU8, q0, d0); |
| 1281 __ add(r4, r0, Operand(OFFSET_OF(T, dstA0))); |
| 1282 __ vst1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); |
| 1283 |
| 1284 __ ldm(ia_w, sp, r4.bit() | pc.bit()); |
| 1285 |
| 1286 CodeDesc desc; |
| 1287 assm.GetCode(&desc); |
| 1288 Object* code = isolate->heap()->CreateCode( |
| 1289 desc, |
| 1290 Code::ComputeFlags(Code::STUB), |
| 1291 Handle<Code>())->ToObjectChecked(); |
| 1292 CHECK(code->IsCode()); |
| 1293 #ifdef DEBUG |
| 1294 Code::cast(code)->Print(); |
| 1295 #endif |
| 1296 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 1297 t.src0 = 0x01020304; |
| 1298 t.src1 = 0x11121314; |
| 1299 t.src2 = 0x21222324; |
| 1300 t.src3 = 0x31323334; |
| 1301 t.src4 = 0x41424344; |
| 1302 t.src5 = 0x51525354; |
| 1303 t.src6 = 0x61626364; |
| 1304 t.src7 = 0x71727374; |
| 1305 t.dst0 = 0; |
| 1306 t.dst1 = 0; |
| 1307 t.dst2 = 0; |
| 1308 t.dst3 = 0; |
| 1309 t.dst4 = 0; |
| 1310 t.dst5 = 0; |
| 1311 t.dst6 = 0; |
| 1312 t.dst7 = 0; |
| 1313 t.srcA0 = 0x41424344; |
| 1314 t.srcA1 = 0x81828384; |
| 1315 t.dstA0 = 0; |
| 1316 t.dstA1 = 0; |
| 1317 t.dstA2 = 0; |
| 1318 t.dstA3 = 0; |
| 1319 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 1320 USE(dummy); |
| 1321 CHECK_EQ(0x01020304, t.dst0); |
| 1322 CHECK_EQ(0x11121314, t.dst1); |
| 1323 CHECK_EQ(0x21222324, t.dst2); |
| 1324 CHECK_EQ(0x31323334, t.dst3); |
| 1325 CHECK_EQ(0x41424344, t.dst4); |
| 1326 CHECK_EQ(0x51525354, t.dst5); |
| 1327 CHECK_EQ(0x61626364, t.dst6); |
| 1328 CHECK_EQ(0x71727374, t.dst7); |
| 1329 CHECK_EQ(0x00430044, t.dstA0); |
| 1330 CHECK_EQ(0x00410042, t.dstA1); |
| 1331 CHECK_EQ(0x00830084, t.dstA2); |
| 1332 CHECK_EQ(0x00810082, t.dstA3); |
| 1333 } |
| 1334 } |
| 1335 |
| 1336 TEST(16) { |
| 1337 // Test the pkh, uxtb, uxtab and uxtb16 instructions. |
| 1338 CcTest::InitializeVM(); |
| 1339 Isolate* isolate = Isolate::Current(); |
| 1340 HandleScope scope(isolate); |
| 1341 |
| 1342 typedef struct { |
| 1343 uint32_t src0; |
| 1344 uint32_t src1; |
| 1345 uint32_t src2; |
| 1346 uint32_t dst0; |
| 1347 uint32_t dst1; |
| 1348 uint32_t dst2; |
| 1349 uint32_t dst3; |
| 1350 uint32_t dst4; |
| 1351 } T; |
| 1352 T t; |
| 1353 |
| 1354 // Create a function that accepts &t, and loads, manipulates, and stores |
| 1355 // the doubles and floats. |
| 1356 Assembler assm(isolate, NULL, 0); |
| 1357 |
| 1358 __ stm(db_w, sp, r4.bit() | lr.bit()); |
| 1359 |
| 1360 __ mov(r4, Operand(r0)); |
| 1361 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src0))); |
| 1362 __ ldr(r1, MemOperand(r4, OFFSET_OF(T, src1))); |
| 1363 |
| 1364 __ pkhbt(r2, r0, Operand(r1, LSL, 8)); |
| 1365 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst0))); |
| 1366 |
| 1367 __ pkhtb(r2, r0, Operand(r1, ASR, 8)); |
| 1368 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst1))); |
| 1369 |
| 1370 __ uxtb16(r2, Operand(r0, ROR, 8)); |
| 1371 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst2))); |
| 1372 |
| 1373 __ uxtb(r2, Operand(r0, ROR, 8)); |
| 1374 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst3))); |
| 1375 |
| 1376 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src2))); |
| 1377 __ uxtab(r2, r0, Operand(r1, ROR, 8)); |
| 1378 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst4))); |
| 1379 |
| 1380 __ ldm(ia_w, sp, r4.bit() | pc.bit()); |
| 1381 |
| 1382 CodeDesc desc; |
| 1383 assm.GetCode(&desc); |
| 1384 Object* code = isolate->heap()->CreateCode( |
| 1385 desc, |
| 1386 Code::ComputeFlags(Code::STUB), |
| 1387 Handle<Code>())->ToObjectChecked(); |
| 1388 CHECK(code->IsCode()); |
| 1389 #ifdef DEBUG |
| 1390 Code::cast(code)->Print(); |
| 1391 #endif |
| 1392 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 1393 t.src0 = 0x01020304; |
| 1394 t.src1 = 0x11121314; |
| 1395 t.src2 = 0x11121300; |
| 1396 t.dst0 = 0; |
| 1397 t.dst1 = 0; |
| 1398 t.dst2 = 0; |
| 1399 t.dst3 = 0; |
| 1400 t.dst4 = 0; |
| 1401 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 1402 USE(dummy); |
| 1403 CHECK_EQ(0x12130304, t.dst0); |
| 1404 CHECK_EQ(0x01021213, t.dst1); |
| 1405 CHECK_EQ(0x00010003, t.dst2); |
| 1406 CHECK_EQ(0x00000003, t.dst3); |
| 1407 CHECK_EQ(0x11121313, t.dst4); |
| 1408 } |
| 1409 |
1229 #undef __ | 1410 #undef __ |
OLD | NEW |