aboutsummaryrefslogtreecommitdiff
path: root/rcc-legacy/tests/functional/loop_unroll2.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/loop_unroll2.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/loop_unroll2.sy')
-rw-r--r--rcc-legacy/tests/functional/loop_unroll2.sy124
1 files changed, 124 insertions, 0 deletions
diff --git a/rcc-legacy/tests/functional/loop_unroll2.sy b/rcc-legacy/tests/functional/loop_unroll2.sy
new file mode 100644
index 0000000..9720a97
--- /dev/null
+++ b/rcc-legacy/tests/functional/loop_unroll2.sy
@@ -0,0 +1,124 @@
+void f1(int x[]) {
+ int a[3] = {};
+ int i = x[0];
+ while (i < x[1]) {
+ a[i] = a[i] + 2 * i; i = i + 1;
+ }
+ i = x[0];
+ while (i < x[1]) {
+ a[i] = a[i] - i; i = i + 1;
+ }
+ putarray(3, a);
+}
+
+void f2(int x[]) {
+ int a[3] = {};
+ int i = x[0];
+ while (i <= x[1] - 1) {
+ a[i] = a[i] + 2 * i; i = i + 1;
+ }
+ i = x[0];
+ while (i <= x[1] - 1) {
+ a[i] = a[i] - i; i = i + 1;
+ }
+ putarray(3, a);
+}
+
+void f3(int x[]) {
+ int a[3] = {};
+ int i = x[0];
+ while (x[1] > i) {
+ a[i] = a[i] + 2 * i; i = i + 1;
+ }
+ i = x[0];
+ while (x[1] > i) {
+ a[i] = a[i] - i; i = i + 1;
+ }
+ putarray(3, a);
+}
+
+void f4(int x[]) {
+ int a[3] = {};
+ int i = x[0];
+ while (x[1] - 1 >= i) {
+ a[i] = a[i] + 2 * i; i = i + 1;
+ }
+ i = x[0];
+ while (x[1] - 1 >= i) {
+ a[i] = a[i] - i; i = i + 1;
+ }
+ putarray(3, a);
+}
+
+void f5(int x[]) {
+ int a[3] = {};
+ int i = x[1] - 1;
+ while (i >= x[0]) {
+ a[i] = a[i] + 2 * i; i = i - 1;
+ }
+ i = x[1] - 1;
+ while (i >= x[0]) {
+ a[i] = a[i] - i; i = i - 1;
+ }
+ putarray(3, a);
+}
+
+void f6(int x[]) {
+ int a[3] = {};
+ int i = x[1] - 1;
+ while (i > x[0] - 1) {
+ a[i] = a[i] + 2 * i; i = i - 1;
+ }
+ i = x[1] - 1;
+ while (i > x[0] - 1) {
+ a[i] = a[i] - i; i = i - 1;
+ }
+ putarray(3, a);
+}
+
+void f7(int x[]) {
+ int a[3] = {};
+ int i = x[1] - 1;
+ while (x[0] <= i) {
+ a[i] = a[i] + 2 * i; i = i - 1;
+ }
+ i = x[1] - 1;
+ while (x[0] <= i) {
+ a[i] = a[i] - i; i = i - 1;
+ }
+ putarray(3, a);
+}
+
+void f8(int x[]) {
+ int a[3] = {};
+ int i = x[1] - 1;
+ while (x[0] - 1 < i) {
+ a[i] = a[i] + 2 * i; i = i - 1;
+ }
+ i = x[1] - 1;
+ while (x[0] - 1 < i) {
+ a[i] = a[i] - i; i = i - 1;
+ }
+ putarray(3, a);
+}
+
+int main() {
+ int x[2];
+ x[0] = 0;
+ while (x[0] <= 3) {
+ x[1] = x[0];
+ while (x[1] <= 3) {
+ f1(x);
+ f2(x);
+ f3(x);
+ f4(x);
+ f5(x);
+ f6(x);
+ f7(x);
+ f8(x);
+ x[1] = x[1] + 1;
+ }
+ x[0] = x[0] + 1;
+ }
+ return 0;
+} \ No newline at end of file