2023-06-20 07:34:54 +02:00
|
|
|
--TEST--
|
|
|
|
002: Register Allocation (spill load into result - movsd (%rsp), %xmm1)
|
|
|
|
--TARGET--
|
|
|
|
x86_64
|
|
|
|
--ARGS--
|
|
|
|
-S
|
|
|
|
--CODE--
|
|
|
|
{
|
2023-09-27 09:23:34 +02:00
|
|
|
uintptr_t fn = func(printf, 4);
|
2023-06-20 07:34:54 +02:00
|
|
|
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 = SUB(x, y);
|
|
|
|
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
|
2023-09-27 09:23:34 +02:00
|
|
|
movl $0, %eax
|
|
|
|
movabsq $printf, %r11
|
|
|
|
callq *%r11
|
2023-06-20 07:34:54 +02:00
|
|
|
movsd (%rsp), %xmm1
|
|
|
|
subsd 8(%rsp), %xmm1
|
|
|
|
movsd 8(%rsp), %xmm0
|
|
|
|
subsd 0x10(%rsp), %xmm0
|
|
|
|
addsd %xmm1, %xmm0
|
|
|
|
addq $0x18, %rsp
|
|
|
|
retq
|
|
|
|
.rodata
|
2023-09-27 09:23:34 +02:00
|
|
|
.db 0x90, 0x90
|
2023-06-20 07:34:54 +02:00
|
|
|
.L1:
|
|
|
|
.db 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x0a, 0x00
|