File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
filetests/filetests/egraph Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 286
286
(ult ty a_lo @ (value_type $I64) b_lo @ (value_type $I64))
287
287
(slt ty a_hi b_hi)))
288
288
(slt ty (iconcat $I64 a_lo a_hi) (iconcat $I64 b_lo b_hi)))
289
+
290
+
291
+ (rule (simplify (eq cty x (bxor bty x y))) (subsume (eq cty y (iconst_u bty 0))))
292
+ (rule (simplify (ne cty x (bxor bty x y))) (subsume (ne cty y (iconst_u bty 0))))
Original file line number Diff line number Diff line change @@ -170,3 +170,34 @@ block0(v0: i8, v1: i8):
170
170
; v5 = icmp uge v0, v1
171
171
; return v5
172
172
; }
173
+
174
+ ;; `x == (x ^ y)` to `y == 0`.
175
+ function %simplify_icmp_eq_x_bxor_x_y(i32, i32) -> i8 fast {
176
+ block0(v0: i32, v1: i32):
177
+ v2 = bxor v0, v1
178
+ v3 = icmp eq v0, v2
179
+ return v3
180
+ }
181
+
182
+ ; function %simplify_icmp_eq_x_bxor_x_y(i32, i32) -> i8 fast {
183
+ ; block0(v0: i32, v1: i32):
184
+ ; v4 = iconst.i32 0
185
+ ; v5 = icmp eq v1, v4 ; v4 = 0
186
+ ; return v5
187
+ ; }
188
+
189
+
190
+ ;; `x != (x ^ y)` to `y != 0`.
191
+ function %simplify_icmp_ne_x_bxor_x_y(i32, i32) -> i8 fast {
192
+ block0(v0: i32, v1: i32):
193
+ v2 = bxor v0, v1
194
+ v3 = icmp ne v0, v2
195
+ return v3
196
+ }
197
+
198
+ ; function %simplify_icmp_ne_x_bxor_x_y(i32, i32) -> i8 fast {
199
+ ; block0(v0: i32, v1: i32):
200
+ ; v4 = iconst.i32 0
201
+ ; v5 = icmp ne v1, v4 ; v4 = 0
202
+ ; return v5
203
+ ; }
You can’t perform that action at this time.
0 commit comments