ir/tests/c/dessa_002.irt

38 lines
608 B
Plaintext
Raw Normal View History

2022-05-18 22:53:16 +02:00
--TEST--
DESSA 002
--ARGS--
--emit-c
--CODE--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_9);
int32_t d_5 = PHI(l_4, d_2, d_6);
int32_t d_6 = ADD(d_5, c_4);
l_7 = IF(l_4, d_6);
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, d_5);
}
--EXPECT--
int32_t test(int32_t x)
{
int32_t d_1 = x;
int32_t d_2;
bb2:
d_2 = d_1 + 1;
if (!d_2) goto bb5;
d_1 = d_2;
goto bb2;
bb5:
return d_1;
}