xpc_add_ypc(int x,int y)1*c85f09ccSJohn Levon int xpc_add_ypc(int x, int y)
2*c85f09ccSJohn Levon {
3*c85f09ccSJohn Levon return (x + 1) + (y + 1);
4*c85f09ccSJohn Levon }
5*c85f09ccSJohn Levon
xmc_add_ypc(int x,int y)6*c85f09ccSJohn Levon int xmc_add_ypc(int x, int y)
7*c85f09ccSJohn Levon {
8*c85f09ccSJohn Levon return (x - 1) + (y + 1);
9*c85f09ccSJohn Levon }
10*c85f09ccSJohn Levon
xpc_add_ymc(int x,int y)11*c85f09ccSJohn Levon int xpc_add_ymc(int x, int y)
12*c85f09ccSJohn Levon {
13*c85f09ccSJohn Levon return (x + 1) + (y - 1);
14*c85f09ccSJohn Levon }
15*c85f09ccSJohn Levon
xmc_add_ymc(int x,int y)16*c85f09ccSJohn Levon int xmc_add_ymc(int x, int y)
17*c85f09ccSJohn Levon {
18*c85f09ccSJohn Levon return (x - 1) + (y - 1);
19*c85f09ccSJohn Levon }
20*c85f09ccSJohn Levon
xpc_sub_ypc(int x,int y)21*c85f09ccSJohn Levon int xpc_sub_ypc(int x, int y)
22*c85f09ccSJohn Levon {
23*c85f09ccSJohn Levon return (x + 1) - (y + 1);
24*c85f09ccSJohn Levon }
25*c85f09ccSJohn Levon
xmc_sub_ypc(int x,int y)26*c85f09ccSJohn Levon int xmc_sub_ypc(int x, int y)
27*c85f09ccSJohn Levon {
28*c85f09ccSJohn Levon return (x - 1) - (y + 1);
29*c85f09ccSJohn Levon }
30*c85f09ccSJohn Levon
xpc_sub_ymc(int x,int y)31*c85f09ccSJohn Levon int xpc_sub_ymc(int x, int y)
32*c85f09ccSJohn Levon {
33*c85f09ccSJohn Levon return (x + 1) - (y - 1);
34*c85f09ccSJohn Levon }
35*c85f09ccSJohn Levon
xmc_sub_ymc(int x,int y)36*c85f09ccSJohn Levon int xmc_sub_ymc(int x, int y)
37*c85f09ccSJohn Levon {
38*c85f09ccSJohn Levon return (x - 1) - (y - 1);
39*c85f09ccSJohn Levon }
40*c85f09ccSJohn Levon
41*c85f09ccSJohn Levon /*
42*c85f09ccSJohn Levon * check-name: canonical-add
43*c85f09ccSJohn Levon * check-description:
44*c85f09ccSJohn Levon * 1) verify that constants in add/sub chains are
45*c85f09ccSJohn Levon * pushed at the right of the whole chain.
46*c85f09ccSJohn Levon * For example '(a + 1) + b' must be canonicalized into '(a + b) + 1'
47*c85f09ccSJohn Levon * This is needed for '(a + 1) + b - 1' to be simplified into '(a + b)'
48*c85f09ccSJohn Levon *
49*c85f09ccSJohn Levon * check-command: test-linearize -Wno-decl $file
50*c85f09ccSJohn Levon * check-known-to-fail
51*c85f09ccSJohn Levon * check-output-ignore
52*c85f09ccSJohn Levon
53*c85f09ccSJohn Levon * check-output-excludes: \\$1
54*c85f09ccSJohn Levon * check-output-excludes: \\$-1
55*c85f09ccSJohn Levon */
56