X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Ftest%2Flocalopts.c;h=2851d10705b8c087377323ff9b6e44acd38fccbd;hb=93da909d12b7bec51aa36ee5f05966c331f90fb9;hp=90dd276896b038ddb4b21cb0103d51f690325ae6;hpb=44abfa87e3140fd0f934ff14227d6091546c3f3a;p=libfirm diff --git a/ir/be/test/localopts.c b/ir/be/test/localopts.c index 90dd27689..2851d1070 100644 --- a/ir/be/test/localopts.c +++ b/ir/be/test/localopts.c @@ -1,5 +1,6 @@ /*$ -fno-inline $*/ #include +#include #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; } @@ -87,6 +93,14 @@ int cmp10(int x) { 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; } @@ -179,6 +193,34 @@ int conv3(signed char a) { 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) \ @@ -207,6 +249,11 @@ int main(void) 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); @@ -234,4 +281,9 @@ int main(void) 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); }