[PATCH] D69224: [InstCombine] Fold uadd.sat(a, b) == 0 and usub.sat(a, b) == 0
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 20 13:06:50 PDT 2019
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
----------------------------------------
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
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69224/new/
https://reviews.llvm.org/D69224
More information about the llvm-commits
mailing list