[InstCombine] fold sub of min/max intrinsics with invertible ops
authorSanjay Patel <spatel@rotateright.com>
Sat, 11 Sep 2021 13:18:46 +0000 (09:18 -0400)
committerSanjay Patel <spatel@rotateright.com>
Sat, 11 Sep 2021 13:18:46 +0000 (09:18 -0400)
commit28afaed691a0a7ca46bb9f64fac1153e03961fc1
treef3a45bfb778b852aac844397efaee31a76498a29
parentc55e021de40a87c0472593601780aa4c2fea2fc4
[InstCombine] fold sub of min/max intrinsics with invertible ops

This is a translation of the existing code to handle the intrinsics
and another step towards D98152.

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

This pattern is already handled by underlying folds if there are
less uses, so the minimal tests in this case have extra uses.

The larger cmyk tests show the motivation - when combined with
other folds, we invert a larger sequence and eliminate 'not' ops.
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
llvm/test/Transforms/InstCombine/sub-minmax.ll