[llvm] [InstCombine] simplify average of lsb (PR #95684)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Jun 15 19:12:08 PDT 2024
    
    
  
================
@@ -1284,6 +1284,14 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
     return NewSub;
   }
 
+  // ((X % 2) + (Y % 2)) / 2 --> (X & Y & 1)
+  if (match(Op0,
+            m_Add(m_And(m_Value(X), m_One()), m_And(m_Value(Y), m_One()))) &&
----------------
c8ef wrote:
Sounds like a good idea. I'll give it a try.
https://github.com/llvm/llvm-project/pull/95684
    
    
More information about the llvm-commits
mailing list