ir/tests/debug/ra_003.irt
2023-11-30 21:10:41 +03:00

42 lines
857 B
Plaintext

--TEST--
003: Register Allocation (spill load into result - movsd (%rsp), %xmm1)
--TARGET--
x86_64
--ARGS--
-S
--CODE--
{
uintptr_t fn = func printf(uintptr_t, ...): int32_t;
uintptr_t format = "hello\n";
l_1 = START(l_3);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double z = PARAM(l_1, "z", 2);
l_2 = CALL(l_1, fn, format);
double ret1 = ADD(x, x);
double ret2 = SUB(y, z);
double ret = ADD(ret1, ret2);
l_3 = RETURN(l_2, ret);
}
--EXPECT--
test:
subq $0x18, %rsp
movsd %xmm0, (%rsp)
movsd %xmm1, 8(%rsp)
movsd %xmm2, 0x10(%rsp)
leaq .L1(%rip), %rdi
movl $0, %eax
movabsq $printf, %r11
callq *%r11
movsd (%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 8(%rsp), %xmm0
subsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
addq $0x18, %rsp
retq
.rodata
.db 0x90, 0x90, 0x90, 0x90
.L1:
.db 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x0a, 0x00