mirror of
https://github.com/danog/ir.git
synced 2024-11-27 04:45:38 +01:00
49 lines
999 B
Plaintext
49 lines
999 B
Plaintext
|
--TEST--
|
||
|
Combo 004
|
||
|
--TARGET--
|
||
|
x86
|
||
|
--ARGS--
|
||
|
-S
|
||
|
--CODE--
|
||
|
# Figure 3.9 from "Combining Analyses, Combining Optimization" by C.Click
|
||
|
{
|
||
|
uintptr_t c_1 = 0;
|
||
|
bool c_2 = 0;
|
||
|
bool c_3 = 1;
|
||
|
int32_t i_1 = 1;
|
||
|
int32_t i_2 = 2;
|
||
|
ll_1 = START(ll_16);
|
||
|
bool cond = PARAM(ll_1, "cond", 0);
|
||
|
int32_t ret = PARAM(ll_1, "ret", 1);
|
||
|
int32_t x_0 = COPY(i_1);
|
||
|
ll_2 = END(ll_1);
|
||
|
ll_3 = LOOP_BEGIN(ll_2, ll_12);
|
||
|
int32_t x_1 = PHI(ll_3, x_0, x_3);
|
||
|
bool b = NE(x_1, i_1);
|
||
|
ll_4 = IF(ll_3, b);
|
||
|
ll_5 = IF_TRUE(ll_4);
|
||
|
int32_t x_2 = COPY(i_2);
|
||
|
ll_6 = END(ll_5);
|
||
|
ll_7 = IF_FALSE(ll_4);
|
||
|
ll_72 = END(ll_7);
|
||
|
ll_8 = MERGE(ll_6, ll_72);
|
||
|
int32_t x_3 = PHI(ll_8, x_2, x_1);
|
||
|
ll_10 = IF(ll_8, cond);
|
||
|
ll_11 = IF_TRUE(ll_10);
|
||
|
ll_12 = LOOP_END(ll_11, ll_3);
|
||
|
ll_13 = IF_FALSE(ll_10);
|
||
|
int32_t xx = MUL(x_3, i_2);
|
||
|
int32_t yy = MUL(xx, ret);
|
||
|
ll_16 = RETURN(ll_13, yy);
|
||
|
}
|
||
|
--EXPECT--
|
||
|
test:
|
||
|
movb 4(%esp), %al
|
||
|
movl 8(%esp), %ecx
|
||
|
leal (%ecx, %ecx), %ecx
|
||
|
.L1:
|
||
|
testb %al, %al
|
||
|
jne .L1
|
||
|
movl %ecx, %eax
|
||
|
retl
|