test the new mul with Const
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 5 Sep 2007 13:40:13 +0000 (13:40 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 5 Sep 2007 13:40:13 +0000 (13:40 +0000)
[r15672]

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

diff --git a/ir/be/test/mulconst.c b/ir/be/test/mulconst.c
new file mode 100644 (file)
index 0000000..ac4d5a1
--- /dev/null
@@ -0,0 +1,24 @@
+/**
+ * check all kinds of multiplication with constants
+ */
+
+#define test_C(C) \
+int test_##C(int i) { \
+  return i * C; \
+}
+#define test_N(C) \
+int test_m##C(int i) { \
+  return i * -C; \
+}
+#include "mulconst.h"
+#undef test_C
+#undef test_N
+
+#define test_C(C) printf("%d\n", test_##C(x));
+#define test_N(C) printf("%d\n", test_m##C(x));
+
+int x = 1;
+
+int main() {
+#include "mulconst.h"
+}
diff --git a/ir/be/test/mulconst.h b/ir/be/test/mulconst.h
new file mode 100644 (file)
index 0000000..040d1c0
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * check all kinds of multiplication with constants
+ */
+test_N(1)
+test_N(2)
+test_N(3)
+test_N(4)
+test_N(5)
+test_N(6)
+test_N(7)
+test_N(8)
+test_N(9)
+test_N(10)
+test_N(11)
+test_N(12)
+test_N(13)
+test_N(14)
+test_N(15)
+test_N(16)
+test_N(17)
+test_N(18)
+test_N(19)
+test_N(20)
+test_C(0)
+test_C(1)
+test_C(2)
+test_C(3)
+test_C(4)
+test_C(5)
+test_C(6)
+test_C(7)
+test_C(8)
+test_C(9)
+test_C(10)
+test_C(11)
+test_C(12)
+test_C(13)
+test_C(14)
+test_C(15)
+test_C(16)
+test_C(17)
+test_C(18)
+test_C(19)
+test_C(20)
+test_C(27)
+test_C(81)
+test_C(1560)
+test_C(46347)
+test_C(348435)