From 5df241014ff0a709c6a41a42d99216780d527dc6 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 13 Sep 2007 13:24:32 +0000 Subject: [PATCH 1/1] More local optimisation tests. [r15782] --- ir/be/test/localopts.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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); } -- 2.20.1