aboutsummaryrefslogtreecommitdiff
path: root/tests/sysy_lvX/036_prior_and_or.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/036_prior_and_or.sy
downloadrcc-master.tar.gz
rcc-master.tar.xz
Set up a git repoHEADmaster
Diffstat (limited to 'tests/sysy_lvX/036_prior_and_or.sy')
-rw-r--r--tests/sysy_lvX/036_prior_and_or.sy34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/sysy_lvX/036_prior_and_or.sy b/tests/sysy_lvX/036_prior_and_or.sy
new file mode 100644
index 0000000..3ec7cc6
--- /dev/null
+++ b/tests/sysy_lvX/036_prior_and_or.sy
@@ -0,0 +1,34 @@
+int main()
+{
+ int a = 4, b = 5, c = 5, d = 6;
+ int e = 0;
+
+ // (0 && 0) || 1
+ if (a > b && b != c || c < d)
+ e = e + 0x01;
+ // 1 || (0 && 0)
+ if (b >= c || a == d && 6 <= b)
+ e = e + 0x02;
+
+ // 1 || (0 && 0) || 0
+ if (b || a != a && 1 != 2 || !3)
+ e = e + 0x04;
+ // 1 || (0 && 1) || 0
+ if ((1) || a == 0 && 6 > b || b == c)
+ e = e + 0x08;
+ // 0 || (1 && 1) || 0
+ if (b > c || (3) && 2 || 7 < 0)
+ e = e + 0x10;
+ // 0 || (1 && 0) || 0
+ if (d >= 9 || 4 == a && 8 <= 5 || 2 > b)
+ e = e + 0x20;
+
+ // (0 && 0) || 1 || 1
+ if (!b && 0 || a || (6))
+ e = e + 0x40;
+ // (1 && 1 && 1) || 0
+ if (d > a && c <= b && d == 6 || 2 == 5)
+ e = e + 0x80;
+
+ return e;
+} \ No newline at end of file