[llvm] [ValueTracking][X86] Compute KnownBits for phadd/phsub (PR #92429)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 09:46:35 PDT 2024


================
@@ -246,6 +246,20 @@ void processShuffleMasks(
     function_ref<void(ArrayRef<int>, unsigned, unsigned)> SingleInputAction,
     function_ref<void(ArrayRef<int>, unsigned, unsigned)> ManyInputsAction);
 
+/// Compute the demanded elements mask of horizontal binary operations. A
+/// horizontal operation combines two adjacent elements in a vector operand.
+/// This function returns a mask for the elements that correspond to the first
+/// operand of this horizontal combination. For example, for two vectors
+/// [X1, X2, X3, X4] and [Y1, Y2, Y3, Y4], the resulting mask can include the
+/// elements X1, X3, Y1, and Y3. To get the other operands, simply shift the
+/// result of this function to the left by 1.
+///
+/// \param DemandedEltsOp  the demanded elements mask for the operation
+/// \param DemandedEltsLHS the demanded elements mask for the left operand
+/// \param DemandedEltsRHS the demanded elements mask for the right operand
+void getHorizontalDemandedElts(const APInt &DemandedEltsOp,
----------------
goldsteinn wrote:

I think this function name should make it clear you are only getting half the elements.

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


More information about the llvm-commits mailing list