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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 372 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { | 376 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { |
377 __ movz(R0, 43, 0); | 377 __ movz(R0, 43, 0); |
378 __ movz(R1, 42, 0); | 378 __ movz(R1, 42, 0); |
379 __ movz(R2, 10, 0); | 379 __ movz(R2, 10, 0); |
380 __ sub(SP, SP, Operand(10*kWordSize)); | 380 __ sub(SP, SP, Operand(10*kWordSize)); |
381 // Store R1 into SP + R2 * kWordSize. | 381 // Store R1 into SP + R2 * kWordSize. |
382 __ str(R1, Address(SP, R2, UXTX, true)); | 382 __ str(R1, Address(SP, R2, UXTX, Address::Scaled)); |
383 __ ldr(R0, Address(SP, R2, UXTX, true)); | 383 __ ldr(R0, Address(SP, R2, UXTX, Address::Scaled)); |
384 __ add(SP, SP, Operand(10*kWordSize)); | 384 __ add(SP, SP, Operand(10*kWordSize)); |
385 __ ret(); | 385 __ ret(); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { | 389 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { |
390 typedef int (*SimpleCode)(); | 390 typedef int (*SimpleCode)(); |
391 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 391 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
392 } | 392 } |
393 | 393 |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 } | 1279 } |
1280 | 1280 |
1281 | 1281 |
1282 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { | 1282 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { |
1283 typedef int (*SimpleCode)(); | 1283 typedef int (*SimpleCode)(); |
1284 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), | 1284 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), |
1285 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1285 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
1286 } | 1286 } |
1287 | 1287 |
1288 | 1288 |
| 1289 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { |
| 1290 __ LoadImmediate(R1, 42, kNoRegister); |
| 1291 __ LoadImmediate(R2, 1234, kNoRegister); |
| 1292 __ CompareRegisters(R1, R2); |
| 1293 __ csel(R0, R1, R2, LT); |
| 1294 __ ret(); |
| 1295 } |
| 1296 |
| 1297 |
| 1298 ASSEMBLER_TEST_RUN(CSelTrue, test) { |
| 1299 typedef int (*SimpleCode)(); |
| 1300 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1301 } |
| 1302 |
| 1303 |
| 1304 ASSEMBLER_TEST_GENERATE(CSelFalse, assembler) { |
| 1305 __ LoadImmediate(R1, 42, kNoRegister); |
| 1306 __ LoadImmediate(R2, 1234, kNoRegister); |
| 1307 __ CompareRegisters(R1, R2); |
| 1308 __ csel(R0, R1, R2, GE); |
| 1309 __ ret(); |
| 1310 } |
| 1311 |
| 1312 |
| 1313 ASSEMBLER_TEST_RUN(CSelFalse, test) { |
| 1314 typedef int (*SimpleCode)(); |
| 1315 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1316 } |
| 1317 |
| 1318 |
1289 // Called from assembler_test.cc. | 1319 // Called from assembler_test.cc. |
1290 // LR: return address. | 1320 // LR: return address. |
1291 // R0: context. | 1321 // R0: context. |
1292 // R1: value. | 1322 // R1: value. |
1293 // R2: growable array. | 1323 // R2: growable array. |
1294 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 1324 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
1295 __ TagAndPushPP(); | 1325 __ TagAndPushPP(); |
1296 __ LoadPoolPointer(PP); | 1326 __ LoadPoolPointer(PP); |
1297 __ Push(CTX); | 1327 __ Push(CTX); |
1298 __ Push(LR); | 1328 __ Push(LR); |
1299 __ mov(CTX, R0); | 1329 __ mov(CTX, R0); |
1300 __ StoreIntoObject(R2, | 1330 __ StoreIntoObject(R2, |
1301 FieldAddress(R2, GrowableObjectArray::data_offset()), | 1331 FieldAddress(R2, GrowableObjectArray::data_offset()), |
1302 R1); | 1332 R1); |
1303 __ Pop(LR); | 1333 __ Pop(LR); |
1304 __ Pop(CTX); | 1334 __ Pop(CTX); |
1305 __ PopAndUntagPP(); | 1335 __ PopAndUntagPP(); |
1306 __ ret(); | 1336 __ ret(); |
1307 } | 1337 } |
1308 | 1338 |
1309 } // namespace dart | 1339 } // namespace dart |
1310 | 1340 |
1311 #endif // defined(TARGET_ARCH_ARM64) | 1341 #endif // defined(TARGET_ARCH_ARM64) |
OLD | NEW |