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
90dd276
..
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;
}
@@
-87,6
+93,14
@@
int cmp10(int x) {
return -x != 3;
}
return -x != 3;
}
+int cmp11(int x, int y) {
+ return x - y != x;
+}
+
+int cmp12(int x, int y) {
+ return x + y == x && y + x == y;
+}
+
int and1(int a, int b) {
return (a|b)&a;
}
int and1(int a, int b) {
return (a|b)&a;
}
@@
-179,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) \
@@
-207,6
+249,11
@@
int main(void)
TT(cmp8, 42, 17, -4, 1);
TU(cmp9, -3, 1);
TU(cmp10, -3, 0);
TT(cmp8, 42, 17, -4, 1);
TU(cmp9, -3, 1);
TU(cmp10, -3, 0);
+ TB(cmp11, 5, 5, 1);
+ TB(cmp11, 42, 0, 0);
+ TB(cmp12, 0, 0, 1);
+ TB(cmp12, 42, 5, 0);
+ TB(cmp12, 5, 5, 0);
TB(and1, 42, 17, 42);
TB(and2, 42, 17, 42^17);
TU(and3, 34, 1);
TB(and1, 42, 17, 42);
TB(and2, 42, 17, 42^17);
TU(and3, 34, 1);
@@
-234,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);
}
}