two more test cases concering Convs and Divs
authorAndreas Zwinkau <zwinkau@kit.edu>
Mon, 11 Aug 2008 13:04:01 +0000 (13:04 +0000)
committerAndreas Zwinkau <zwinkau@kit.edu>
Mon, 11 Aug 2008 13:04:01 +0000 (13:04 +0000)
[r21089]

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

diff --git a/ir/be/test/divs.c b/ir/be/test/divs.c
new file mode 100644 (file)
index 0000000..965cc37
--- /dev/null
@@ -0,0 +1,26 @@
+int x = 42;
+int y = 10;
+
+int signed_div(int x, int y) {
+       printf("%d (should be 4)\n", x / y);
+       printf("%d (should be 2)\n", x % y);
+       return (x / y) + (x % y);
+}
+
+unsigned int unsigned_div(unsigned int x, unsigned int y) {
+       printf("%u (should be 4)\n", x / y);
+       printf("%u (should be 2)\n", x % y);
+       return (x / y) + (x % y);
+}
+
+double f_div(double x, double y) {
+       printf("%f (should be 4.2)\n", x / y);
+       return (x / y);
+}
+
+int main(void) {
+       int x = signed_div(42, 10)
+                       + unsigned_div(42, 10)
+                       + f_div(42.0, 10.0);
+       return 16-x;
+}
diff --git a/ir/be/test/most_complex_conv.c b/ir/be/test/most_complex_conv.c
new file mode 100644 (file)
index 0000000..afe309d
--- /dev/null
@@ -0,0 +1,7 @@
+unsigned int MAX_INT = 4294967295;
+
+int main(void) {
+       double res = MAX_INT;
+       printf("Res: %f\n", res);
+       return 0;
+}