| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 __ mov(PC, ShifterOperand(LR)); | 1354 __ mov(PC, ShifterOperand(LR)); |
| 1355 } | 1355 } |
| 1356 | 1356 |
| 1357 | 1357 |
| 1358 ASSEMBLER_TEST_RUN(VstmsVldms_off, test) { | 1358 ASSEMBLER_TEST_RUN(VstmsVldms_off, test) { |
| 1359 EXPECT(test != NULL); | 1359 EXPECT(test != NULL); |
| 1360 typedef int (*Tst)(); | 1360 typedef int (*Tst)(); |
| 1361 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); | 1361 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 |
| 1365 // Check that assembler mrc instruction encoding, and simulator decoding |
| 1366 // are in agreement. |
| 1367 #if defined(USING_SIMULATOR) |
| 1368 ASSEMBLER_TEST_GENERATE(MrcHaveDiv, assembler) { |
| 1369 __ mrc(R0, 15, 0, 0, 2, 0); |
| 1370 __ Lsr(R0, R0, 24); |
| 1371 __ and_(R0, R0, ShifterOperand(0xf)); |
| 1372 __ mov(PC, ShifterOperand(LR)); |
| 1373 } |
| 1374 |
| 1375 |
| 1376 ASSEMBLER_TEST_RUN(MrcHaveDiv, test) { |
| 1377 EXPECT(test != NULL); |
| 1378 typedef int (*Tst)(); |
| 1379 bool b = CPUFeatures::integer_division_supported(); |
| 1380 CPUFeatures::set_integer_division_supported(true); |
| 1381 EXPECT_LT(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
| 1382 CPUFeatures::set_integer_division_supported(b); |
| 1383 } |
| 1384 |
| 1385 |
| 1386 ASSEMBLER_TEST_GENERATE(MrcNoDiv, assembler) { |
| 1387 __ mrc(R0, 15, 0, 0, 2, 0); |
| 1388 __ Lsr(R0, R0, 24); |
| 1389 __ and_(R0, R0, ShifterOperand(0xf)); |
| 1390 __ mov(PC, ShifterOperand(LR)); |
| 1391 } |
| 1392 |
| 1393 |
| 1394 ASSEMBLER_TEST_RUN(MrcNoDiv, test) { |
| 1395 EXPECT(test != NULL); |
| 1396 typedef int (*Tst)(); |
| 1397 bool b = CPUFeatures::integer_division_supported(); |
| 1398 CPUFeatures::set_integer_division_supported(false); |
| 1399 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
| 1400 CPUFeatures::set_integer_division_supported(b); |
| 1401 } |
| 1402 #endif // defined(USING_SIMULATOR) |
| 1403 |
| 1404 |
| 1405 ASSEMBLER_TEST_GENERATE(MrcReal, assembler) { |
| 1406 __ mrc(R0, 15, 0, 0, 2, 0); |
| 1407 __ Lsr(R0, R0, 24); |
| 1408 __ and_(R0, R0, ShifterOperand(0xf)); |
| 1409 __ mov(PC, ShifterOperand(LR)); |
| 1410 } |
| 1411 |
| 1412 |
| 1413 ASSEMBLER_TEST_RUN(MrcReal, test) { |
| 1414 EXPECT(test != NULL); |
| 1415 typedef int (*Tst)(); |
| 1416 bool have_div = CPUFeatures::integer_division_supported(); |
| 1417 int32_t r = EXECUTE_TEST_CODE_INT32(Tst, test->entry()); |
| 1418 if (have_div) { |
| 1419 EXPECT_LT(0, r); |
| 1420 } else { |
| 1421 EXPECT_EQ(0, r); |
| 1422 } |
| 1423 } |
| 1424 |
| 1425 |
| 1364 } // namespace dart | 1426 } // namespace dart |
| 1365 | 1427 |
| 1366 #endif // defined TARGET_ARCH_ARM | 1428 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |