ir/tests/debug.x86/params_003.irt
Dmitry Stogov 09829a9e69 Fixed x86_64 calling convention for vararg functions
%al is used as a hidden register to specify the number of passed vector registers
2023-09-27 10:23:34 +03:00

57 lines
1.4 KiB
Plaintext

--TEST--
003: Parameter Loading and argument passing
--TARGET--
x86
--ARGS--
-S
--CODE--
{
uintptr_t f = func(printf, 4);
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:
subl $0x2c, %esp
movl $.L1, (%esp)
movl 0x30(%esp), %eax
movl %eax, 4(%esp)
movl 0x34(%esp), %eax
movl %eax, 8(%esp)
movl 0x38(%esp), %eax
movl %eax, 0xc(%esp)
movl 0x3c(%esp), %eax
movl %eax, 0x10(%esp)
movl 0x40(%esp), %eax
movl %eax, 0x14(%esp)
movl 0x44(%esp), %eax
movl %eax, 0x18(%esp)
movl 0x48(%esp), %eax
movl %eax, 0x1c(%esp)
movl 0x4c(%esp), %eax
movl %eax, 0x20(%esp)
movl 0x50(%esp), %eax
movl %eax, 0x24(%esp)
movl 0x54(%esp), %eax
movl %eax, 0x28(%esp)
calll printf
addl $0x2c, %esp
retl
.rodata
.db 0x90, 0x90, 0x90, 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