test local cse
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 14 Sep 2007 10:26:04 +0000 (10:26 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 14 Sep 2007 10:26:04 +0000 (10:26 +0000)
[r15799]

ir/be/test/csetest.c [new file with mode: 0644]

diff --git a/ir/be/test/csetest.c b/ir/be/test/csetest.c
new file mode 100644 (file)
index 0000000..1b45931
--- /dev/null
@@ -0,0 +1,20 @@
+/*$ -fno-inline $*/
+#include <stdio.h>
+
+int cse1(int a) {
+               int x = a * 3;
+               int y = 3 * a;
+               return x + y;
+}
+
+int cse2(int a, int b) {
+               int x = a * b;
+               int y = b * a;
+               return x - y;
+}
+
+int main() {
+               printf("cse1(3) = %d (should be 18)\n", cse1(3));
+               printf("cse2(3,4) = %d (should be 0)\n", cse2(3,4));
+               return 0;
+}