|
2 | 2 |
|
3 | 3 | ;; `x == x` is always true for integers; `x != x` is false. Strict |
4 | 4 | ;; inequalities are false, and loose inequalities are true. |
5 | | -(rule (simplify (eq (ty_int ty) x x)) (subsume (iconst_u ty 1))) |
6 | | -(rule (simplify (ne (ty_int ty) x x)) (subsume (iconst_u ty 0))) |
7 | | -(rule (simplify (ugt (ty_int ty) x x)) (subsume (iconst_u ty 0))) |
8 | | -(rule (simplify (uge (ty_int ty) x x)) (subsume (iconst_u ty 1))) |
9 | | -(rule (simplify (sgt (ty_int ty) x x)) (subsume (iconst_u ty 0))) |
10 | | -(rule (simplify (sge (ty_int ty) x x)) (subsume (iconst_u ty 1))) |
11 | | -(rule (simplify (ult (ty_int ty) x x)) (subsume (iconst_u ty 0))) |
12 | | -(rule (simplify (ule (ty_int ty) x x)) (subsume (iconst_u ty 1))) |
13 | | -(rule (simplify (slt (ty_int ty) x x)) (subsume (iconst_u ty 0))) |
14 | | -(rule (simplify (sle (ty_int ty) x x)) (subsume (iconst_u ty 1))) |
| 5 | +(rule (simplify (eq ty x x)) (subsume (cmp_true ty))) |
| 6 | +(rule (simplify (ne ty x x)) (subsume (iconst_u ty 0))) |
| 7 | +(rule (simplify (ugt ty x x)) (subsume (iconst_u ty 0))) |
| 8 | +(rule (simplify (uge ty x x)) (subsume (cmp_true ty))) |
| 9 | +(rule (simplify (sgt ty x x)) (subsume (iconst_u ty 0))) |
| 10 | +(rule (simplify (sge ty x x)) (subsume (cmp_true ty))) |
| 11 | +(rule (simplify (ult ty x x)) (subsume (iconst_u ty 0))) |
| 12 | +(rule (simplify (ule ty x x)) (subsume (cmp_true ty))) |
| 13 | +(rule (simplify (slt ty x x)) (subsume (iconst_u ty 0))) |
| 14 | +(rule (simplify (sle ty x x)) (subsume (cmp_true ty))) |
15 | 15 |
|
16 | 16 | ;; For integers, adding the same thing on both sides of an equality check |
17 | 17 | ;; (or an inequality check) doesn't change the result. |
|
474 | 474 |
|
475 | 475 | (rule (simplify_skeleton (brif (ireduce _ (clz x_ty x)) _ _)) |
476 | 476 | (replace_branch_cond (sge $I8 x (iconst_u x_ty 0)))) |
| 477 | + |
| 478 | +;; ~x == x --> 0 |
| 479 | +(rule (simplify (eq ty (bnot cty x) x)) (subsume (iconst_u ty 0))) |
| 480 | + |
| 481 | +;; ~x != x --> 1 |
| 482 | +(rule (simplify (ne ty (bnot cty x) x)) (subsume (cmp_true ty))) |
0 commit comments