ir/tests/debug/params_003.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

53 lines
1.3 KiB
Plaintext

--TEST--
003: Parameter Loading and argument passing
--TARGET--
x86_64
--ARGS--
-S
--CODE--
{
uintptr_t f = func(printf);
uintptr_t fmt = "%d %d %d %d %d %d %d %d %d %d\n";
l_1 = START(l_3);
int32_t p_1 = PARAM(l_1, "p_1", 1);
int32_t p_2 = PARAM(l_1, "p_2", 2);
int32_t p_3 = PARAM(l_1, "p_3", 3);
int32_t p_4 = PARAM(l_1, "p_4", 4);
int32_t p_5 = PARAM(l_1, "p_5", 5);
int32_t p_6 = PARAM(l_1, "p_6", 6);
int32_t p_7 = PARAM(l_1, "p_7", 7);
int32_t p_8 = PARAM(l_1, "p_8", 8);
int32_t p_9 = PARAM(l_1, "p_9", 9);
int32_t p_10 = PARAM(l_1, "p_10", 10);
int32_t ret, l_2 = CALL/11(l_1, f, fmt, p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, p_9, p_10);
l_3 = RETURN(l_2, ret);
}
--EXPECT--
test:
subq $0x28, %rsp
movl %r9d, %eax
movl %eax, (%rsp)
movl %r8d, %r9d
movl %ecx, %r8d
movl %edx, %ecx
movl %esi, %edx
movl %edi, %esi
leaq .L1(%rip), %rdi
movl 0x30(%rsp), %eax
movl %eax, 8(%rsp)
movl 0x38(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x20(%rsp)
movabsq $_IO_printf, %rax
callq *%rax
addq $0x28, %rsp
retq
.rodata
.db 0x90, 0x90
.L1:
.db 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25
.db 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x0a, 0x00