aboutsummaryrefslogtreecommitdiff
path: root/tests/sysy_lvX/try_fold_lhs.sy
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
committerRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
commit4022e5c95210631e4aceb08eaf9d9071aa5aefc4 (patch)
treea5922559836e45fb3459a3d070367912e1035b1a /tests/sysy_lvX/try_fold_lhs.sy
downloadrcc-master.tar.gz
rcc-master.tar.xz
Set up a git repoHEADmaster
Diffstat (limited to 'tests/sysy_lvX/try_fold_lhs.sy')
-rw-r--r--tests/sysy_lvX/try_fold_lhs.sy78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/sysy_lvX/try_fold_lhs.sy b/tests/sysy_lvX/try_fold_lhs.sy
new file mode 100644
index 0000000..b12a2e6
--- /dev/null
+++ b/tests/sysy_lvX/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