projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use symbolic names instead of magic values for the position parameter of get_irn_n().
[libfirm]
/
ir
/
be
/
test
/
localopts.c
diff --git
a/ir/be/test/localopts.c
b/ir/be/test/localopts.c
index
5743cea
..
2851d10
100644
(file)
--- a/
ir/be/test/localopts.c
+++ b/
ir/be/test/localopts.c
@@
-1,5
+1,6
@@
/*$ -fno-inline $*/
#include <stdio.h>
/*$ -fno-inline $*/
#include <stdio.h>
+#include <math.h>
#define CONST 42
#define CONST 42
@@
-47,6
+48,11
@@
int sub4(int x) {
return 6 - ~x;
}
return 6 - ~x;
}
+int addmul(int x, int y)
+{
+
+}
+
int cmp1(int x, int y) {
return -x == -y;
}
int cmp1(int x, int y) {
return -x == -y;
}
@@
-187,6
+193,34
@@
int conv3(signed char a) {
return (unsigned)a != 0;
}
return (unsigned)a != 0;
}
+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)
{
#define TU(func,x,expect) \
int main(void)
{
#define TU(func,x,expect) \
@@
-247,4
+281,9
@@
int main(void)
TU(and5, 7, 1);
TU(or1, 7, 1);
TU(or2, 7, 0);
TU(and5, 7, 1);
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);
}
}