[PATCH] D81829: [LangRef] Element-wise Integral Reduction Intrinsics

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 11:31:43 PDT 2020


spatel added inline comments.


================
Comment at: llvm/docs/LangRef.rst:15082-15088
+Element-wise Reduction Intrinsics
+---------------------------------
+
+Element-wise reductions between two arguments can be expressed using the
+following intrinsics. Each one takes two operands as an input and applies its
+respective operation to the arguments element-wise, returning result of the
+same type as the argument type.
----------------
We should avoid "reduction" vocabulary with any of these operations since that term is already used for vector ops.

abs() belongs in the "Standard C Library Intrinsics" section that starts around line 12099. 
If we relax that title to "Standard C/C++ Library Intrinsics", then min/max can live there too?


================
Comment at: llvm/docs/LangRef.rst:15108-15109
+
+The '``llvm.smax.*``' intrinsics do a signed integer ``MAX``
+element-wise reduction between the arguments.
+The return type matches the type of the arguments.
----------------
Return the larger of a and b comparing the values as signed integers.
Vector intrinsics operate on a per-element basis. The larger element of a and b at a given index is returned for that index.


================
Comment at: llvm/docs/LangRef.rst:15116
+The arguments (``%a`` and ``%b``) may be of any integer type, or a vector with
+integer element type. The return type must match the arguments type.
+``%a`` and ``%b`` are the two values that will undergo element-wise reduction.
----------------
I'd remove the "return type matches..." line above and work that clause in here:
"The argument types must match each other, and the return type must match the argument type."


================
Comment at: llvm/docs/LangRef.rst:15137
+
+The '``llvm.smin.*``' intrinsics do a signed integer ``MIN``
+element-wise reduction between the arguments.
----------------
Return the smaller of a and b comparing the values as signed integers.
Vector intrinsics operate on a per-element basis. The smaller element of a and b at a given index is returned for that index.


================
Comment at: llvm/docs/LangRef.rst:15166-15168
+The '``llvm.umax.*``' intrinsics do a unsigned integer ``MAX``
+element-wise reduction between the arguments.
+The return type matches the type of the arguments.
----------------
Return the larger of a and b comparing the values as unsigned integers.
Vector intrinsics operate on a per-element basis. The larger element of a and b at a given index is returned for that index.


================
Comment at: llvm/docs/LangRef.rst:15195-15196
+
+The '``llvm.umin.*``' intrinsics do a unsigned integer ``MIN``
+element-wise reduction between the arguments.
+The return type matches the type of the arguments.
----------------
Return the smaller of a and b comparing the values as unsigned integers.
Vector intrinsics operate on a per-element basis. The smaller element of a and b at a given index is returned for that index.


================
Comment at: llvm/docs/LangRef.rst:15218-15219
+
+      declare i32 @llvm.abs.i32(i32 <src>, i1 <is_int_min_poison>)
+      declare <4 x i32> @llvm.abs.v4i32(<4 x i32> <src>, i1 <is_int_min_poison>)
+
----------------
Do we need to include the poison option? 

The SDAG node only has:
  /// Note: A value of INT_MIN will return INT_MIN, no saturation or overflow
  /// is performed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81829/new/

https://reviews.llvm.org/D81829





More information about the llvm-commits mailing list