aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression/seqops.c
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-10-06 15:46:47 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-10-06 15:46:47 +0000
commitf7693b3d897b90fd3bc2533be002dc0bdcd9f6c2 (patch)
tree93ea9491693324d2d690c4236a2c88c3b461e225 /test/regression/seqops.c
parent261ef24f7fd2ef443f73c468b9b1fa496371f3bf (diff)
downloadcompcert-f7693b3d897b90fd3bc2533be002dc0bdcd9f6c2.tar.gz
compcert-f7693b3d897b90fd3bc2533be002dc0bdcd9f6c2.zip
Merge of branch seq-and-or. See Changelog for details.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2059 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/seqops.c')
-rw-r--r--test/regression/seqops.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/regression/seqops.c b/test/regression/seqops.c
new file mode 100644
index 00000000..c9ee5497
--- /dev/null
+++ b/test/regression/seqops.c
@@ -0,0 +1,87 @@
+int and1(int x, int y) { return x && y; }
+
+int and2(int x, int y) { return (x == 1) && (y > 0); }
+
+int and3(int x, int y) { if (x == 1 && y > 0) return 12; else return 16; }
+
+extern int f(int);
+
+int and4(int x, int y) { if (f(x) == 1 && f(y) > 0) return 12; else return 16; }
+
+int and5(int x, int y) {
+ int z;
+ if (x == 1 && y > 0) { z = f(x); return z; } else { return 0; }
+}
+
+int and6(int x)
+{
+ while (x >= 0 && f(x) < 0) x--;
+ return x;
+}
+
+int and3l(int x, int y, int z) { return (f(x) && f(y)) && f(z); }
+
+int and3r(int x, int y, int z) { return f(x) && (f(y) && f(z)); }
+
+int and4l(int x, int y, int z, int u) { return ((f(x) && f(y)) && f(z)) && f(u); }
+
+int and4r(int x, int y, int z, int u) { return f(x) && (f(y) && (f(z) && f(u))); }
+
+int and4b(int x, int y, int z, int u) { return (f(x) && f(y)) && (f(z) && f(u)); }
+
+int or1(int x, int y) { return x || y; }
+
+int or2(int x, int y) { return (x == 1) || (y > 0); }
+
+int or3(int x, int y) { if (x == 1 || y > 0) return 12; else return 16; }
+
+int or4(int x, int y) { if (f(x) == 1 || f(y) > 0) return 12; else return 16; }
+
+int or5(int x, int y) {
+ int z;
+ if (x == 1 || y > 0) { z = f(x); return z; } else { return 0; }
+}
+
+int or6(int x)
+{
+ while (x >= 0 || f(x) < 0) x--;
+ return x;
+}
+
+int or3l(int x, int y, int z) { return (f(x) || f(y)) || f(z); }
+
+int or3r(int x, int y, int z) { return f(x) || (f(y) || f(z)); }
+
+int or4l(int x, int y, int z, int u) { return ((f(x) || f(y)) || f(z)) || f(u); }
+
+int or4r(int x, int y, int z, int u) { return f(x) || (f(y) || (f(z) || f(u))); }
+
+int or4b(int x, int y, int z, int u) { return (f(x) || f(y)) || (f(z) || f(u)); }
+
+int mixed1(int x, int y, int z) { return z && (x || y); }
+
+int mixed2(int x, int y, int z) { return (x == 1 || y > 0) && (z < 0); }
+
+int mixed3(int x, int y, int z) { if (z && (x || y)) return 12; else return 16; }
+
+int mixed4(int x, int y, int z) { if ((f(x) || f(y)) && f(z)) return 12; else return 16; }
+
+int mixed5(int x, int y, int z) {
+ if ((x == 1 || y > 0) && z < 0) { z = f(x); return z; } else { return 0; }
+}
+
+int mixed6(int x)
+{
+ while (x == 0 || (x >= 0 && f(x) < 0)) x--;
+ return x;
+}
+
+int mixed3l(int x, int y, int z) { return (f(x) && f(y)) || f(z); }
+
+int mixed3r(int x, int y, int z) { return f(x) && (f(y) || f(z)); }
+
+int mixed4l(int x, int y, int z, int u) { return ((f(x) && f(y)) || f(z)) && f(u); }
+
+int mixed4r(int x, int y, int z, int u) { return f(x) && (f(y) || (f(z) && f(u))); }
+
+int mixed4b(int x, int y, int z, int u) { return (f(x) && f(y)) || (f(z) && f(u)); }