From: Michael Beck Date: Fri, 14 Sep 2007 10:26:04 +0000 (+0000) Subject: test local cse X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=736b26982e2b00577f54947ba25bff62b86528ee;p=libfirm test local cse [r15799] --- diff --git a/ir/be/test/csetest.c b/ir/be/test/csetest.c new file mode 100644 index 000000000..1b459315f --- /dev/null +++ b/ir/be/test/csetest.c @@ -0,0 +1,20 @@ +/*$ -fno-inline $*/ +#include + +int cse1(int a) { + int x = a * 3; + int y = 3 * a; + return x + y; +} + +int cse2(int a, int b) { + int x = a * b; + int y = b * a; + return x - y; +} + +int main() { + printf("cse1(3) = %d (should be 18)\n", cse1(3)); + printf("cse2(3,4) = %d (should be 0)\n", cse2(3,4)); + return 0; +}