-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[libc][math][c++23] Add sqrtbf16 math function #156654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krishna2803
wants to merge
6
commits into
llvm:main
Choose a base branch
from
krishna2803:sqrtbf16
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
@llvm/pr-subscribers-backend-risc-v @llvm/pr-subscribers-libc Author: Krishna Pandey (krishna2803) ChangesThis PR adds sqrtbf16 higher math function for BFloat16 type along with the tests. Patch is 53.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/156654.diff 22 Files Affected:
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index c2e4c337f199a..df9f61ca6c108 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -811,6 +811,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index c4f3a87659b23..779f37be1859c 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -814,6 +814,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 380ca57ea8aa9..d0ced09111f9f 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -814,6 +814,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 1f4318fc88389..a9ae541f8ed44 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -644,6 +644,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 0cba22016c960..120d98a4a6160 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -287,6 +287,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index e08b028865bfc..66d0b618fb7cb 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -670,6 +670,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 88c8fc91ebb77..395c7985feee7 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -672,6 +672,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 20924e9047c69..079466c3b8d81 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -899,6 +899,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index f2e8ddfe8e91a..116f554a6374b 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -514,6 +514,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 0ad36a667232a..e5665a7cd139b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -917,6 +917,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index c060e900472eb..73ad93d3fdf18 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -950,6 +950,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 9e45b800b10a3..c742d88f8c90d 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -360,6 +360,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
+ libc.src.math.sqrtbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
diff --git a/libc/docs/headers/math/index.rst b/libc/docs/headers/math/index.rst
index b329bf031312d..016d96ce69d4b 100644
--- a/libc/docs/headers/math/index.rst
+++ b/libc/docs/headers/math/index.rst
@@ -255,113 +255,113 @@ Basic Operations
Higher Math Functions
=====================
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section |
-+===========+==================+=================+========================+======================+========================+========================+============================+
-| acos | |check| | |check| | | |check| | | 7.12.4.1 | F.10.1.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| acosh | |check| | | | |check| | | 7.12.5.1 | F.10.2.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| acospi | | | | |check| | | 7.12.4.8 | F.10.1.8 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| asin | |check| | |check| | | |check| | | 7.12.4.2 | F.10.1.2 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| asinh | |check| | | | |check| | | 7.12.5.2 | F.10.2.2 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| asinpi | | | | |check| | | 7.12.4.9 | F.10.1.9 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| atan | |check| | 1 ULP | | |check| | | 7.12.4.3 | F.10.1.3 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| atan2 | |check| | 1 ULP | | | 1 ULP | 7.12.4.4 | F.10.1.4 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| atan2pi | | | | | | 7.12.4.11 | F.10.1.11 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| atanh | |check| | | | |check| | | 7.12.5.3 | F.10.2.3 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| atanpi | | | | | | 7.12.4.10 | F.10.1.10 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| cbrt | |check| | |check| | | | | 7.12.7.1 | F.10.4.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| compoundn | | | | | | 7.12.7.2 | F.10.4.2 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| cos | |check| | |check| | | |check| | | 7.12.4.5 | F.10.1.5 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| cosh | |check| | | | |check| | | 7.12.5.4 | F.10.2.4 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| cospi | |check| | | | |check| | | 7.12.4.12 | F.10.1.12 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dsqrt | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.6 | F.10.11 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| erf | |check| | | | | | 7.12.8.1 | F.10.5.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| erfc | | | | | | 7.12.8.2 | F.10.5.2 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| exp | |check| | |check| | | |check| | | 7.12.6.1 | F.10.3.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| exp10 | |check| | |check| | | |check| | | 7.12.6.2 | F.10.3.2 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| exp10m1 | |check| | | | |check| | | 7.12.6.3 | F.10.3.3 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| exp2 | |check| | |check| | | |check| | | 7.12.6.4 | F.10.3.4 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| exp2m1 | |check| | | | |check| | | 7.12.6.5 | F.10.3.5 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| expm1 | |check| | |check| | | |check| | | 7.12.6.6 | F.10.3.6 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fma | |check| | |check| | | |check| | | 7.12.13.1 | F.10.10.1 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| f16sqrt | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.6 | F.10.11 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fsqrt | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.6 | F.10.11 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| hypot | |check| | |check| | | |check| | | 7.12.7.4 | F.10.4.4 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| lgamma | | | | | | 7.12.8.3 | F.10.5.3 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log | |check| | |check| | | |check| | | 7.12.6.11 | F.10.3.11 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log10 | |check| | |check| | | |check| | | 7.12.6.12 | F.10.3.12 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log10p1 | | | | | | 7.12.6.13 | F.10.3.13 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log1p | |check| | |check| | | | | 7.12.6.14 | F.10.3.14 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log2 | |check| | |check| | | |check| | | 7.12.6.15 | F.10.3.15 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| log2p1 | | | | | | 7.12.6.16 | F.10.3.16 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| logp1 | | | | | | 7.12.6.14 | F.10.3.14 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| pow | |check| | 1 ULP | | | | 7.12.7.5 | F.10.4.5 |
-+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| powi\* | | | ...
[truncated]
|
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds sqrtbf16 higher math function for BFloat16 type along with the tests.