testcase for new Confirm code
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 20 Mar 2008 02:30:18 +0000 (02:30 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 20 Mar 2008 02:30:18 +0000 (02:30 +0000)
[r18198]

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

diff --git a/ir/be/test/confirm.c b/ir/be/test/confirm.c
new file mode 100644 (file)
index 0000000..549db69
--- /dev/null
@@ -0,0 +1,36 @@
+#include <stdio.h>
+
+int test(int a, int b) {
+       int x = a * b;
+       if (a == 0)
+               return x;
+       else
+               return x - 1;
+}
+
+static int abs(int x) {
+       if (x < 0)
+               return -x;
+       return x;
+}
+
+int test2(int a, int b) {
+       if (a > 0) {
+               return abs(a);
+       }
+       return b;
+}
+
+int test3(int a, int b) {
+       if (a != 0) {
+               b = b / -a;
+       }
+       return b;
+}
+
+int main(void) {
+       printf("test() = %d\n", test(0, 1));
+       printf("test() = %d\n", test2(1, 3));
+       printf("test() = %d\n", test3(-3, 3));
+       return 0;
+}