Lines Matching refs:select

1 ;; `select`/`bitselect`-related rewrites
3 ;; remove select when both choices are the same
4 (rule (simplify (select ty _ x x)) (subsume x))
7 ;; Push zeroes to the right -- this makes the select `truthy`, as used elsewhere
9 (rule (simplify (select sty (icmp cty cc x y)
12 (select sty (icmp cty (intcc_complement cc) x y) nonzero zero))
15 (rule (simplify (select ty cmp @ (icmp _ cc x y)
20 (rule (simplify (select ty cmp@(icmp _ cc x y)
25 ;; Transform select-of-icmp into {u,s}{min,max} instructions where possible.
26 (rule (simplify (select ty (sgt _ x y) x y)) (smax ty x y))
27 (rule (simplify (select ty (sge _ x y) x y)) (smax ty x y))
28 (rule (simplify (select ty (ugt _ x y) x y)) (umax ty x y))
29 (rule (simplify (select ty (uge _ x y) x y)) (umax ty x y))
30 (rule (simplify (select ty (slt _ x y) x y)) (smin ty x y))
31 (rule (simplify (select ty (sle _ x y) x y)) (smin ty x y))
32 (rule (simplify (select ty (ult _ x y) x y)) (umin ty x y))
33 (rule (simplify (select ty (ule _ x y) x y)) (umin ty x y))
35 ;; These are the same rules as above, but when the operands for select are swapped
36 (rule (simplify (select ty (slt _ x y) y x)) (smax ty x y))
37 (rule (simplify (select ty (sle _ x y) y x)) (smax ty x y))
38 (rule (simplify (select ty (ult _ x y) y x)) (umax ty x y))
39 (rule (simplify (select ty (ule _ x y) y x)) (umax ty x y))
40 (rule (simplify (select ty (sgt _ x y) y x)) (smin ty x y))
41 (rule (simplify (select ty (sge _ x y) y x)) (smin ty x y))
42 (rule (simplify (select ty (ugt _ x y) y x)) (umin ty x y))
43 (rule (simplify (select ty (uge _ x y) y x)) (umin ty x y))
55 ;; These are the same rules as above, but when the operands for select are swapped
79 ;; Lift an extend operation outside of a `select` if the extend is happening
81 (rule (simplify (select ty cond
84 (uextend ty (select small cond a b)))
85 (rule (simplify (select ty cond
88 (sextend ty (select small cond a b)))
90 (rule (simplify (select ty (sgt _ x (iconst_u ty 0)) x (ineg ty x))) (subsume (iabs ty x)))
91 (rule (simplify (select ty (sge _ x (iconst_u ty 0)) x (ineg ty x))) (subsume (iabs ty x)))
92 (rule (simplify (select ty (sle _ x (iconst_u ty 0)) (ineg ty x) x)) (subsume (iabs ty x)))
93 (rule (simplify (select ty (slt _ x (iconst_u ty 0)) (ineg ty x) x)) (subsume (iabs ty x)))
95 ;; fold add-select to select-add
97 (iadd ty (select ty c (iconst_u ty x) (iconst_u ty y)) (iconst_u ty z)))
98 (select ty c
102 (rule (simplify (select ty d a (select ty d _ y))) (select ty d a y))
103 (rule (simplify (select ty d (select ty d x _) a)) (select ty d x a))
116 ;; select(eq/ne) patterns that always collapse to y.
117 (rule (simplify (select ty (eq cty x y) x y)) (subsume y))
118 (rule (simplify (select ty (ne cty x y) y x)) (subsume y))
119 (rule (simplify (select ty (eq cty y x) x y)) (subsume y))
120 (rule (simplify (select ty (ne cty y x) y x)) (subsume y))
123 (rule (simplify (select ty (bor cty x (ne cty y z)) y z)) (subsume y))
124 (rule (simplify (select ty (bor cty (ne cty y z) x) y z)) (subsume y))
125 (rule (simplify (select ty (bor cty x (ne cty z y)) y z)) (subsume y))
126 (rule (simplify (select ty (bor cty (ne cty z y) x) y z)) (subsume y))
130 (rule (simplify (select ty (eq cty x y) x (bor ty x y))) (bor ty x y))
131 (rule (simplify (select ty (ne cty x y) (bor ty x y) x)) (bor ty x y))
132 (rule (simplify (select ty (eq cty x y) x (bor ty y x))) (bor ty x y))
133 (rule (simplify (select ty (ne cty x y) (bor ty y x) x)) (bor ty x y))
134 (rule (simplify (select ty (eq cty y x) x (bor ty x y))) (bor ty x y))
135 (rule (simplify (select ty (ne cty y x) (bor ty x y) x)) (bor ty x y))
136 (rule (simplify (select ty (eq cty y x) x (bor ty y x))) (bor ty x y))
137 (rule (simplify (select ty (ne cty y x) (bor ty y x) x)) (bor ty x y))
141 (rule (simplify (select ty (ne cty x y) (band ty x y) y)) (band ty x y))
142 (rule (simplify (select ty (eq cty x y) y (band ty x y))) (band ty x y))
143 (rule (simplify (select ty (ne cty x y) (band ty y x) y)) (band ty x y))
144 (rule (simplify (select ty (eq cty x y) y (band ty y x))) (band ty x y))
145 (rule (simplify (select ty (ne cty y x) (band ty x y) y)) (band ty x y))
146 (rule (simplify (select ty (eq cty y x) y (band ty x y))) (band ty x y))
147 (rule (simplify (select ty (ne cty y x) (band ty y x) y)) (band ty x y))
148 (rule (simplify (select ty (eq cty y x) y (band ty y x))) (band ty x y))
152 (rule (simplify (select ty (ult cty x y) (iconst_u ty 1) (eq ty x y))) (ule ty x y))
153 (rule (simplify (select ty (uge cty x y) (eq ty x y) (iconst_u ty 1))) (ule ty x y))
154 (rule (simplify (select ty (ugt cty y x) (iconst_u ty 1) (eq ty x y))) (ule ty x y))
155 (rule (simplify (select ty (ule cty y x) (eq ty x y) (iconst_u ty 1))) (ule ty x y))
156 (rule (simplify (select ty (ult cty x y) (iconst_u ty 1) (eq ty y x))) (ule ty x y))
157 (rule (simplify (select ty (uge cty x y) (eq ty y x) (iconst_u ty 1))) (ule ty x y))
158 (rule (simplify (select ty (ugt cty y x) (iconst_u ty 1) (eq ty y x))) (ule ty x y))
159 (rule (simplify (select ty (ule cty y x) (eq ty y x) (iconst_u ty 1))) (ule ty x y))
163 (rule (simplify (select ty (slt cty x y) (iconst_u ty 1) (sgt ty x y))) (ne ty x y))
164 (rule (simplify (select ty (sge cty x y) (sgt ty x y) (iconst_u ty 1))) (ne ty x y))
165 (rule (simplify (select ty (sgt cty y x) (iconst_u ty 1) (sgt ty x y))) (ne ty x y))
166 (rule (simplify (select ty (sle cty y x) (sgt ty x y) (iconst_u ty 1))) (ne ty x y))
167 (rule (simplify (select ty (slt cty x y) (iconst_u ty 1) (slt ty y x))) (ne ty x y))
168 (rule (simplify (select ty (sge cty x y) (slt ty y x) (iconst_u ty 1))) (ne ty x y))
169 (rule (simplify (select ty (sgt cty y x) (iconst_u ty 1) (slt ty y x))) (ne ty x y))
170 (rule (simplify (select ty (sle cty y x) (slt ty y x) (iconst_u ty 1))) (ne ty x y))
171 (rule (simplify (select ty (ult cty x y) (iconst_u ty 1) (ugt ty x y))) (ne ty x y))
172 (rule (simplify (select ty (uge cty x y) (ugt ty x y) (iconst_u ty 1))) (ne ty x y))
173 (rule (simplify (select ty (ugt cty y x) (iconst_u ty 1) (ugt ty x y))) (ne ty x y))
174 (rule (simplify (select ty (ule cty y x) (ugt ty x y) (iconst_u ty 1))) (ne ty x y))
175 (rule (simplify (select ty (ult cty x y) (iconst_u ty 1) (ult ty y x))) (ne ty x y))
176 (rule (simplify (select ty (uge cty x y) (ult ty y x) (iconst_u ty 1))) (ne ty x y))
177 (rule (simplify (select ty (ugt cty y x) (iconst_u ty 1) (ult ty y x))) (ne ty x y))
178 (rule (simplify (select ty (ule cty y x) (ult ty y x) (iconst_u ty 1))) (ne ty x y))
181 (rule (simplify (select ty x (iconst_u ty 1) (bor ty x y))) (select ty x (iconst_u ty 1) y))
182 (rule (simplify (select ty x (iconst_u ty 1) (bor ty y x))) (select ty x (iconst_u ty 1) y))
186 (rule (simplify (select ty (eq cty x (iconst_u ty n)) (isub ty y (iconst_u ty n)) (isub ty y x))) (…
187 (rule (simplify (select ty (ne cty x (iconst_u ty n)) (isub ty y x) (isub ty y (iconst_u ty n)))) (…
188 (rule (simplify (select ty (eq cty (iconst_u ty n) x) (isub ty y (iconst_u ty n)) (isub ty y x))) (…
189 (rule (simplify (select ty (ne cty (iconst_u ty n) x) (isub ty y x) (isub ty y (iconst_u ty n)))) (…
191 ;; select(cond, eq(z, y), eq(p, y)) ==> eq(y, select(cond, z, p))
192 (rule (simplify (select ty x (eq ty z y) (eq ty (iconst_u cty p) y))) (eq ty y (select cty x z (ico…
193 (rule (simplify (select ty x (eq ty z y) (eq ty y (iconst_u cty p)))) (eq ty y (select cty x z (ico…
194 (rule (simplify (select ty x (eq ty y z) (eq ty (iconst_u cty p) y))) (eq ty y (select cty x z (ico…
195 (rule (simplify (select ty x (eq ty y z) (eq ty y (iconst_u cty p)))) (eq ty y (select cty x z (ico…