[llvm] [InstCombine][X86] Try to convert BLENDV(X,Y,SHL()) -> SELECT(ICMP_SGT(0,SHL()),Y,X) (PR #173389)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 24 02:07:36 PST 2025


================
@@ -2892,6 +2893,19 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
 
     Mask = InstCombiner::peekThroughBitcast(Mask);
 
+    // Bitshift upto the signbit can always be converted to an efficient
+    // test+select pattern.
+    if (match(Mask, m_Shl(m_Value(), m_Value()))) {
+      if (auto *MaskTy = dyn_cast<FixedVectorType>(Mask->getType())) {
----------------
RKSimon wrote:

There is the remote possibility that we've peeked through bitcasts to a non-vector type.

https://github.com/llvm/llvm-project/pull/173389


More information about the llvm-commits mailing list