[InstCombine] match usub.sat from umax intrinsic
authorSanjay Patel <spatel@rotateright.com>
Fri, 5 Nov 2021 21:32:24 +0000 (17:32 -0400)
committerSanjay Patel <spatel@rotateright.com>
Sat, 6 Nov 2021 12:32:52 +0000 (08:32 -0400)
commit83c2fb9f66be0eab489818ca87027dd2dbfeaa8e
treefee0376b7d7d9a5b9b2918fdd572aafcfba92894
parent025a2f73a31955cfd9b1e097533b9c6ef15dc6d3
[InstCombine] match usub.sat from umax intrinsic

umax(X, Op1) - Op1 --> usub.sat(X, Op1)

https://alive2.llvm.org/ce/z/HpcGiJ

This happens in 2 or more steps with an icmp-select idiom
instead of an intrinsic. This is another step towards
canonicalization of the min/max intrinsics. See:
D98152
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/minmax-intrinsics.ll