ir/tests/debug.aarch64/args_001.irt
Dmitry Stogov 9eb366698d Avoid reservaton of temporary resiser for argument passing
We may use any scratch register that is not used for parameters
2023-04-26 12:16:05 +03:00

58 lines
1.2 KiB
Plaintext

--TEST--
001: Argument Passing
--TARGET--
aarch64
--ARGS--
-S --run
--CODE--
{
int8_t c_1 = 1;
int16_t c_2 = 2;
int32_t c_3 = 3;
int64_t c_4 = 4;
int64_t c_5 = 0x100000000;
uint8_t c_6 = 6;
uint16_t c_7 = 7;
uint32_t c_8 = 8;
int64_t c_9 = 9;
int64_t c_10 = 0x100000000;
uintptr_t f = func(printf);
uintptr_t fmt = "%d %d %d %lld 0x%llx %d %d %d %lld 0x%llx\n";
l_1 = START(l_3);
int32_t d_2, l_2 = CALL/11(l_1, f, fmt, c_1, c_2, c_3, c_4, c_5, c_6, c_7, c_8, c_9, c_10);
l_3 = RETURN(l_2, d_2);
}
--EXPECT--
test:
stp x29, x30, [sp, #-0x10]!
mov x29, sp
sub sp, sp, #0x20
adr x0, .L1
movz x1, #0x1
movz w2, #0x2
movz w3, #0x3
movz x4, #0x4
movz x5, #0x1, lsl #32
movz x6, #0x6
movz w7, #0x7
movz w16, #0x8
str x16, [sp]
movz x16, #0x9
str x16, [sp, #8]
movz x16, #0x1, lsl #32
str x16, [sp, #0x10]
bl _IO_printf
add sp, sp, #0x20
ldp x29, x30, [sp], #0x10
ret
.rodata
.db 0x1f, 0x20, 0x03, 0xd5
.L1:
.db 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x6c, 0x6c, 0x64, 0x20, 0x30, 0x78
.db 0x25, 0x6c, 0x6c, 0x78, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x6c
.db 0x6c, 0x64, 0x20, 0x30, 0x78, 0x25, 0x6c, 0x6c, 0x78, 0x0a, 0x00, 0x00
1 2 3 4 0x100000000 6 7 8 9 0x100000000
exit code = 40