[clang] [clang][docs] Revise documentation for `__builtin_reduce_(max|min)`. (PR #114637)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 7 07:35:42 PST 2024
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/114637
>From 13d9d0771b666c5ba2262004f45dcbe34e6fd893 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sat, 2 Nov 2024 11:53:54 +0800
Subject: [PATCH 1/3] Update LanguageExtensions.rst
---
clang/docs/LanguageExtensions.rst | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 10232ff41da15a..b7676bab623ef8 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -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
ET __builtin_reduce_add(VT a) \+ integer types
ET __builtin_reduce_mul(VT a) \* integer types
ET __builtin_reduce_and(VT a) & integer types
>From 2a7cb73cb24cc3c32a3fe14401b7051db8bad8a2 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sun, 3 Nov 2024 20:28:01 +0800
Subject: [PATCH 2/3] Update LanguageExtensions.rst
---
clang/docs/LanguageExtensions.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index b7676bab623ef8..e4157d59e3892c 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -745,8 +745,12 @@ 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 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
+ ET __builtin_reduce_max(VT a) return the largest element of the vector. If the element type is integer and floating point types
+ floating point, this function has the same comparison semantics as
+ ``__builtin_reduce_maximum``.
+ ET __builtin_reduce_min(VT a) return the smallest element of the vector. If the element type is integer and floating point types
+ floating point, this function has the same comparison semantics as
+ ``__builtin_reduce_minimum``.
ET __builtin_reduce_add(VT a) \+ integer types
ET __builtin_reduce_mul(VT a) \* integer types
ET __builtin_reduce_and(VT a) & integer types
>From b4863a5e3ed5d759f169196d459227f8706c715e Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Thu, 7 Nov 2024 23:35:30 +0800
Subject: [PATCH 3/3] Update LanguageExtensions.rst
---
clang/docs/LanguageExtensions.rst | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index e4157d59e3892c..276cc9419b54f2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -745,12 +745,10 @@ 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 the largest element of the vector. If the element type is integer and floating point types
- floating point, this function has the same comparison semantics as
- ``__builtin_reduce_maximum``.
- ET __builtin_reduce_min(VT a) return the smallest element of the vector. If the element type is integer and floating point types
- floating point, this function has the same comparison semantics as
- ``__builtin_reduce_minimum``.
+ ET __builtin_reduce_max(VT a) return the largest element of the vector. The result will always be integer and floating point types
+ a number unless all elements of the vector are NaN.
+ ET __builtin_reduce_min(VT a) return the smallest element of the vector. The result will always be integer and floating point types
+ a number unless all elements of the vector are NaN.
ET __builtin_reduce_add(VT a) \+ integer types
ET __builtin_reduce_mul(VT a) \* integer types
ET __builtin_reduce_and(VT a) & integer types
More information about the cfe-commits
mailing list