xref: /illumos-gate/usr/src/tools/smatch/src/validation/optim/cse-commutativity.c (revision 1f5207b7604fb44407eb4342aff613f7c4508508)
1*1f5207b7SJohn Levon static int add(int a, int b) { return (a + b) == (b + a); }
2*1f5207b7SJohn Levon static int mul(int a, int b) { return (a * b) == (b * a); }
3*1f5207b7SJohn Levon static int and(int a, int b) { return (a & b) == (b & a); }
4*1f5207b7SJohn Levon static int ior(int a, int b) { return (a | b) == (b | a); }
5*1f5207b7SJohn Levon static int xor(int a, int b) { return (a ^ b) == (b ^ a); }
6*1f5207b7SJohn Levon static int  eq(int a, int b) { return (a == b) == (b == a); }
7*1f5207b7SJohn Levon static int  ne(int a, int b) { return (a != b) == (b != a); }
8*1f5207b7SJohn Levon 
9*1f5207b7SJohn Levon 
10*1f5207b7SJohn Levon /*
11*1f5207b7SJohn Levon  * check-name: cse-commutativity
12*1f5207b7SJohn Levon  * check-command: test-linearize $file
13*1f5207b7SJohn Levon  * check-output-ignore
14*1f5207b7SJohn Levon  *
15*1f5207b7SJohn Levon  * check-output-excludes: add\\.
16*1f5207b7SJohn Levon  * check-output-excludes: muls\\.
17*1f5207b7SJohn Levon  * check-output-excludes: and\\.
18*1f5207b7SJohn Levon  * check-output-excludes: or\\.
19*1f5207b7SJohn Levon  * check-output-excludes: xor\\.
20*1f5207b7SJohn Levon  * check-output-excludes: seteq\\.
21*1f5207b7SJohn Levon  * check-output-excludes: setne\\.
22*1f5207b7SJohn Levon  */
23