Add transforms for `(max/min (xor X, Pow2), X)` -> `(and/or X, Pow2/~Pow2)`
X ^ Pow2 is guranteed to flip one bit. We can use this to speedup max/min by just selecting X with/without (or/andnot) the flipped bit respectively. Alive2 Links: smax-neg: https://alive2.llvm.org/ce/z/j3QYFs smin-neg: https://alive2.llvm.org/ce/z/bFYnQW smax-pos: https://alive2.llvm.org/ce/z/4xYSxR smin-pos: https://alive2.llvm.org/ce/z/H3RPKj umax : https://alive2.llvm.org/ce/z/P4oRcX umin : https://alive2.llvm.org/ce/z/vWZG6p Differential Revision: https://reviews.llvm.org/D144606
Loading
Please sign in to comment