This adds folds for comparing uadd.sat/usub.sat with zero:
- uadd.sat(a, b) == 0 => a == 0 && b == 0 => (a | b) == 0
- usub.sat(a, b) == 0 => a <= b
And inverted forms for !=.
Differential D69224
[InstCombine] Fold uadd.sat(a, b) == 0 and usub.sat(a, b) == 0 nikic on Oct 20 2019, 12:53 PM. Authored by
Details This adds folds for comparing uadd.sat/usub.sat with zero:
And inverted forms for !=.
Diff Detail
Event TimelineComment Actions ---------------------------------------- Name: uadd.sat(a, b) == 0 -> (a | b) == 0 %o0 = uadd_sat i8 %x, %y %r = icmp eq i8 %o0, 0 ret i1 %r => %n0 = or i8 %x, %y %r = icmp eq i8 %n0, 0 ret i1 %r %o0 = uadd_sat i8 %x, %y Done: 1 Optimization is correct! ---------------------------------------- Name: uadd.sat(a, b) != 0 -> (a | b) != 0 %o0 = uadd_sat i8 %x, %y %r = icmp ne i8 %o0, 0 ret i1 %r => %n0 = or i8 %x, %y %r = icmp ne i8 %n0, 0 ret i1 %r %o0 = uadd_sat i8 %x, %y Done: 1 Optimization is correct! ---------------------------------------- Name: usub.sat(a, b) == 0 -> a <= b %o0 = usub_sat i8 %x, %y %r = icmp eq i8 %o0, 0 ret i1 %r => %r = icmp ule i8 %x, %y ret i1 %r %o0 = usub_sat i8 %x, %y Done: 1 Optimization is correct! ---------------------------------------- Name: usub.sat(a, b) != 0 -> a > b %o0 = usub_sat i8 %x, %y %r = icmp ne i8 %o0, 0 ret i1 %r => %r = icmp ugt i8 %x, %y ret i1 %r %o0 = usub_sat i8 %x, %y Done: 1 Optimization is correct! LG |