Use symbolic names instead of magic values for the position parameter of get_irn_n().
[libfirm] / ir / be / test / localopts.c
index e886800..2851d10 100644 (file)
@@ -1,5 +1,6 @@
 /*$ -fno-inline $*/
 #include <stdio.h>
+#include <math.h>
 
 #define CONST 42
 
@@ -47,6 +48,11 @@ int sub4(int x) {
        return 6 - ~x;
 }
 
+int addmul(int x, int y)
+{
+
+}
+
 int cmp1(int x, int y) {
        return -x == -y;
 }
@@ -187,10 +193,32 @@ int conv3(signed char a) {
        return (unsigned)a != 0;
 }
 
-int phi(int x) {
-       int a = x ? 23 : 42;
-       int b = x ? 42 : 23;
-       return a + b;
+int phi1(int x) {
+       int a = x ? 23 : 42;
+       int b = x ? 42 : 23;
+       return a + b;
+}
+
+int phi2(int x) {
+       int a = x ? 16 : 8;
+       int b = x ? 4  : 2;
+       return a / b;
+}
+
+int phi3(int x) {
+       int a = x ? 5 : 9;
+       int b = x ? 2 : 4;
+       return a % b;
+}
+
+int phi4(int x) {
+       int a = x ? 5 : 9;
+       int b = x ? 2 : 4;
+       return (a / b) + (a % b);
+}
+
+int abs1(int x) {
+       return abs(-x);
 }
 
 int main(void)
@@ -254,4 +282,8 @@ int main(void)
        TU(or1, 7, 1);
        TU(or2, 7, 0);
        TU(phi1, 1, 65);
+       TU(phi2, 1, 4);
+       TU(phi3, 1, 1);
+       TU(phi4, 1, 3);
+       TU(abs1, 1, 1);
 }