Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,8 @@ Let ``VT`` be a vector type and ``ET`` the element type of ``VT``.
======================================= ====================================================================== ==================================
Name Operation Supported element types
======================================= ====================================================================== ==================================
ET __builtin_reduce_max(VT a) return x or y, whichever is larger; If exactly one argument is integer and floating point types
a NaN, return the other argument. If both arguments are NaNs,
fmax() return a NaN.
ET __builtin_reduce_min(VT a) return x or y, whichever is smaller; If exactly one argument integer and floating point types
is a NaN, return the other argument. If both arguments are
NaNs, fmax() return a NaN.
ET __builtin_reduce_max(VT a) return the largest element of the vector. integer and floating point types
ET __builtin_reduce_min(VT a) return the smallest element of the vector. integer and floating point types
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you add back the NaN semantics - AFAICT they should always return the largest/smallest non-NAN value if any vector element is non-NAN, otherwise it could return any of the NAN values in the (all NAN) vector. There might be a better way of phrasing that......

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLVM LangRef states: "This instruction has the same comparison semantics as the ‘llvm.maxnum.*’ intrinsic." Can I add a link to https://llvm.org/docs/LangRef.html#vector-reduction-intrinsics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add pointers to the floating point min/max function.

Copy link
Contributor

@arsenm arsenm Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any kind of conformance testing for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we had any conformance testing before, but since this is just a document change and the patch is keeping the clang builtin document aligned with the llvm intrinsic document, maybe there's no need to add extra tests here?

ET __builtin_reduce_add(VT a) \+ integer types
ET __builtin_reduce_mul(VT a) \* integer types
ET __builtin_reduce_and(VT a) & integer types
Expand Down
Loading