2022-11-08 09:56:22 +01:00
|
|
|
--TEST--
|
|
|
|
FibI
|
|
|
|
--TARGET--
|
|
|
|
aarch64
|
|
|
|
--ARGS--
|
|
|
|
--save --dump-live-ranges -S --run
|
|
|
|
--CODE--
|
|
|
|
{
|
|
|
|
int32_t c_0 = 0;
|
|
|
|
int32_t c_1 = 1;
|
|
|
|
int32_t c_10000 = 10000;
|
|
|
|
uintptr_t f = func(printf);
|
|
|
|
uintptr_t format = "%d\n";
|
|
|
|
l_1 = START(l_6);
|
|
|
|
int32_t lo_1 = COPY(c_0);
|
|
|
|
int32_t hi_1 = COPY(c_1);
|
|
|
|
l_2 = END(l_1);
|
|
|
|
l_3 = LOOP_BEGIN(l_2, l_9);
|
|
|
|
int32_t lo_2 = PHI(l_3, lo_1, lo_3);
|
|
|
|
int32_t hi_2 = PHI(l_3, hi_1, hi_3);
|
|
|
|
bool b = LT(hi_2, c_10000);
|
|
|
|
l_4 = IF(l_3, b);
|
|
|
|
l_7 = IF_TRUE(l_4);
|
|
|
|
int32_t hi_3 = ADD(hi_2, lo_2);
|
|
|
|
int32_t lo_3 = SUB(hi_3, lo_2);
|
|
|
|
l_8 = CALL/2(l_7, f, format, lo_3);
|
2023-03-22 22:47:27 +01:00
|
|
|
l_9 = LOOP_END(l_8);
|
2022-11-08 09:56:22 +01:00
|
|
|
l_5 = IF_FALSE(l_4);
|
|
|
|
l_6 = RETURN(l_5, c_0);
|
|
|
|
}
|
|
|
|
--EXPECT--
|
|
|
|
{
|
|
|
|
uintptr_t c_1 = 0;
|
|
|
|
bool c_2 = 0;
|
|
|
|
bool c_3 = 1;
|
|
|
|
int32_t c_4 = 0;
|
|
|
|
int32_t c_5 = 1;
|
|
|
|
int32_t c_6 = 10000;
|
|
|
|
uintptr_t c_7 = func(printf);
|
|
|
|
uintptr_t c_8 = "%d\n";
|
2023-03-29 13:07:31 +02:00
|
|
|
l_1 = START(l_14);
|
2022-11-08 09:56:22 +01:00
|
|
|
l_2 = END(l_1);
|
2023-03-29 13:07:31 +02:00
|
|
|
l_3 = LOOP_BEGIN(l_2, l_12);
|
|
|
|
int32_t d_4 = PHI(l_3, c_4, d_5);
|
2022-11-08 09:56:22 +01:00
|
|
|
int32_t d_5 = PHI(l_3, c_5, d_9);
|
|
|
|
bool d_6 = LT(d_5, c_6);
|
|
|
|
l_7 = IF(l_3, d_6);
|
|
|
|
l_8 = IF_TRUE(l_7);
|
|
|
|
int32_t d_9 = ADD(d_5, d_4);
|
2023-03-29 13:07:31 +02:00
|
|
|
l_10 = CALL/2(l_8, c_7, c_8, d_5);
|
|
|
|
l_12 = LOOP_END(l_10);
|
|
|
|
l_13 = IF_FALSE(l_7);
|
|
|
|
l_14 = RETURN(l_13, c_4);
|
2022-11-08 09:56:22 +01:00
|
|
|
}
|
2023-03-29 13:07:31 +02:00
|
|
|
{ # LIVE-RANGES (vregs_count=3)
|
2022-11-08 09:56:22 +01:00
|
|
|
TMP
|
2023-04-05 18:20:43 +02:00
|
|
|
[%w0]: [2.2-2.3)/1
|
|
|
|
[%w1]: [7.0-7.2)/6.2
|
|
|
|
[%w0]: [12.2-12.3)/1
|
2023-03-29 13:07:31 +02:00
|
|
|
R1 (d_4) [%w0]: [3.0-9.1), DEF(4.2), USE(9.1/2)!
|
2023-04-05 18:20:43 +02:00
|
|
|
R2 (d_5) [%w18]: [3.0-13.0), DEF(5.2), USE(7.1/6.1)!, USE(9.1/1)!, USE(10.0/4, hint=%w1), PHI_USE(12.2, phi=d_4/3)
|
2023-03-29 13:07:31 +02:00
|
|
|
R3 (d_9) [%w20]: [9.2-13.0), DEF(9.2)!, PHI_USE(12.2, phi=d_5/3)
|
|
|
|
[%x0] : [10.0-10.1), [14.0-14.1)
|
|
|
|
[%x1] : [10.0-10.1)
|
|
|
|
[%SCRATCH] : [10.1-10.2)
|
2022-11-08 09:56:22 +01:00
|
|
|
}
|
|
|
|
test:
|
|
|
|
stp x29, x30, [sp, #-0x20]!
|
|
|
|
mov x29, sp
|
|
|
|
stp x19, x20, [x29, #0x10]
|
2023-03-29 13:07:31 +02:00
|
|
|
mov w0, wzr
|
2022-11-08 09:56:22 +01:00
|
|
|
movz w19, #0x1
|
|
|
|
.L1:
|
2023-03-29 13:07:31 +02:00
|
|
|
movz w1, #0x2710
|
|
|
|
cmp w19, w1
|
2022-11-08 09:56:22 +01:00
|
|
|
b.ge .L2
|
2023-03-29 13:07:31 +02:00
|
|
|
add w20, w19, w0
|
|
|
|
mov w1, w19
|
2022-11-08 09:56:22 +01:00
|
|
|
adr x0, .L3
|
|
|
|
bl _IO_printf
|
2023-03-29 13:07:31 +02:00
|
|
|
mov w0, w19
|
|
|
|
mov w19, w20
|
2022-11-08 09:56:22 +01:00
|
|
|
b .L1
|
|
|
|
.L2:
|
|
|
|
mov w0, wzr
|
|
|
|
ldp x19, x20, [x29, #0x10]
|
|
|
|
ldp x29, x30, [sp], #0x20
|
|
|
|
ret
|
|
|
|
.rodata
|
2023-03-29 13:07:31 +02:00
|
|
|
.db 0x1f, 0x20, 0x03, 0xd5
|
2022-11-08 09:56:22 +01:00
|
|
|
.L3:
|
|
|
|
.db 0x25, 0x64, 0x0a, 0x00
|
|
|
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
5
|
|
|
|
8
|
|
|
|
13
|
|
|
|
21
|
|
|
|
34
|
|
|
|
55
|
|
|
|
89
|
|
|
|
144
|
|
|
|
233
|
|
|
|
377
|
|
|
|
610
|
|
|
|
987
|
|
|
|
1597
|
|
|
|
2584
|
|
|
|
4181
|
|
|
|
6765
|
|
|
|
|
|
|
|
exit code = 0
|