[llvm] [InstCombine] Recognize more rotation patterns (PR #78107)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 14 22:08:55 PST 2024


================
@@ -2809,6 +2809,10 @@ static Instruction *matchFunnelShift(Instruction &Or, InstCombinerImpl &IC,
           match(R, m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask))))
         return X;
 
+      // (shl ShVal, X) | (lshr ShVal, ((-X) & (Width - 1)))
+      if (match(R, m_And(m_Neg(m_Specific(L)), m_SpecificInt(Mask))))
+        return L;
----------------
goldsteinn wrote:

although just a few lines, seems like little harm. Tend to think unless there is a notable maintenance burden, more coverage is better as there is ALOT of code out there.

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


More information about the llvm-commits mailing list