[llvm] [InstCombine] simplify average of lsb (PR #95684)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 02:37:03 PDT 2024


================
@@ -1284,6 +1284,14 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
     return NewSub;
   }
 
+  // Fold (X + Y) / 2 --> (X & Y & 1) iff (X u<= 1) && (Y u<= 1)
----------------
dtcxzyw wrote:

```suggestion
  // Fold (X + Y) / 2 --> (X & Y) iff (X u<= 1) && (Y u<= 1)
```

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


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


More information about the llvm-commits mailing list