Commit 5df24101 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

More local optimisation tests.

[r15782]
parent 930f2dd6
...@@ -23,6 +23,26 @@ int mul3(int x, int y, int z) ...@@ -23,6 +23,26 @@ int mul3(int x, int y, int z)
return (x - y) * 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) int main(void)
{ {
#define TU(func,x,expect) \ #define TU(func,x,expect) \
...@@ -36,4 +56,8 @@ int main(void) ...@@ -36,4 +56,8 @@ int main(void)
TB(mul1, 20, 3, 60); TB(mul1, 20, 3, 60);
TT(mul2, 9, 2, 5, 27); TT(mul2, 9, 2, 5, 27);
TT(mul3, 5, 2, 9, 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);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment