mirror of
https://github.com/danog/ir.git
synced 2024-12-12 17:27:25 +01:00
7058c41411
This also fixes possbile incorrect register-allocation/code-generation for SHIFT instuction on x86[_64]
184 lines
5.1 KiB
Plaintext
Executable File
184 lines
5.1 KiB
Plaintext
Executable File
--TEST--
|
|
Test
|
|
--TARGET--
|
|
Windows-x86_64
|
|
--ARGS--
|
|
--debug-regset 0x3ffff --save --dump-live-ranges -S
|
|
--CODE--
|
|
{
|
|
uintptr_t c_1 = 0;
|
|
bool c_2 = 0;
|
|
bool c_3 = 1;
|
|
double c_4 = 0.5;
|
|
double c_5 = 0;
|
|
int32_t c_6 = 0;
|
|
int32_t c_7 = 1;
|
|
double c_8 = 16;
|
|
int32_t c_9 = 1000;
|
|
l_1 = START(l_35);
|
|
double d_2 = PARAM(l_1, "x", 0);
|
|
double d_3 = PARAM(l_1, "y", 1);
|
|
double d_4 = VAR(l_1, "cr");
|
|
double d_5 = SUB(d_3, c_4);
|
|
double d_6 = VAR(l_1, "ci");
|
|
double d_7 = VAR(l_1, "zi");
|
|
double d_8 = VAR(l_1, "zr");
|
|
int32_t d_9 = VAR(l_1, "i");
|
|
l_10 = END(l_1);
|
|
l_11 = LOOP_BEGIN(l_10, l_37);
|
|
double d_12 = PHI(l_11, c_5, d_25);
|
|
double d_13 = PHI(l_11, c_5, d_23);
|
|
int32_t d_14 = PHI(l_11, c_6, d_15);
|
|
int32_t d_15 = ADD(d_14, c_7);
|
|
double d_16 = VAR(l_11, "temp");
|
|
double d_17 = MUL(d_13, d_12);
|
|
double d_18 = VAR(l_11, "zr2");
|
|
double d_19 = MUL(d_13, d_13);
|
|
double d_20 = VAR(l_11, "zi2");
|
|
double d_21 = MUL(d_12, d_12);
|
|
double d_22 = SUB(d_19, d_21);
|
|
double d_23 = ADD(d_22, d_5);
|
|
double d_24 = ADD(d_17, d_17);
|
|
double d_25 = ADD(d_24, d_2);
|
|
double d_26 = ADD(d_21, d_19);
|
|
bool d_27 = GT(d_26, c_8);
|
|
l_28 = IF(l_11, d_27);
|
|
l_29 = IF_TRUE(l_28);
|
|
l_30 = RETURN(l_29, d_15);
|
|
l_31 = IF_FALSE(l_28);
|
|
bool d_32 = GT(d_15, c_9);
|
|
l_33 = IF(l_31, d_32);
|
|
l_34 = IF_TRUE(l_33);
|
|
l_35 = RETURN(l_34, c_6, l_30);
|
|
l_36 = IF_FALSE(l_33);
|
|
l_37 = LOOP_END(l_36);
|
|
}
|
|
--EXPECT--
|
|
{
|
|
uintptr_t c_1 = 0;
|
|
bool c_2 = 0;
|
|
bool c_3 = 1;
|
|
double c_4 = 0.5;
|
|
double c_5 = 0;
|
|
int32_t c_6 = 0;
|
|
int32_t c_7 = 1;
|
|
double c_8 = 16;
|
|
int32_t c_9 = 1000;
|
|
l_1 = START(l_30);
|
|
double d_2 = PARAM(l_1, "x", 0);
|
|
double d_3 = PARAM(l_1, "y", 1);
|
|
double d_4 = VAR(l_1, "cr");
|
|
double d_5 = SUB(d_3, c_4);
|
|
double d_6 = VAR(l_1, "ci");
|
|
double d_7 = VAR(l_1, "zi");
|
|
double d_8 = VAR(l_1, "zr");
|
|
int32_t d_9 = VAR(l_1, "i");
|
|
l_10 = END(l_1);
|
|
l_11 = LOOP_BEGIN(l_10, l_37);
|
|
double d_12 = PHI(l_11, c_5, d_36);
|
|
double d_13 = PHI(l_11, c_5, d_34);
|
|
int32_t d_14 = PHI(l_11, c_6, d_15);
|
|
int32_t d_15 = ADD(d_14, c_7);
|
|
double d_16 = VAR(l_11, "temp");
|
|
double d_17 = VAR(l_11, "zr2");
|
|
double d_18 = MUL(d_13, d_13);
|
|
double d_19 = VAR(l_11, "zi2");
|
|
double d_20 = MUL(d_12, d_12);
|
|
double d_21 = ADD(d_20, d_18);
|
|
bool d_22 = GT(d_21, c_8);
|
|
l_23 = IF(l_11, d_22);
|
|
l_24 = IF_TRUE(l_23);
|
|
l_25 = RETURN(l_24, d_15);
|
|
l_26 = IF_FALSE(l_23);
|
|
bool d_27 = GT(d_15, c_9);
|
|
l_28 = IF(l_26, d_27);
|
|
l_29 = IF_TRUE(l_28);
|
|
l_30 = RETURN(l_29, c_6, l_25);
|
|
l_31 = IF_FALSE(l_28);
|
|
double d_32 = MUL(d_12, d_13);
|
|
double d_33 = SUB(d_18, d_20);
|
|
double d_34 = ADD(d_33, d_5);
|
|
double d_35 = ADD(d_32, d_32);
|
|
double d_36 = ADD(d_35, d_2);
|
|
l_37 = LOOP_END(l_31);
|
|
}
|
|
{ # LIVE-RANGES (vregs_count=12)
|
|
TMP
|
|
[%xmm0]: [10.2-10.3)/1
|
|
[%eax]: [10.2-10.3)/0
|
|
R1 (d_2) [SPILL=0x0]
|
|
[%xmm0]: [2.3-10.2), DEF(2.3, hint=%xmm0)
|
|
: [10.2-24.0), [26.0-29.0), [31.0-36.0)
|
|
: [36.0-38.0), USE(36.1/2)
|
|
R2 (d_3) [%xmm1]: [3.3-5.0), DEF(3.3, hint=%xmm1), USE(5.0/1, hint=R3)
|
|
R3 (d_5) [SPILL=0x8]
|
|
[%xmm1]: [5.0-10.2), DEF(5.0, hint=R2)!
|
|
: [10.2-24.0), [26.0-29.0), [31.0-34.0)
|
|
: [34.0-38.0), USE(34.1/2)
|
|
R4 (d_12, d_36) [SPILL=0x10]
|
|
: [11.0-24.0), [26.0-29.0), [31.0-32.0), DEF(12.2), USE(20.0/1, hint=R8), USE(20.0/2), USE(32.0/1)
|
|
[%xmm0]: [36.0-38.0), DEF(36.0, hint=R12)!, PHI_USE(37.2, phi=d_12/3)
|
|
R5 (d_13, d_34) [SPILL=0x18]
|
|
[%xmm0]: [11.0-20.0), DEF(13.2), USE(18.0/1, hint=R7), USE(18.0/2)
|
|
: [20.0-24.0), [26.0-29.0), [31.0-32.0)
|
|
: [32.0-32.1), USE(32.1/2, hint=R10)
|
|
[%xmm1]: [34.0-38.0), DEF(34.0, hint=R11)!, PHI_USE(37.2, phi=d_13/3)
|
|
R6 (d_14, d_15) [%eax]: [11.0-15.1), [15.2-25.0), [26.0-29.0), [31.0-38.0), DEF(14.2), USE(15.1/1)!, DEF(15.2)!, USE(25.0/2, hint=%eax), USE(28.1/27.1), PHI_USE(37.2, phi=d_14/3)
|
|
R7 (d_18) [%xmm1]: [18.0-24.0), [26.0-29.0), [31.0-33.0), DEF(18.0, hint=R5)!, USE(21.1/2), USE(33.0/1, hint=R11)
|
|
R8 (d_20) [SPILL=0x20]
|
|
[%xmm0]: [20.0-21.0), DEF(20.0, hint=R4)!, USE(21.0/1, hint=R9)
|
|
: [21.0-24.0), [26.0-29.0), [31.0-33.0)
|
|
: [33.0-33.1), USE(33.1/2)
|
|
R9 (d_21) [%xmm0]: [21.0-23.1), DEF(21.0, hint=R8)!, USE(23.1/22.1)!
|
|
R10 (d_32) [%xmm0]: [32.0-35.0), DEF(32.0, hint=R4)!, USE(35.0/1, hint=R12), USE(35.0/2)
|
|
R11 (d_33) [%xmm1]: [33.0-34.0), DEF(33.0, hint=R7)!, USE(34.0/1, hint=R5)
|
|
R12 (d_35) [%xmm0]: [35.0-36.0), DEF(35.0, hint=R10)!, USE(36.0/1, hint=R4)
|
|
[%rax] : [25.0-25.1), [30.0-30.1)
|
|
[%xmm0] : [1.0-2.3)
|
|
[%xmm1] : [1.0-3.3)
|
|
}
|
|
test:
|
|
subq $0x28, %rsp
|
|
movsd %xmm0, (%rsp)
|
|
subsd .L4(%rip), %xmm1
|
|
movsd %xmm1, 8(%rsp)
|
|
xorpd %xmm0, %xmm0
|
|
movsd %xmm0, 0x10(%rsp)
|
|
xorpd %xmm0, %xmm0
|
|
movsd %xmm0, 0x18(%rsp)
|
|
xorl %eax, %eax
|
|
.L1:
|
|
leal 1(%rax), %eax
|
|
movsd 0x18(%rsp), %xmm1
|
|
mulsd %xmm1, %xmm1
|
|
movsd 0x10(%rsp), %xmm0
|
|
mulsd %xmm0, %xmm0
|
|
movsd %xmm0, 0x20(%rsp)
|
|
addsd %xmm1, %xmm0
|
|
ucomisd .L5(%rip), %xmm0
|
|
ja .L2
|
|
cmpl $0x3e8, %eax
|
|
jg .L3
|
|
movsd 0x10(%rsp), %xmm0
|
|
mulsd 0x18(%rsp), %xmm0
|
|
subsd 0x20(%rsp), %xmm1
|
|
addsd 8(%rsp), %xmm1
|
|
movsd %xmm1, 0x18(%rsp)
|
|
addsd %xmm0, %xmm0
|
|
addsd (%rsp), %xmm0
|
|
movsd %xmm0, 0x10(%rsp)
|
|
jmp .L1
|
|
.L2:
|
|
addq $0x28, %rsp
|
|
retq
|
|
.L3:
|
|
xorl %eax, %eax
|
|
addq $0x28, %rsp
|
|
retq
|
|
.rodata
|
|
.db 0x90, 0x90, 0x90, 0x90, 0x90
|
|
.L4:
|
|
.db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f
|
|
.L5:
|
|
.db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40
|