mirror of
https://github.com/danog/ir.git
synced 2024-12-02 09:38:29 +01:00
66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
--TEST--
|
|
MAX 001:
|
|
--ARGS--
|
|
--run
|
|
--CODE--
|
|
extern func printf(uintptr_t, ...): int32_t;
|
|
func max8(int8_t, int8_t): int32_t
|
|
{
|
|
l_1 = START(l_5);
|
|
int8_t d_2 = PARAM(l_1, "arg_1", 1);
|
|
int8_t d_3 = PARAM(l_1, "arg_2", 2);
|
|
int8_t d_4 = MAX(d_2, d_3);
|
|
int32_t d_5 = SEXT(d_4);
|
|
l_5 = RETURN(l_1, d_5);
|
|
}
|
|
func max16(int16_t, int16_t): int32_t
|
|
{
|
|
l_1 = START(l_5);
|
|
int16_t d_2 = PARAM(l_1, "arg_1", 1);
|
|
int16_t d_3 = PARAM(l_1, "arg_2", 2);
|
|
int16_t d_4 = MAX(d_2, d_3);
|
|
int32_t d_5 = SEXT(d_4);
|
|
l_5 = RETURN(l_1, d_5);
|
|
}
|
|
func max32(int32_t, int32_t): int32_t
|
|
{
|
|
l_1 = START(l_5);
|
|
int32_t d_2 = PARAM(l_1, "arg_1", 1);
|
|
int32_t d_3 = PARAM(l_1, "arg_2", 2);
|
|
int32_t d_4 = MAX(d_2, d_3);
|
|
l_5 = RETURN(l_1, d_4);
|
|
}
|
|
func main(void): int32_t
|
|
{
|
|
uintptr_t c_1 = 0;
|
|
bool c_2 = 0;
|
|
bool c_3 = 1;
|
|
int32_t c_4 = 3;
|
|
int32_t c_5 = 4;
|
|
uintptr_t c_6 = func max8(int8_t, int8_t): int32_t;
|
|
int32_t c_7 = -6;
|
|
int32_t c_8 = -5;
|
|
uintptr_t c_9 = "t8 : %d %d\n";
|
|
uintptr_t c_10 = func printf(uintptr_t, ...): int32_t;
|
|
uintptr_t c_11 = func max16(int16_t, int16_t): int32_t;
|
|
uintptr_t c_12 = "i16: %d %d\n";
|
|
uintptr_t c_13 = func max32(int32_t, int32_t): int32_t;
|
|
uintptr_t c_14 = "i32: %d %d\n";
|
|
int32_t c_15 = 0;
|
|
l_1 = START(l_20);
|
|
int32_t d_2, l_2 = CALL/2(l_1, c_6, c_4, c_5);
|
|
int32_t d_4, l_4 = CALL/2(l_2, c_6, c_7, c_8);
|
|
int32_t d_6, l_6 = CALL/3(l_4, c_10, c_9, d_2, d_4);
|
|
int32_t d_8, l_8 = CALL/2(l_6, c_11, c_4, c_5);
|
|
int32_t d_10, l_10 = CALL/2(l_8, c_11, c_7, c_8);
|
|
int32_t d_12, l_12 = CALL/3(l_10, c_10, c_12, d_8, d_10);
|
|
int32_t d_14, l_14 = CALL/2(l_12, c_13, c_4, c_5);
|
|
int32_t d_16, l_16 = CALL/2(l_14, c_13, c_7, c_8);
|
|
int32_t d_18, l_18 = CALL/3(l_16, c_10, c_14, d_14, d_16);
|
|
l_20 = RETURN(l_18, c_15);
|
|
}
|
|
--EXPECT--
|
|
t8 : 4 -5
|
|
i16: 4 -5
|
|
i32: 4 -5
|