aboutsummaryrefslogtreecommitdiff
path: root/rcc-legacy/tests/functional/try_fold_lhs.sy
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
commit72af0dedf9e18911da65b9a5c4906689e868d9fc (patch)
tree2ecbad93f96ab8ad7e26dc02cd02d802f853ab97 /rcc-legacy/tests/functional/try_fold_lhs.sy
parent8faf6d290d6703b1775e0ad7a8928a4ebea4b11b (diff)
downloadrcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.gz
rcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.xz
[legacy] Add functional and performance test suites
Diffstat (limited to 'rcc-legacy/tests/functional/try_fold_lhs.sy')
-rw-r--r--rcc-legacy/tests/functional/try_fold_lhs.sy78
1 files changed, 78 insertions, 0 deletions
diff --git a/rcc-legacy/tests/functional/try_fold_lhs.sy b/rcc-legacy/tests/functional/try_fold_lhs.sy
new file mode 100644
index 0000000..b12a2e6
--- /dev/null
+++ b/rcc-legacy/tests/functional/try_fold_lhs.sy
@@ -0,0 +1,78 @@
+int f() {
+ return 233;
+}
+
+int g1() {
+ int a = f();
+ int b = a + 456;
+ int c = b + 123;
+ return c;
+}
+
+int g2() {
+ int a = f();
+ int b = a + 456;
+ int c = b - 123;
+ return c;
+}
+
+int g3() {
+ int a = f();
+ int b = a + 456;
+ int c = 123 - b;
+ return c;
+}
+
+int g4() {
+ int a = f();
+ int b = a - 456;
+ int c = b + 123;
+ return c;
+}
+
+int g5() {
+ int a = f();
+ int b = a - 456;
+ int c = b - 123;
+ return c;
+}
+
+int g6() {
+ int a = f();
+ int b = a - 456;
+ int c = 123 - b;
+ return c;
+}
+
+int g7() {
+ int a = f();
+ int b = 456 - a;
+ int c = b + 123;
+ return c;
+}
+
+int g8() {
+ int a = f();
+ int b = 456 - a;
+ int c = b - 123;
+ return c;
+}
+
+int g9() {
+ int a = f();
+ int b = 456 - a;
+ int c = 123 - b;
+ return c;
+}
+
+int main() {
+ putint(g1()); putch(10);
+ putint(g2()); putch(10);
+ putint(g3()); putch(10);
+ putint(g4()); putch(10);
+ putint(g5()); putch(10);
+ putint(g6()); putch(10);
+ putint(g7()); putch(10);
+ putint(g8()); putch(10);
+ putint(g9()); putch(10);
+} \ No newline at end of file