File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 298298;; (x < y) ? x : y != x == x > y, for both signed and unsigned.
299299(rule (simplify (ne cty (select ty (slt cty x y) x y) x)) (sgt cty x y))
300300(rule (simplify (ne cty (select ty (ult cty x y) x y) x)) (ugt cty x y))
301+
302+ (rule (simplify (ult cty (bnot ty x) (bnot ty y))) (ugt cty x y))
303+ (rule (simplify (slt cty (bnot ty x) (bnot ty y))) (sgt cty x y))
304+
Original file line number Diff line number Diff line change 1+ test optimize precise-output
2+ set opt_level=speed
3+ target x86_64
4+
5+ function %test1(i8, i8) -> i8 {
6+ block0(v0: i8, v2: i8):
7+ v1 = bnot v0
8+ v3 = bnot v2
9+ v4 = icmp ult v1, v3
10+ return v4
11+ }
12+
13+ ; function %test1(i8, i8) -> i8 fast {
14+ ; block0(v0: i8, v2: i8):
15+ ; v5 = icmp ugt v0, v2
16+ ; return v5
17+ ; }
18+
19+ function %test1(i8, i8) -> i8 {
20+ block0(v0: i8, v2: i8):
21+ v1 = bnot v0
22+ v3 = bnot v2
23+ v4 = icmp slt v1, v3
24+ return v4
25+ }
26+
27+ ; function %test1(i8, i8) -> i8 fast {
28+ ; block0(v0: i8, v2: i8):
29+ ; v5 = icmp sgt v0, v2
30+ ; return v5
31+ ; }
32+
Original file line number Diff line number Diff line change @@ -44,3 +44,24 @@ block0(v0: i32, v1: i32):
4444; run: %ule_sub_swap(1, -88) == 0
4545; run: %ule_sub_swap(1, 2) == 0
4646; run: %ule_sub_swap(2, 1) == 1
47+
48+ function %fold_cmp_over_nots1(i8, i8) -> i8 {
49+ block0(v0: i8, v2: i8):
50+ v1 = bnot v0
51+ v3 = bnot v2
52+ v4 = icmp ult v1, v3
53+ return v4
54+ }
55+
56+ ; run: %fold_cmp_over_nots1(2, 1) == 1
57+
58+ function %fold_cmp_over_nots2(i8, i8) -> i8 {
59+ block0(v0: i8, v2: i8):
60+ v1 = bnot v0
61+ v3 = bnot v2
62+ v4 = icmp slt v1, v3
63+ return v4
64+ }
65+
66+ ; run: %fold_cmp_over_nots2(2, 1) == 1
67+
You can’t perform that action at this time.
0 commit comments