From: Christoph Mallon Date: Thu, 13 Sep 2007 13:24:32 +0000 (+0000) Subject: More local optimisation tests. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=5df241014ff0a709c6a41a42d99216780d527dc6;hp=930f2dd6bb1a970ce54f485775945c855b3b30a5;p=libfirm More local optimisation tests. [r15782] --- diff --git a/ir/be/test/localopts.c b/ir/be/test/localopts.c index 90b8cefe8..f9e4bf40d 100644 --- a/ir/be/test/localopts.c +++ b/ir/be/test/localopts.c @@ -23,6 +23,26 @@ int mul3(int x, int y, int z) return (x - y) * z; } +int sub0(int x, int y, int z) +{ + return x - (y - z); +} + +int sub1(int x, int y) +{ + return x - (y * CONST); +} + +int sub2(int x, int y) +{ + return x - -y; +} + +int sub3(int x, int y) +{ + return -x - y; +} + int main(void) { #define TU(func,x,expect) \ @@ -36,4 +56,8 @@ int main(void) TB(mul1, 20, 3, 60); TT(mul2, 9, 2, 5, 27); TT(mul3, 5, 2, 9, 27); + TT(sub0, 42, 17, 59, 84); + TB(sub1, 23, 17, -691); + TB(sub2, 42, 17, 59); + TB(sub3, 42, 17, -59); }