diff --git a/tests/c/ge_004.irt b/tests/c/ge_004.irt new file mode 100644 index 0000000..e126194 --- /dev/null +++ b/tests/c/ge_004.irt @@ -0,0 +1,21 @@ +--TEST-- +004: ge function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + uint32_t x = PARAM(l_1, "x", 1); + uint32_t y = PARAM(l_1, "y", 2); + bool ret = GE(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(uint32_t x, uint32_t y) +{ + uint32_t d_1 = x; + uint32_t d_2 = y; + bool d_3; + d_3 = d_2 <= d_1; + return d_3; +} diff --git a/tests/c/ge_006.irt b/tests/c/ge_006.irt new file mode 100644 index 0000000..c7d78fb --- /dev/null +++ b/tests/c/ge_006.irt @@ -0,0 +1,21 @@ +--TEST-- +006: ge function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + double x = PARAM(l_1, "x", 1); + double y = PARAM(l_1, "y", 2); + bool ret = GE(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(double x, double y) +{ + double d_1 = x; + double d_2 = y; + bool d_3; + d_3 = d_2 <= d_1; + return d_3; +} diff --git a/tests/c/gt_004.irt b/tests/c/gt_004.irt new file mode 100644 index 0000000..7ac223d --- /dev/null +++ b/tests/c/gt_004.irt @@ -0,0 +1,21 @@ +--TEST-- +004: gt function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + uint32_t x = PARAM(l_1, "x", 1); + uint32_t y = PARAM(l_1, "y", 2); + bool ret = GT(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(uint32_t x, uint32_t y) +{ + uint32_t d_1 = x; + uint32_t d_2 = y; + bool d_3; + d_3 = d_2 < d_1; + return d_3; +} diff --git a/tests/c/gt_006.irt b/tests/c/gt_006.irt new file mode 100644 index 0000000..63d85ae --- /dev/null +++ b/tests/c/gt_006.irt @@ -0,0 +1,21 @@ +--TEST-- +006: gt function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + double x = PARAM(l_1, "x", 1); + double y = PARAM(l_1, "y", 2); + bool ret = GT(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(double x, double y) +{ + double d_1 = x; + double d_2 = y; + bool d_3; + d_3 = d_2 < d_1; + return d_3; +} diff --git a/tests/c/le_004.irt b/tests/c/le_004.irt new file mode 100644 index 0000000..b0e98b3 --- /dev/null +++ b/tests/c/le_004.irt @@ -0,0 +1,21 @@ +--TEST-- +004: le function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + uint32_t x = PARAM(l_1, "x", 1); + uint32_t y = PARAM(l_1, "y", 2); + bool ret = LE(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(uint32_t x, uint32_t y) +{ + uint32_t d_1 = x; + uint32_t d_2 = y; + bool d_3; + d_3 = d_2 >= d_1; + return d_3; +} diff --git a/tests/c/le_006.irt b/tests/c/le_006.irt new file mode 100644 index 0000000..dc7e6d9 --- /dev/null +++ b/tests/c/le_006.irt @@ -0,0 +1,21 @@ +--TEST-- +006: le function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + double x = PARAM(l_1, "x", 1); + double y = PARAM(l_1, "y", 2); + bool ret = LE(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(double x, double y) +{ + double d_1 = x; + double d_2 = y; + bool d_3; + d_3 = d_2 >= d_1; + return d_3; +} diff --git a/tests/c/lt_004.irt b/tests/c/lt_004.irt new file mode 100644 index 0000000..398b017 --- /dev/null +++ b/tests/c/lt_004.irt @@ -0,0 +1,21 @@ +--TEST-- +004: lt function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + uint32_t x = PARAM(l_1, "x", 1); + uint32_t y = PARAM(l_1, "y", 2); + bool ret = LT(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(uint32_t x, uint32_t y) +{ + uint32_t d_1 = x; + uint32_t d_2 = y; + bool d_3; + d_3 = d_2 > d_1; + return d_3; +} diff --git a/tests/c/lt_006.irt b/tests/c/lt_006.irt new file mode 100644 index 0000000..c4caa96 --- /dev/null +++ b/tests/c/lt_006.irt @@ -0,0 +1,21 @@ +--TEST-- +006: lt function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + double x = PARAM(l_1, "x", 1); + double y = PARAM(l_1, "y", 2); + bool ret = LT(x, y); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(double x, double y) +{ + double d_1 = x; + double d_2 = y; + bool d_3; + d_3 = d_2 > d_1; + return d_3; +} diff --git a/tests/c/not_003.irt b/tests/c/not_003.irt new file mode 100644 index 0000000..65ed480 --- /dev/null +++ b/tests/c/not_003.irt @@ -0,0 +1,19 @@ +--TEST-- +003: not function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + uint32_t x = PARAM(l_1, "x", 1); + bool ret = NOT(x); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(uint32_t x) +{ + uint32_t d_1 = x; + bool d_2; + d_2 = !d_1; + return d_2; +} diff --git a/tests/c/not_004.irt b/tests/c/not_004.irt new file mode 100644 index 0000000..0ae734f --- /dev/null +++ b/tests/c/not_004.irt @@ -0,0 +1,19 @@ +--TEST-- +004: not function +--ARGS-- +--emit-c +--CODE-- +{ + l_1 = START(l_4); + double x = PARAM(l_1, "x", 1); + bool ret = NOT(x); + l_4 = RETURN(l_1, ret); +} +--EXPECT-- +bool test(double x) +{ + double d_1 = x; + bool d_2; + d_2 = !d_1; + return d_2; +} diff --git a/tests/llvm/guard_001.irt b/tests/llvm/guard_001.irt new file mode 100644 index 0000000..c894f4b --- /dev/null +++ b/tests/llvm/guard_001.irt @@ -0,0 +1,22 @@ +--TEST-- +GUARD +--ARGS-- +--emit-llvm +--CODE-- +{ + uintptr_t exit = 0xbaddad; + l_1 = START(l_4); + int32_t cond = PARAM(l_1, "cond", 1); + l_2 = GUARD(l_1, cond, exit); + l_4 = RETURN(l_2); +} +--EXPECT-- +define void @test(i32 %d2) +{ + %t3 = icmp ne i32 %d2, 0 + br i1 %t3, label %l3_true, label %l3_false +l3_false: + indirectbr ptr inttoptr(i64 u0xbaddad to ptr), [] +l3_true: + ret void +} diff --git a/tests/llvm/guard_002.irt b/tests/llvm/guard_002.irt new file mode 100644 index 0000000..b3e9819 --- /dev/null +++ b/tests/llvm/guard_002.irt @@ -0,0 +1,22 @@ +--TEST-- +GUARD_NOT +--ARGS-- +--emit-llvm +--CODE-- +{ + uintptr_t exit = 0xbaddad; + l_1 = START(l_4); + int32_t cond = PARAM(l_1, "cond", 1); + l_2 = GUARD_NOT(l_1, cond, exit); + l_4 = RETURN(l_2); +} +--EXPECT-- +define void @test(i32 %d2) +{ + %t3 = icmp ne i32 %d2, 0 + br i1 %t3, label %l3_true, label %l3_false +l3_true: + indirectbr ptr inttoptr(i64 u0xbaddad to ptr), [] +l3_false: + ret void +} diff --git a/tests/llvm/ijmp_002.irt b/tests/llvm/ijmp_002.irt new file mode 100644 index 0000000..ea8f0d9 --- /dev/null +++ b/tests/llvm/ijmp_002.irt @@ -0,0 +1,15 @@ +--TEST-- +002: IJMP - computed goto (constant addr) +--ARGS-- +--emit-llvm +--CODE-- +{ + uintptr_t p = 0xbaddad; + l_1 = START(l_2); + l_2 = IJMP(l_1, p); +} +--EXPECT-- +define void @test() +{ + indirectbr ptr inttoptr(i64 u0xbaddad to ptr), [] +}