diff options
author | Alexandre Rames <alexandre.rames@uop.re> | 2017-02-05 20:22:52 -0800 |
---|---|---|
committer | Jacob Bramley <jacob.bramley@arm.com> | 2017-03-29 07:48:11 +0000 |
commit | 62799611b9a3406de8c456052a0e4e8c7d728203 (patch) | |
tree | 0b3d446ebabed65aaf214cef28e347f2d1f4a451 /test/aarch64 | |
parent | cf4b3000286d141e369c86e647bdd7dcf06e5dc0 (diff) | |
download | vixl-62799611b9a3406de8c456052a0e4e8c7d728203.tar.gz |
AArch64: Add support for `MacroAssembler::TailCallRuntime()`.
This is similar to the existing `MacroAssembler::CallRuntime()` but
uses (or behaves as when simulating) a branch instruction instead of
a 'branch and link' instruction.
Change-Id: I95f5ed010590edff93c09ac4eabf4334a13109ea
Diffstat (limited to 'test/aarch64')
-rw-r--r-- | test/aarch64/test-assembler-aarch64.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/aarch64/test-assembler-aarch64.cc b/test/aarch64/test-assembler-aarch64.cc index 63a6278f..db54fd29 100644 --- a/test/aarch64/test-assembler-aarch64.cc +++ b/test/aarch64/test-assembler-aarch64.cc @@ -23258,6 +23258,9 @@ TEST(runtime_calls) { #endif START(); + + // Test `CallRuntime`. + __ Mov(w0, 0); __ CallRuntime(runtime_call_add_one); __ Mov(w20, w0); @@ -23281,6 +23284,27 @@ TEST(runtime_calls) { __ Fmov(d21, d0); __ Pop(d1, d0); + // Test `TailCallRuntime`. + + Label function, after_function; + __ B(&after_function); + __ Bind(&function); + __ Mov(x22, 0); + __ Mov(w0, 123); + __ TailCallRuntime(runtime_call_add_one); + // Control should not fall through. + __ Mov(x22, 0xbad); + __ Ret(); + __ Bind(&after_function); + + // Call our dummy function, taking care to preserve the link register. + __ Push(ip0, lr); + __ Bl(&function); + __ Pop(lr, ip0); + // Save the result. + __ Mov(w23, w0); + + int64_t value = 0xbadbeef; __ Mov(x0, reinterpret_cast<uint64_t>(&value)); __ CallRuntime(runtime_call_store_at_address); @@ -23296,6 +23320,8 @@ TEST(runtime_calls) { ASSERT_EQUAL_64(0x123, x21); ASSERT_EQUAL_FP64(310.0, d21); VIXL_CHECK(value == 0xf00d); + ASSERT_EQUAL_64(0, x22); + ASSERT_EQUAL_32(124, w23); #endif // #if defined(VIXL_HAS_SIMULATED_RUNTIME_CALL_SUPPORT) || ... TEARDOWN(); |