[libc-commits] [libc] [llvm] [llvm] Add KnownBits implementations for avgFloor and avgCeil (PR #86445)

Jay Foad via libc-commits libc-commits at lists.llvm.org
Fri May 17 01:47:39 PDT 2024


================
@@ -354,6 +354,22 @@ struct KnownBits {
   /// Compute knownbits resulting from llvm.usub.sat(LHS, RHS)
   static KnownBits usub_sat(const KnownBits &LHS, const KnownBits &RHS);
 
+  /// Compute knownbits resulting from APIntOps::avgFloorS
+  static KnownBits avgFloorS(const KnownBits &LHS, const KnownBits &RHS);
+
+  /// Compute knownbits resulting from APIntOps::avgFloorU
+  static KnownBits avgFloorU(const KnownBits &LHS, const KnownBits &RHS);
+
+  /// Compute knownbits resulting from APIntOps::avgCeilS
+  static KnownBits avgCeilS(const KnownBits &LHS, const KnownBits &RHS);
+
+  /// Compute knownbits resulting from APIntOps::avgCeilU
+  static KnownBits avgCeilU(const KnownBits &LHS, const KnownBits &RHS);
+
+  /// Return the knownbits for computing average
+  static KnownBits avgCompute(const KnownBits &LHS, const KnownBits &RHS,
----------------
jayfoad wrote:

This helper function should not be in the header. It can just be a static helper file in `KnownBits.cpp`.

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


More information about the libc-commits mailing list