Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
11 changes: 11 additions & 0 deletions libc/config/baremetal/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/baremetal/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/baremetal/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/darwin/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
12 changes: 11 additions & 1 deletion libc/config/darwin/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16

libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

set(TARGET_LLVMLIBC_ENTRYPOINTS
Expand Down
11 changes: 11 additions & 0 deletions libc/config/gpu/amdgpu/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

set(TARGET_LLVMLIBC_ENTRYPOINTS
Expand Down
11 changes: 11 additions & 0 deletions libc/config/gpu/nvptx/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

set(TARGET_LLVMLIBC_ENTRYPOINTS
Expand Down
11 changes: 11 additions & 0 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/linux/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

set(TARGET_LLVMLIBC_ENTRYPOINTS
Expand Down
11 changes: 11 additions & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

if(LIBC_TYPES_HAS_FLOAT128)
Expand Down
11 changes: 11 additions & 0 deletions libc/config/windows/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,20 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.getpayloadbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.setpayloadbf16
libc.src.math.setpayloadsigbf16
libc.src.math.truncbf16
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)

set(TARGET_LLVMLIBC_ENTRYPOINTS
Expand Down
22 changes: 11 additions & 11 deletions libc/docs/headers/math/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| frexp | |check| | |check| | |check| | |check| | |check| | | 7.12.6.7 | F.10.3.7 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| fromfp | |check| | |check| | |check| | |check| | |check| | | 7.12.9.10 | F.10.6.10 |
| fromfp | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.10 | F.10.6.10 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| fromfpx | |check| | |check| | |check| | |check| | |check| | | 7.12.9.11 | F.10.6.11 |
| fromfpx | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.11 | F.10.6.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| fsub | N/A | |check| | |check| | N/A | |check|\* | N/A | 7.12.14.2 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| getpayload | |check| | |check| | |check| | |check| | |check| | | F.10.13.1 | N/A |
| getpayload | |check| | |check| | |check| | |check| | |check| | |check| | F.10.13.1 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| ilogb | |check| | |check| | |check| | |check| | |check| | | 7.12.6.8 | F.10.3.8 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
Expand Down Expand Up @@ -215,13 +215,13 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nearbyint | |check| | |check| | |check| | |check| | |check| | | 7.12.9.3 | F.10.6.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextafter | |check| | |check| | |check| | |check| | |check| | | 7.12.11.3 | F.10.8.3 |
| nextafter | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.3 | F.10.8.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextdown | |check| | |check| | |check| | |check| | |check| | | 7.12.11.6 | F.10.8.6 |
| nextdown | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.6 | F.10.8.6 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nexttoward | |check| | |check| | |check| | |check| | N/A | | 7.12.11.4 | F.10.8.4 |
| nexttoward | |check| | |check| | |check| | |check| | N/A | |check| | 7.12.11.4 | F.10.8.4 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextup | |check| | |check| | |check| | |check| | |check| | | 7.12.11.5 | F.10.8.5 |
| nextup | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| remainder | |check| | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
Expand All @@ -237,19 +237,19 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| scalbn | |check| | |check| | |check| | |check| | |check| | | 7.12.6.19 | F.10.3.19 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| setpayload | |check| | |check| | |check| | |check| | |check| | | F.10.13.2 | N/A |
| setpayload | |check| | |check| | |check| | |check| | |check| | |check| | F.10.13.2 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| setpayloadsig | |check| | |check| | |check| | |check| | |check| | | F.10.13.3 | N/A |
| setpayloadsig | |check| | |check| | |check| | |check| | |check| | |check| | F.10.13.3 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| totalorder | |check| | |check| | |check| | |check| | |check| | | F.10.12.1 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| totalordermag | |check| | |check| | |check| | |check| | |check| | | F.10.12.2 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| trunc | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.9 | F.10.6.9 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| ufromfp | |check| | |check| | |check| | |check| | |check| | | 7.12.9.10 | F.10.6.10 |
| ufromfp | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.10 | F.10.6.10 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| ufromfpx | |check| | |check| | |check| | |check| | |check| | | 7.12.9.11 | F.10.6.11 |
| ufromfpx | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.11 | F.10.6.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+

Higher Math Functions
Expand Down
5 changes: 4 additions & 1 deletion libc/src/__support/FPUtil/BasicOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> getpayload(T x) {

return static_cast<T>(payload_dfloat);
} else {
return static_cast<T>(payload);
if constexpr (cpp::is_same_v<T, bfloat16>)
return T(static_cast<int>(payload));
else
return static_cast<T>(payload);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have the BFloat16(uint16_t bits) constructor again? Removing it makes this change unnecessary and libc-math-smoke-tests and libc.test.src.__support.FPUtil.bfloat16_test.__unit__ still pass.

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 added it in case we might need to construct bfloat16 directly using uint16 values to be able to set its bits directly, but I think it can be removed as we don't use it anywhere. I will run all tests locally to confirm this.

}
}

Expand Down
Loading
Loading