Compare commits
17 Commits
main
...
users/kris
Author | SHA1 | Date | |
---|---|---|---|
![]() |
250cfeaa32 | ||
![]() |
27364c5fe2 | ||
![]() |
ae0e6165f5 | ||
![]() |
ea9625e60e | ||
![]() |
70e4463400 | ||
![]() |
fc2b6ebb84 | ||
![]() |
8ea9354557 | ||
![]() |
c8f43800a5 | ||
![]() |
6f8d84d83b | ||
![]() |
12f1923f5e | ||
![]() |
a98b9281d8 | ||
![]() |
446e63718e | ||
![]() |
4a80312010 | ||
![]() |
733f4f17cc | ||
![]() |
baaf0e03e1 | ||
![]() |
0a2b5278c8 | ||
![]() |
b58785d627 |
@ -785,9 +785,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -788,9 +788,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -788,9 +788,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -618,9 +618,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -261,10 +261,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
||||||
|
@ -644,9 +644,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
||||||
|
@ -645,9 +645,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
||||||
|
@ -872,9 +872,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -488,9 +488,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
||||||
|
@ -891,9 +891,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -923,9 +923,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBC_TYPES_HAS_FLOAT128)
|
if(LIBC_TYPES_HAS_FLOAT128)
|
||||||
|
@ -334,9 +334,21 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_magbf16
|
libc.src.math.fminimum_magbf16
|
||||||
libc.src.math.fminimum_mag_numbf16
|
libc.src.math.fminimum_mag_numbf16
|
||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.math.nextupbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
set(TARGET_LLVMLIBC_ENTRYPOINTS
|
||||||
|
@ -181,13 +181,13 @@ Basic Operations
|
|||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| frexp | |check| | |check| | |check| | |check| | |check| | | 7.12.6.7 | F.10.3.7 |
|
| 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 |
|
| 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 |
|
| ilogb | |check| | |check| | |check| | |check| | |check| | | 7.12.6.8 | F.10.3.8 |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
@ -211,17 +211,17 @@ Basic Operations
|
|||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| modf | |check| | |check| | |check| | |check| | |check| | | 7.12.6.18 | F.10.3.18 |
|
| modf | |check| | |check| | |check| | |check| | |check| | | 7.12.6.18 | F.10.3.18 |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| nan | |check| | |check| | |check| | |check| | |check| | | 7.12.11.2 | F.10.8.2 |
|
| nan | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.2 | F.10.8.2 |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| nearbyint | |check| | |check| | |check| | |check| | |check| | | 7.12.9.3 | F.10.6.3 |
|
| 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 |
|
| remainder | |check| | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
@ -237,9 +237,9 @@ Basic Operations
|
|||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| scalbn | |check| | |check| | |check| | |check| | |check| | | 7.12.6.19 | F.10.3.19 |
|
| 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 |
|
| totalorder | |check| | |check| | |check| | |check| | |check| | | F.10.12.1 | N/A |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
@ -247,9 +247,9 @@ Basic Operations
|
|||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| trunc | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.9.9 | F.10.6.9 |
|
| 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
|
Higher Math Functions
|
||||||
|
@ -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);
|
return static_cast<T>(payload_dfloat);
|
||||||
} else {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,12 +312,14 @@ add_math_entrypoint_object(fromfpf)
|
|||||||
add_math_entrypoint_object(fromfpl)
|
add_math_entrypoint_object(fromfpl)
|
||||||
add_math_entrypoint_object(fromfpf16)
|
add_math_entrypoint_object(fromfpf16)
|
||||||
add_math_entrypoint_object(fromfpf128)
|
add_math_entrypoint_object(fromfpf128)
|
||||||
|
add_math_entrypoint_object(fromfpbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(fromfpx)
|
add_math_entrypoint_object(fromfpx)
|
||||||
add_math_entrypoint_object(fromfpxf)
|
add_math_entrypoint_object(fromfpxf)
|
||||||
add_math_entrypoint_object(fromfpxl)
|
add_math_entrypoint_object(fromfpxl)
|
||||||
add_math_entrypoint_object(fromfpxf16)
|
add_math_entrypoint_object(fromfpxf16)
|
||||||
add_math_entrypoint_object(fromfpxf128)
|
add_math_entrypoint_object(fromfpxf128)
|
||||||
|
add_math_entrypoint_object(fromfpxbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(fsub)
|
add_math_entrypoint_object(fsub)
|
||||||
add_math_entrypoint_object(fsubl)
|
add_math_entrypoint_object(fsubl)
|
||||||
@ -328,6 +330,7 @@ add_math_entrypoint_object(getpayloadf)
|
|||||||
add_math_entrypoint_object(getpayloadl)
|
add_math_entrypoint_object(getpayloadl)
|
||||||
add_math_entrypoint_object(getpayloadf16)
|
add_math_entrypoint_object(getpayloadf16)
|
||||||
add_math_entrypoint_object(getpayloadf128)
|
add_math_entrypoint_object(getpayloadf128)
|
||||||
|
add_math_entrypoint_object(getpayloadbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(hypot)
|
add_math_entrypoint_object(hypot)
|
||||||
add_math_entrypoint_object(hypotf)
|
add_math_entrypoint_object(hypotf)
|
||||||
@ -417,6 +420,7 @@ add_math_entrypoint_object(nanf)
|
|||||||
add_math_entrypoint_object(nanl)
|
add_math_entrypoint_object(nanl)
|
||||||
add_math_entrypoint_object(nanf16)
|
add_math_entrypoint_object(nanf16)
|
||||||
add_math_entrypoint_object(nanf128)
|
add_math_entrypoint_object(nanf128)
|
||||||
|
add_math_entrypoint_object(nanbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nearbyint)
|
add_math_entrypoint_object(nearbyint)
|
||||||
add_math_entrypoint_object(nearbyintf)
|
add_math_entrypoint_object(nearbyintf)
|
||||||
@ -429,23 +433,27 @@ add_math_entrypoint_object(nextafterf)
|
|||||||
add_math_entrypoint_object(nextafterl)
|
add_math_entrypoint_object(nextafterl)
|
||||||
add_math_entrypoint_object(nextafterf16)
|
add_math_entrypoint_object(nextafterf16)
|
||||||
add_math_entrypoint_object(nextafterf128)
|
add_math_entrypoint_object(nextafterf128)
|
||||||
|
add_math_entrypoint_object(nextafterbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nexttoward)
|
add_math_entrypoint_object(nexttoward)
|
||||||
add_math_entrypoint_object(nexttowardf)
|
add_math_entrypoint_object(nexttowardf)
|
||||||
add_math_entrypoint_object(nexttowardl)
|
add_math_entrypoint_object(nexttowardl)
|
||||||
add_math_entrypoint_object(nexttowardf16)
|
add_math_entrypoint_object(nexttowardf16)
|
||||||
|
add_math_entrypoint_object(nexttowardbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nextdown)
|
add_math_entrypoint_object(nextdown)
|
||||||
add_math_entrypoint_object(nextdownf)
|
add_math_entrypoint_object(nextdownf)
|
||||||
add_math_entrypoint_object(nextdownl)
|
add_math_entrypoint_object(nextdownl)
|
||||||
add_math_entrypoint_object(nextdownf16)
|
add_math_entrypoint_object(nextdownf16)
|
||||||
add_math_entrypoint_object(nextdownf128)
|
add_math_entrypoint_object(nextdownf128)
|
||||||
|
add_math_entrypoint_object(nextdownbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nextup)
|
add_math_entrypoint_object(nextup)
|
||||||
add_math_entrypoint_object(nextupf)
|
add_math_entrypoint_object(nextupf)
|
||||||
add_math_entrypoint_object(nextupl)
|
add_math_entrypoint_object(nextupl)
|
||||||
add_math_entrypoint_object(nextupf16)
|
add_math_entrypoint_object(nextupf16)
|
||||||
add_math_entrypoint_object(nextupf128)
|
add_math_entrypoint_object(nextupf128)
|
||||||
|
add_math_entrypoint_object(nextupbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(pow)
|
add_math_entrypoint_object(pow)
|
||||||
add_math_entrypoint_object(powf)
|
add_math_entrypoint_object(powf)
|
||||||
@ -501,12 +509,14 @@ add_math_entrypoint_object(setpayloadf)
|
|||||||
add_math_entrypoint_object(setpayloadl)
|
add_math_entrypoint_object(setpayloadl)
|
||||||
add_math_entrypoint_object(setpayloadf16)
|
add_math_entrypoint_object(setpayloadf16)
|
||||||
add_math_entrypoint_object(setpayloadf128)
|
add_math_entrypoint_object(setpayloadf128)
|
||||||
|
add_math_entrypoint_object(setpayloadbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(setpayloadsig)
|
add_math_entrypoint_object(setpayloadsig)
|
||||||
add_math_entrypoint_object(setpayloadsigf)
|
add_math_entrypoint_object(setpayloadsigf)
|
||||||
add_math_entrypoint_object(setpayloadsigl)
|
add_math_entrypoint_object(setpayloadsigl)
|
||||||
add_math_entrypoint_object(setpayloadsigf16)
|
add_math_entrypoint_object(setpayloadsigf16)
|
||||||
add_math_entrypoint_object(setpayloadsigf128)
|
add_math_entrypoint_object(setpayloadsigf128)
|
||||||
|
add_math_entrypoint_object(setpayloadsigbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(sincos)
|
add_math_entrypoint_object(sincos)
|
||||||
add_math_entrypoint_object(sincosf)
|
add_math_entrypoint_object(sincosf)
|
||||||
@ -567,12 +577,14 @@ add_math_entrypoint_object(ufromfpf)
|
|||||||
add_math_entrypoint_object(ufromfpl)
|
add_math_entrypoint_object(ufromfpl)
|
||||||
add_math_entrypoint_object(ufromfpf16)
|
add_math_entrypoint_object(ufromfpf16)
|
||||||
add_math_entrypoint_object(ufromfpf128)
|
add_math_entrypoint_object(ufromfpf128)
|
||||||
|
add_math_entrypoint_object(ufromfpbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(ufromfpx)
|
add_math_entrypoint_object(ufromfpx)
|
||||||
add_math_entrypoint_object(ufromfpxf)
|
add_math_entrypoint_object(ufromfpxf)
|
||||||
add_math_entrypoint_object(ufromfpxl)
|
add_math_entrypoint_object(ufromfpxl)
|
||||||
add_math_entrypoint_object(ufromfpxf16)
|
add_math_entrypoint_object(ufromfpxf16)
|
||||||
add_math_entrypoint_object(ufromfpxf128)
|
add_math_entrypoint_object(ufromfpxf128)
|
||||||
|
add_math_entrypoint_object(ufromfpxbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(bf16add)
|
add_math_entrypoint_object(bf16add)
|
||||||
add_math_entrypoint_object(bf16addf)
|
add_math_entrypoint_object(bf16addf)
|
||||||
|
21
libc/src/math/fromfpbf16.h
Normal file
21
libc/src/math/fromfpbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for fromfpbf16 --------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_FROMFPBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_FROMFPBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 fromfpbf16(bfloat16 x, int rnd, unsigned int width);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_FROMFPBF16_H
|
21
libc/src/math/fromfpxbf16.h
Normal file
21
libc/src/math/fromfpxbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for fromfpxbf16 -------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_FROMFPXBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_FROMFPXBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 fromfpxbf16(bfloat16 x, int rnd, unsigned int width);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_FROMFPXBF16_H
|
@ -3444,6 +3444,22 @@ add_entrypoint_object(
|
|||||||
libc.src.errno.errno
|
libc.src.errno.errno
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
nanbf16
|
||||||
|
SRCS
|
||||||
|
nanbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../nanbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.errno.errno
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.libc_errno
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
libc.src.__support.str_to_float
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
nextafter
|
nextafter
|
||||||
SRCS
|
SRCS
|
||||||
@ -3496,6 +3512,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
nextafterbf16
|
||||||
|
SRCS
|
||||||
|
nextafterbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../nextafterbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
nexttoward
|
nexttoward
|
||||||
SRCS
|
SRCS
|
||||||
@ -3537,6 +3567,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
nexttowardbf16
|
||||||
|
SRCS
|
||||||
|
nexttowardbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../nexttowardbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
nextdown
|
nextdown
|
||||||
SRCS
|
SRCS
|
||||||
@ -3589,6 +3633,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
nextdownbf16
|
||||||
|
SRCS
|
||||||
|
nextdownbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../nextdownbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
nextup
|
nextup
|
||||||
SRCS
|
SRCS
|
||||||
@ -3641,6 +3699,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
nextupbf16
|
||||||
|
SRCS
|
||||||
|
nextupbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../nextupbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.manipulation_functions
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
fmod
|
fmod
|
||||||
SRCS
|
SRCS
|
||||||
@ -3745,6 +3817,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.nearest_integer_operations
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
fromfpbf16
|
||||||
|
SRCS
|
||||||
|
fromfpbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../fromfpbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
fromfpx
|
fromfpx
|
||||||
SRCS
|
SRCS
|
||||||
@ -3797,6 +3883,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.nearest_integer_operations
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
fromfpxbf16
|
||||||
|
SRCS
|
||||||
|
fromfpxbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../fromfpxbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
ufromfp
|
ufromfp
|
||||||
SRCS
|
SRCS
|
||||||
@ -3849,6 +3949,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.nearest_integer_operations
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
ufromfpbf16
|
||||||
|
SRCS
|
||||||
|
ufromfpbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../ufromfpbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
ufromfpx
|
ufromfpx
|
||||||
SRCS
|
SRCS
|
||||||
@ -3901,6 +4015,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.nearest_integer_operations
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
ufromfpxbf16
|
||||||
|
SRCS
|
||||||
|
ufromfpxbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../ufromfpxbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.nearest_integer_operations
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
coshf
|
coshf
|
||||||
SRCS
|
SRCS
|
||||||
@ -4497,6 +4625,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.basic_operations
|
libc.src.__support.FPUtil.basic_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
getpayloadbf16
|
||||||
|
SRCS
|
||||||
|
getpayloadbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../getpayloadbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.basic_operations
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
setpayload
|
setpayload
|
||||||
SRCS
|
SRCS
|
||||||
@ -4549,6 +4691,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.basic_operations
|
libc.src.__support.FPUtil.basic_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
setpayloadbf16
|
||||||
|
SRCS
|
||||||
|
setpayloadbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../setpayloadbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.basic_operations
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
setpayloadsig
|
setpayloadsig
|
||||||
SRCS
|
SRCS
|
||||||
@ -4601,6 +4757,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.basic_operations
|
libc.src.__support.FPUtil.basic_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_entrypoint_object(
|
||||||
|
setpayloadsigbf16
|
||||||
|
SRCS
|
||||||
|
setpayloadsigbf16.cpp
|
||||||
|
HDRS
|
||||||
|
../setpayloadsigbf16.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.__support.common
|
||||||
|
libc.src.__support.FPUtil.basic_operations
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.macros.config
|
||||||
|
libc.src.__support.macros.properties.types
|
||||||
|
)
|
||||||
|
|
||||||
add_entrypoint_object(
|
add_entrypoint_object(
|
||||||
f16add
|
f16add
|
||||||
SRCS
|
SRCS
|
||||||
|
22
libc/src/math/generic/fromfpbf16.cpp
Normal file
22
libc/src/math/generic/fromfpbf16.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//===-- Implementation of fromfpbf16 function -----------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/fromfpbf16.h"
|
||||||
|
#include "src/__support/FPUtil/NearestIntegerOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, fromfpbf16,
|
||||||
|
(bfloat16 x, int rnd, unsigned int width)) {
|
||||||
|
return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
22
libc/src/math/generic/fromfpxbf16.cpp
Normal file
22
libc/src/math/generic/fromfpxbf16.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//===-- Implementation of fromfpxbf16 function ----------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/fromfpxbf16.h"
|
||||||
|
#include "src/__support/FPUtil/NearestIntegerOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, fromfpxbf16,
|
||||||
|
(bfloat16 x, int rnd, unsigned int width)) {
|
||||||
|
return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/getpayloadbf16.cpp
Normal file
21
libc/src/math/generic/getpayloadbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of getpayloadbf16 function -------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/getpayloadbf16.h"
|
||||||
|
#include "src/__support/FPUtil/BasicOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, getpayloadbf16, (const bfloat16 *x)) {
|
||||||
|
return fputil::getpayload(*x);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
25
libc/src/math/generic/nanbf16.cpp
Normal file
25
libc/src/math/generic/nanbf16.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//===-- Implementation of nanbf16 function --------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/nanbf16.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/libc_errno.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/str_to_float.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, nanbf16, (const char *arg)) {
|
||||||
|
auto result = internal::strtonan<bfloat16>(arg);
|
||||||
|
if (result.has_error())
|
||||||
|
libc_errno = result.error;
|
||||||
|
return result.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/nextafterbf16.cpp
Normal file
21
libc/src/math/generic/nextafterbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of nextafterbf16 function --------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/nextafterbf16.h"
|
||||||
|
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, nextafterbf16, (bfloat16 x, bfloat16 y)) {
|
||||||
|
return fputil::nextafter(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/nextdownbf16.cpp
Normal file
21
libc/src/math/generic/nextdownbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of nextdownbf16 function ---------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/nextdownbf16.h"
|
||||||
|
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, nextdownbf16, (bfloat16 x)) {
|
||||||
|
return fputil::nextupdown</*IsDown=*/true>(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
22
libc/src/math/generic/nexttowardbf16.cpp
Normal file
22
libc/src/math/generic/nexttowardbf16.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//===-- Implementation of nexttowardbf16 function -------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/nexttowardbf16.h"
|
||||||
|
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, nexttowardbf16, (bfloat16 x, long double y)) {
|
||||||
|
// nextafter<T, U> where T != U is nexttoward
|
||||||
|
return fputil::nextafter(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/nextupbf16.cpp
Normal file
21
libc/src/math/generic/nextupbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of nextupbf16 function -----------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/nextupbf16.h"
|
||||||
|
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, nextupbf16, (bfloat16 x)) {
|
||||||
|
return fputil::nextupdown</*IsDown=*/false>(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/setpayloadbf16.cpp
Normal file
21
libc/src/math/generic/setpayloadbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of setpayloadbf16 function -------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/setpayloadbf16.h"
|
||||||
|
#include "src/__support/FPUtil/BasicOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(int, setpayloadbf16, (bfloat16 * res, bfloat16 pl)) {
|
||||||
|
return static_cast<int>(fputil::setpayload</*IsSignaling=*/false>(*res, pl));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/setpayloadsigbf16.cpp
Normal file
21
libc/src/math/generic/setpayloadsigbf16.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation of setpayloadsigbf16 function ----------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/setpayloadsigbf16.h"
|
||||||
|
#include "src/__support/FPUtil/BasicOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(int, setpayloadsigbf16, (bfloat16 * res, bfloat16 pl)) {
|
||||||
|
return static_cast<int>(fputil::setpayload</*IsSignaling=*/true>(*res, pl));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
22
libc/src/math/generic/ufromfpbf16.cpp
Normal file
22
libc/src/math/generic/ufromfpbf16.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//===-- Implementation of ufromfpbf16 function ----------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/ufromfpbf16.h"
|
||||||
|
#include "src/__support/FPUtil/NearestIntegerOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, ufromfpbf16,
|
||||||
|
(bfloat16 x, int rnd, unsigned int width)) {
|
||||||
|
return fputil::fromfp</*IsSigned=*/false>(x, rnd, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
22
libc/src/math/generic/ufromfpxbf16.cpp
Normal file
22
libc/src/math/generic/ufromfpxbf16.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//===-- Implementation of ufromfpxbf16 function ---------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "src/math/ufromfpxbf16.h"
|
||||||
|
#include "src/__support/FPUtil/NearestIntegerOperations.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/__support/common.h"
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
LLVM_LIBC_FUNCTION(bfloat16, ufromfpxbf16,
|
||||||
|
(bfloat16 x, int rnd, unsigned int width)) {
|
||||||
|
return fputil::fromfpx</*IsSigned=*/false>(x, rnd, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/getpayloadbf16.h
Normal file
21
libc/src/math/getpayloadbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for getpayloadbf16 ----------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_GETPAYLOADBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_GETPAYLOADBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 getpayloadbf16(const bfloat16 *x);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_GETPAYLOADBF16_H
|
21
libc/src/math/nanbf16.h
Normal file
21
libc/src/math/nanbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nanbf16 -----------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NANBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NANBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nanbf16(const char *arg);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NANBF16_H
|
21
libc/src/math/nextafterbf16.h
Normal file
21
libc/src/math/nextafterbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nextafterbf16 -----------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NEXTAFTERBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTAFTERBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nextafterbf16(bfloat16 x, bfloat16 y);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTAFTERBF16_H
|
21
libc/src/math/nextdownbf16.h
Normal file
21
libc/src/math/nextdownbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nextdownbf16 ------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NEXTDOWNBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTDOWNBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nextdownbf16(bfloat16 x);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTDOWNBF16_H
|
21
libc/src/math/nexttowardbf16.h
Normal file
21
libc/src/math/nexttowardbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nexttowardbf16 ----------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nexttowardbf16(bfloat16 x, long double y);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
21
libc/src/math/nextupbf16.h
Normal file
21
libc/src/math/nextupbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nextupbf16 --------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NEXTUPBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTUPBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nextupbf16(bfloat16 x);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTUPBF16_H
|
21
libc/src/math/setpayloadbf16.h
Normal file
21
libc/src/math/setpayloadbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for setpayloadbf16 ----------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_SETPAYLOADBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_SETPAYLOADBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
int setpayloadbf16(bfloat16 *res, bfloat16 pl);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_SETPAYLOADBF16_H
|
21
libc/src/math/setpayloadsigbf16.h
Normal file
21
libc/src/math/setpayloadsigbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for setpayloadsigbf16 -------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_SETPAYLOADSIGBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_SETPAYLOADSIGBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
int setpayloadsigbf16(bfloat16 *res, bfloat16 pl);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_SETPAYLOADSIGBF16_H
|
21
libc/src/math/ufromfpbf16.h
Normal file
21
libc/src/math/ufromfpbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for ufromfpbf16 -------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_UFROMFPBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_UFROMFPBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 ufromfpbf16(bfloat16 x, int rnd, unsigned int width);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_UFROMFPBF16_H
|
21
libc/src/math/ufromfpxbf16.h
Normal file
21
libc/src/math/ufromfpxbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for ufromfpxbf16 ------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_UFROMFPXBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_UFROMFPXBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 ufromfpxbf16(bfloat16 x, int rnd, unsigned int width);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_UFROMFPXBF16_H
|
@ -1596,6 +1596,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.fromfpf128
|
libc.src.math.fromfpf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
fromfpbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
fromfpbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
FromfpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.fromfpbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
fromfpx_test
|
fromfpx_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -1656,6 +1669,20 @@ add_fp_unittest(
|
|||||||
libc.src.math.fromfpxf128
|
libc.src.math.fromfpxf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
fromfpxbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
fromfpxbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
FromfpxTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
ufromfp_test
|
ufromfp_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -1716,6 +1743,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.ufromfpf128
|
libc.src.math.ufromfpf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
ufromfpbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
ufromfpbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
UfromfpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.ufromfpbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
ufromfpx_test
|
ufromfpx_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -1776,6 +1816,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.ufromfpxf128
|
libc.src.math.ufromfpxf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
ufromfpxbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
ufromfpxbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
UfromfpxTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.ufromfpxbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
ilogb_test
|
ilogb_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3462,6 +3515,22 @@ add_fp_unittest(
|
|||||||
UNIT_TEST_ONLY
|
UNIT_TEST_ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nanbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nanbf16_test.cpp
|
||||||
|
DEPENDS
|
||||||
|
libc.hdr.signal_macros
|
||||||
|
libc.src.math.nanbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.fp_bits
|
||||||
|
# FIXME: The nan tests currently have death tests, which aren't supported for
|
||||||
|
# hermetic tests.
|
||||||
|
UNIT_TEST_ONLY
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
nearbyint_test
|
nearbyint_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3607,6 +3676,19 @@ add_fp_unittest(
|
|||||||
libc.src.__support.FPUtil.fp_bits
|
libc.src.__support.FPUtil.fp_bits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextafterbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextafterbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextUpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
# FIXME: These tests are currently spurious for the GPU.
|
# FIXME: These tests are currently spurious for the GPU.
|
||||||
if(NOT LIBC_TARGET_OS_IS_GPU)
|
if(NOT LIBC_TARGET_OS_IS_GPU)
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
@ -3674,6 +3756,19 @@ add_fp_unittest(
|
|||||||
libc.src.__support.FPUtil.fp_bits
|
libc.src.__support.FPUtil.fp_bits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nexttowardbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nexttowardbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextUpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
nextdown_test
|
nextdown_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3734,6 +3829,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.nextdownf128
|
libc.src.math.nextdownf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextdownbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextdownbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextUpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
nextup_test
|
nextup_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3794,6 +3902,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.nextupf128
|
libc.src.math.nextupf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextupbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextupbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextUpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nextupbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
# TODO(lntue): The current implementation of fputil::general::fma<float> is only
|
# TODO(lntue): The current implementation of fputil::general::fma<float> is only
|
||||||
# correctly rounded for the default rounding mode round-to-nearest tie-to-even.
|
# correctly rounded for the default rounding mode round-to-nearest tie-to-even.
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
@ -4748,6 +4869,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.getpayloadf128
|
libc.src.math.getpayloadf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
getpayloadbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
getpayloadbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
GetPayloadTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.getpayloadbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
setpayload_test
|
setpayload_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -4808,6 +4942,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.setpayloadf128
|
libc.src.math.setpayloadf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
setpayloadbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
setpayloadbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
SetPayloadTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.setpayloadbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
setpayloadsig_test
|
setpayloadsig_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -4868,6 +5015,18 @@ add_fp_unittest(
|
|||||||
libc.src.math.setpayloadsigf128
|
libc.src.math.setpayloadsigf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
setpayloadsigbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
setpayloadsigbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
SetPayloadTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.setpayloadsigbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
f16add_test
|
f16add_test
|
||||||
|
@ -85,10 +85,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_UPWARD, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_UPWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_UPWARD, 5U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_UPWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.65), FP_INT_UPWARD, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.65), FP_INT_UPWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.38), FP_INT_UPWARD, 8U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.25), FP_INT_UPWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.38), FP_INT_UPWARD, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.25), FP_INT_UPWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_UPWARD, 8U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_UPWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.96), FP_INT_UPWARD, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.75), FP_INT_UPWARD, 8U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsUpwardOutsideRange(FromfpFunc func) {
|
void testFractionsUpwardOutsideRange(FromfpFunc func) {
|
||||||
@ -139,10 +139,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(-11.0), func(T(-10.32), FP_INT_DOWNWARD, 5U));
|
EXPECT_FP_EQ(T(-11.0), func(T(-10.32), FP_INT_DOWNWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 5U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_DOWNWARD, 5U));
|
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_DOWNWARD, 5U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_DOWNWARD, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_DOWNWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(-124.0), func(T(-123.38), FP_INT_DOWNWARD, 8U));
|
EXPECT_FP_EQ(T(-64.0), func(T(-63.25), FP_INT_DOWNWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.96), FP_INT_DOWNWARD, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.75), FP_INT_DOWNWARD, 8U));
|
||||||
EXPECT_FP_EQ(T(-124.0), func(T(-123.96), FP_INT_DOWNWARD, 8U));
|
EXPECT_FP_EQ(T(-64.0), func(T(-63.75), FP_INT_DOWNWARD, 8U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsDownwardOutsideRange(FromfpFunc func) {
|
void testFractionsDownwardOutsideRange(FromfpFunc func) {
|
||||||
@ -193,10 +193,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TOWARDZERO, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TOWARDZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 5U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.65), FP_INT_TOWARDZERO, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.65), FP_INT_TOWARDZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TOWARDZERO, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TOWARDZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.38), FP_INT_TOWARDZERO, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.25), FP_INT_TOWARDZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.96), FP_INT_TOWARDZERO, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.75), FP_INT_TOWARDZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.96), FP_INT_TOWARDZERO, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.75), FP_INT_TOWARDZERO, 8U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsTowardZeroOutsideRange(FromfpFunc func) {
|
void testFractionsTowardZeroOutsideRange(FromfpFunc func) {
|
||||||
@ -241,10 +241,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TONEARESTFROMZERO, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TONEARESTFROMZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 5U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_TONEARESTFROMZERO, 5U));
|
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_TONEARESTFROMZERO, 5U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TONEARESTFROMZERO, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TONEARESTFROMZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.38), FP_INT_TONEARESTFROMZERO, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.25), FP_INT_TONEARESTFROMZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_TONEARESTFROMZERO, 8U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_TONEARESTFROMZERO, 8U));
|
||||||
EXPECT_FP_EQ(T(-124.0), func(T(-123.96), FP_INT_TONEARESTFROMZERO, 8U));
|
EXPECT_FP_EQ(T(-64.0), func(T(-63.75), FP_INT_TONEARESTFROMZERO, 8U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsToNearestFromZeroOutsideRange(FromfpFunc func) {
|
void testFractionsToNearestFromZeroOutsideRange(FromfpFunc func) {
|
||||||
@ -297,10 +297,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TONEAREST, 5U));
|
EXPECT_FP_EQ(T(-10.0), func(T(-10.32), FP_INT_TONEAREST, 5U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEAREST, 5U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEAREST, 5U));
|
||||||
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_TONEAREST, 5U));
|
EXPECT_FP_EQ(T(-11.0), func(T(-10.65), FP_INT_TONEAREST, 5U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TONEAREST, 8U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TONEAREST, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0), func(T(-123.38), FP_INT_TONEAREST, 8U));
|
EXPECT_FP_EQ(T(-63.0), func(T(-63.25), FP_INT_TONEAREST, 8U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_TONEAREST, 8U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_TONEAREST, 8U));
|
||||||
EXPECT_FP_EQ(T(-124.0), func(T(-123.96), FP_INT_TONEAREST, 8U));
|
EXPECT_FP_EQ(T(-64.0), func(T(-63.75), FP_INT_TONEAREST, 8U));
|
||||||
|
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.3), FP_INT_TONEAREST, 3U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.3), FP_INT_TONEAREST, 3U));
|
||||||
EXPECT_FP_EQ(T(-2.0), func(T(-2.3), FP_INT_TONEAREST, 2U));
|
EXPECT_FP_EQ(T(-2.0), func(T(-2.3), FP_INT_TONEAREST, 2U));
|
||||||
@ -391,14 +391,14 @@ public:
|
|||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U));
|
||||||
EXPECT_FP_EQ(T(-11.0),
|
EXPECT_FP_EQ(T(-11.0),
|
||||||
func(T(-10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U));
|
func(T(-10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U));
|
||||||
EXPECT_FP_EQ(T(123.0),
|
EXPECT_FP_EQ(T(63.0),
|
||||||
func(T(123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
func(T(63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
||||||
EXPECT_FP_EQ(T(-123.0),
|
EXPECT_FP_EQ(T(-63.0),
|
||||||
func(T(-123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
func(T(-63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
||||||
EXPECT_FP_EQ(T(124.0),
|
EXPECT_FP_EQ(T(64.0),
|
||||||
func(T(123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
func(T(63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
||||||
EXPECT_FP_EQ(T(-124.0),
|
EXPECT_FP_EQ(T(-64.0),
|
||||||
func(T(-123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
func(T(-63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U));
|
||||||
|
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 3U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 3U));
|
||||||
EXPECT_FP_EQ(T(-2.0), func(T(-2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
EXPECT_FP_EQ(T(-2.0), func(T(-2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
||||||
|
@ -101,13 +101,13 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(-10.0), func(T(-10.65), FP_INT_UPWARD, 5U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(-10.0), func(T(-10.65), FP_INT_UPWARD, 5U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.38), FP_INT_UPWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.25), FP_INT_UPWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(-123.0), func(T(-123.38), FP_INT_UPWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(-63.0), func(T(-63.25), FP_INT_UPWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.96), FP_INT_UPWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.75), FP_INT_UPWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(-123.0), func(T(-123.96), FP_INT_UPWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(-63.0), func(T(-63.75), FP_INT_UPWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,14 +175,14 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(-11.0), func(T(-10.65), FP_INT_DOWNWARD, 5U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(-11.0), func(T(-10.65), FP_INT_DOWNWARD, 5U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.38), FP_INT_DOWNWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.25), FP_INT_DOWNWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-124.0), func(T(-123.38), FP_INT_DOWNWARD, 8U), FE_INEXACT);
|
T(-64.0), func(T(-63.25), FP_INT_DOWNWARD, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.96), FP_INT_DOWNWARD, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.75), FP_INT_DOWNWARD, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-124.0), func(T(-123.96), FP_INT_DOWNWARD, 8U), FE_INEXACT);
|
T(-64.0), func(T(-63.75), FP_INT_DOWNWARD, 8U), FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsDownwardOutsideRange(FromfpxFunc func) {
|
void testFractionsDownwardOutsideRange(FromfpxFunc func) {
|
||||||
@ -250,13 +250,13 @@ public:
|
|||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-10.0), func(T(-10.65), FP_INT_TOWARDZERO, 5U), FE_INEXACT);
|
T(-10.0), func(T(-10.65), FP_INT_TOWARDZERO, 5U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
T(63.0), func(T(63.25), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-123.0), func(T(-123.38), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
T(-63.0), func(T(-63.25), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.96), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
T(63.0), func(T(63.75), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-123.0), func(T(-123.96), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
T(-63.0), func(T(-63.75), FP_INT_TOWARDZERO, 8U), FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsTowardZeroOutsideRange(FromfpxFunc func) {
|
void testFractionsTowardZeroOutsideRange(FromfpxFunc func) {
|
||||||
@ -318,13 +318,13 @@ public:
|
|||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-11.0), func(T(-10.65), FP_INT_TONEARESTFROMZERO, 5U), FE_INEXACT);
|
T(-11.0), func(T(-10.65), FP_INT_TONEARESTFROMZERO, 5U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
T(63.0), func(T(63.25), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-123.0), func(T(-123.38), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
T(-63.0), func(T(-63.25), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(124.0), func(T(123.96), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
T(64.0), func(T(63.75), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-124.0), func(T(-123.96), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
T(-64.0), func(T(-63.75), FP_INT_TONEARESTFROMZERO, 8U), FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsToNearestFromZeroOutsideRange(FromfpxFunc func) {
|
void testFractionsToNearestFromZeroOutsideRange(FromfpxFunc func) {
|
||||||
@ -393,14 +393,14 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(-11.0), func(T(-10.65), FP_INT_TONEAREST, 5U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(-11.0), func(T(-10.65), FP_INT_TONEAREST, 5U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.38), FP_INT_TONEAREST, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.25), FP_INT_TONEAREST, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-123.0), func(T(-123.38), FP_INT_TONEAREST, 8U), FE_INEXACT);
|
T(-63.0), func(T(-63.25), FP_INT_TONEAREST, 8U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.96), FP_INT_TONEAREST, 8U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.75), FP_INT_TONEAREST, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-124.0), func(T(-123.96), FP_INT_TONEAREST, 8U), FE_INEXACT);
|
T(-64.0), func(T(-63.75), FP_INT_TONEAREST, 8U), FE_INEXACT);
|
||||||
|
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(2.0), func(T(2.3), FP_INT_TONEAREST, 3U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(2.0), func(T(2.3), FP_INT_TONEAREST, 3U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
@ -530,16 +530,16 @@ public:
|
|||||||
T(-11.0), func(T(-10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U),
|
T(-11.0), func(T(-10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 5U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
T(63.0), func(T(63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-123.0), func(T(-123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
T(-63.0), func(T(-63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(124.0), func(T(123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
T(64.0), func(T(63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(-124.0), func(T(-123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
T(-64.0), func(T(-63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 8U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
|
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
|
@ -51,23 +51,50 @@ public:
|
|||||||
EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, sNaN));
|
EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, sNaN));
|
||||||
EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, neg_sNaN));
|
EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, neg_sNaN));
|
||||||
|
|
||||||
T qnan_42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 6) {
|
||||||
T neg_qnan_42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
|
// [S] [E..E] [QM..M] -> number of M bits should be at least 6
|
||||||
T snan_42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
|
// 0x31 = 0b110001 = 6 bits
|
||||||
T neg_snan_42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
|
T qnan_31 = FPBits::quiet_nan(Sign::POS, 0x31).get_val();
|
||||||
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, qnan_42));
|
T neg_qnan_31 = FPBits::quiet_nan(Sign::NEG, 0x31).get_val();
|
||||||
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, neg_qnan_42));
|
T snan_31 = FPBits::signaling_nan(Sign::POS, 0x31).get_val();
|
||||||
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, snan_42));
|
T neg_snan_31 = FPBits::signaling_nan(Sign::NEG, 0x31).get_val();
|
||||||
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, neg_snan_42));
|
EXPECT_FP_EQ(T(0x31.0p+0), funcWrapper(func, qnan_31));
|
||||||
|
EXPECT_FP_EQ(T(0x31.0p+0), funcWrapper(func, neg_qnan_31));
|
||||||
|
EXPECT_FP_EQ(T(0x31.0p+0), funcWrapper(func, snan_31));
|
||||||
|
EXPECT_FP_EQ(T(0x31.0p+0), funcWrapper(func, neg_snan_31));
|
||||||
|
|
||||||
T qnan_123 = FPBits::quiet_nan(Sign::POS, 0x123).get_val();
|
// 0x15 = 0b10101 = 5 bits
|
||||||
T neg_qnan_123 = FPBits::quiet_nan(Sign::NEG, 0x123).get_val();
|
T qnan_15 = FPBits::quiet_nan(Sign::POS, 0x15).get_val();
|
||||||
T snan_123 = FPBits::signaling_nan(Sign::POS, 0x123).get_val();
|
T neg_qnan_15 = FPBits::quiet_nan(Sign::NEG, 0x15).get_val();
|
||||||
T neg_snan_123 = FPBits::signaling_nan(Sign::NEG, 0x123).get_val();
|
T snan_15 = FPBits::signaling_nan(Sign::POS, 0x15).get_val();
|
||||||
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, qnan_123));
|
T neg_snan_15 = FPBits::signaling_nan(Sign::NEG, 0x15).get_val();
|
||||||
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, neg_qnan_123));
|
EXPECT_FP_EQ(T(0x15.0p+0), funcWrapper(func, qnan_15));
|
||||||
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, snan_123));
|
EXPECT_FP_EQ(T(0x15.0p+0), funcWrapper(func, neg_qnan_15));
|
||||||
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, neg_snan_123));
|
EXPECT_FP_EQ(T(0x15.0p+0), funcWrapper(func, snan_15));
|
||||||
|
EXPECT_FP_EQ(T(0x15.0p+0), funcWrapper(func, neg_snan_15));
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 7) {
|
||||||
|
T qnan_42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
|
||||||
|
T neg_qnan_42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
|
||||||
|
T snan_42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
|
||||||
|
T neg_snan_42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
|
||||||
|
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, qnan_42));
|
||||||
|
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, neg_qnan_42));
|
||||||
|
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, snan_42));
|
||||||
|
EXPECT_FP_EQ(T(0x42.0p+0), funcWrapper(func, neg_snan_42));
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 9) {
|
||||||
|
T qnan_123 = FPBits::quiet_nan(Sign::POS, 0x123).get_val();
|
||||||
|
T neg_qnan_123 = FPBits::quiet_nan(Sign::NEG, 0x123).get_val();
|
||||||
|
T snan_123 = FPBits::signaling_nan(Sign::POS, 0x123).get_val();
|
||||||
|
T neg_snan_123 = FPBits::signaling_nan(Sign::NEG, 0x123).get_val();
|
||||||
|
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, qnan_123));
|
||||||
|
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, neg_qnan_123));
|
||||||
|
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, snan_123));
|
||||||
|
EXPECT_FP_EQ(T(0x123.0p+0), funcWrapper(func, neg_snan_123));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "src/__support/CPP/bit.h"
|
#include "src/__support/CPP/bit.h"
|
||||||
#include "src/__support/FPUtil/FEnvImpl.h"
|
#include "src/__support/FPUtil/FEnvImpl.h"
|
||||||
#include "src/__support/FPUtil/FPBits.h"
|
#include "src/__support/FPUtil/FPBits.h"
|
||||||
|
#include "src/__support/sign.h"
|
||||||
#include "test/UnitTest/FEnvSafeTest.h"
|
#include "test/UnitTest/FEnvSafeTest.h"
|
||||||
#include "test/UnitTest/FPMatcher.h"
|
#include "test/UnitTest/FPMatcher.h"
|
||||||
#include "test/UnitTest/Test.h"
|
#include "test/UnitTest/Test.h"
|
||||||
@ -42,6 +43,8 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
|
|||||||
const T neg_inf = FPBits::inf(Sign::NEG).get_val();
|
const T neg_inf = FPBits::inf(Sign::NEG).get_val();
|
||||||
const T zero = FPBits::zero(Sign::POS).get_val();
|
const T zero = FPBits::zero(Sign::POS).get_val();
|
||||||
const T neg_zero = FPBits::zero(Sign::NEG).get_val();
|
const T neg_zero = FPBits::zero(Sign::NEG).get_val();
|
||||||
|
const T one = FPBits::one(Sign::POS).get_val();
|
||||||
|
const T neg_one = FPBits::one(Sign::NEG).get_val();
|
||||||
const T nan = FPBits::quiet_nan().get_val();
|
const T nan = FPBits::quiet_nan().get_val();
|
||||||
|
|
||||||
static constexpr StorageType min_subnormal =
|
static constexpr StorageType min_subnormal =
|
||||||
@ -55,8 +58,8 @@ public:
|
|||||||
typedef T (*NextAfterFunc)(T, T);
|
typedef T (*NextAfterFunc)(T, T);
|
||||||
|
|
||||||
void testNaN(NextAfterFunc func) {
|
void testNaN(NextAfterFunc func) {
|
||||||
ASSERT_FP_EQ(func(nan, 0), nan);
|
ASSERT_FP_EQ(func(nan, zero), nan);
|
||||||
ASSERT_FP_EQ(func(0, nan), nan);
|
ASSERT_FP_EQ(func(zero, nan), nan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBoundaries(NextAfterFunc func) {
|
void testBoundaries(NextAfterFunc func) {
|
||||||
@ -65,68 +68,68 @@ public:
|
|||||||
|
|
||||||
// 'from' is zero|neg_zero.
|
// 'from' is zero|neg_zero.
|
||||||
T x = zero;
|
T x = zero;
|
||||||
T result = func(x, T(1));
|
T result = func(x, one);
|
||||||
StorageType expected_bits = 1;
|
StorageType expected_bits = 1;
|
||||||
T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
result = func(x, T(-1));
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + 1;
|
expected_bits = FPBits::SIGN_MASK + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
x = neg_zero;
|
x = neg_zero;
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected_bits = 1;
|
expected_bits = 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + 1;
|
expected_bits = FPBits::SIGN_MASK + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
// 'from' is max subnormal value.
|
// 'from' is max subnormal value.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_subnormal - 1;
|
expected_bits = max_subnormal - 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + min_normal;
|
expected_bits = FPBits::SIGN_MASK + min_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_subnormal - 1;
|
expected_bits = FPBits::SIGN_MASK + max_subnormal - 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
// 'from' is min subnormal value.
|
// 'from' is min subnormal value.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected_bits = min_subnormal + 1;
|
expected_bits = min_subnormal + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, 0), zero);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, zero), zero);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + min_subnormal + 1;
|
expected_bits = FPBits::SIGN_MASK + min_subnormal + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, 0), T(-0.0));
|
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, zero), neg_zero);
|
||||||
|
|
||||||
// 'from' is min normal.
|
// 'from' is min normal.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_subnormal;
|
expected_bits = max_subnormal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
@ -137,7 +140,7 @@ public:
|
|||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_subnormal;
|
expected_bits = FPBits::SIGN_MASK + max_subnormal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
@ -157,14 +160,14 @@ public:
|
|||||||
|
|
||||||
// 'from' is infinity.
|
// 'from' is infinity.
|
||||||
x = inf;
|
x = inf;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_normal;
|
expected_bits = max_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
ASSERT_FP_EQ(func(x, inf), inf);
|
ASSERT_FP_EQ(func(x, inf), inf);
|
||||||
|
|
||||||
x = neg_inf;
|
x = neg_inf;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_normal;
|
expected_bits = FPBits::SIGN_MASK + max_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
@ -172,7 +175,7 @@ public:
|
|||||||
|
|
||||||
// 'from' is a power of 2.
|
// 'from' is a power of 2.
|
||||||
x = T(32.0);
|
x = T(32.0);
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
FPBits x_bits = FPBits(x);
|
FPBits x_bits = FPBits(x);
|
||||||
FPBits result_bits = FPBits(result);
|
FPBits result_bits = FPBits(result);
|
||||||
ASSERT_EQ(result_bits.get_biased_exponent(),
|
ASSERT_EQ(result_bits.get_biased_exponent(),
|
||||||
@ -187,7 +190,7 @@ public:
|
|||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
result_bits = FPBits(result);
|
result_bits = FPBits(result);
|
||||||
ASSERT_EQ(result_bits.get_biased_exponent(),
|
ASSERT_EQ(result_bits.get_biased_exponent(),
|
||||||
uint16_t(x_bits.get_biased_exponent() - 1));
|
uint16_t(x_bits.get_biased_exponent() - 1));
|
||||||
|
@ -62,8 +62,8 @@ public:
|
|||||||
typedef T (*NextTowardFunc)(T, long double);
|
typedef T (*NextTowardFunc)(T, long double);
|
||||||
|
|
||||||
void testNaN(NextTowardFunc func) {
|
void testNaN(NextTowardFunc func) {
|
||||||
ASSERT_FP_EQ(func(nan, 0), nan);
|
ASSERT_FP_EQ(func(nan, to_zero), nan);
|
||||||
ASSERT_FP_EQ(func(0, to_nan), nan);
|
ASSERT_FP_EQ(func(zero, to_nan), nan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBoundaries(NextTowardFunc func) {
|
void testBoundaries(NextTowardFunc func) {
|
||||||
|
@ -54,15 +54,31 @@ public:
|
|||||||
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 1).uintval(),
|
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 1).uintval(),
|
||||||
FPBits(res).uintval());
|
FPBits(res).uintval());
|
||||||
|
|
||||||
EXPECT_EQ(0, func(&res, T(0x42.0p+0)));
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 6) {
|
||||||
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
EXPECT_EQ(0, func(&res, T(0x31.0p+0)));
|
||||||
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x42).uintval(),
|
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
||||||
FPBits(res).uintval());
|
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x31).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
|
||||||
EXPECT_EQ(0, func(&res, T(0x123.0p+0)));
|
EXPECT_EQ(0, func(&res, T(0x15.0p+0)));
|
||||||
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
||||||
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x123).uintval(),
|
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x15).uintval(),
|
||||||
FPBits(res).uintval());
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 7) {
|
||||||
|
EXPECT_EQ(0, func(&res, T(0x42.0p+0)));
|
||||||
|
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
||||||
|
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x42).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 9) {
|
||||||
|
EXPECT_EQ(0, func(&res, T(0x123.0p+0)));
|
||||||
|
EXPECT_TRUE(FPBits(res).is_signaling_nan());
|
||||||
|
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x123).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
FPBits nan_payload_bits = FPBits::one();
|
FPBits nan_payload_bits = FPBits::one();
|
||||||
nan_payload_bits.set_biased_exponent(FPBits::FRACTION_LEN - 2 +
|
nan_payload_bits.set_biased_exponent(FPBits::FRACTION_LEN - 2 +
|
||||||
|
@ -54,15 +54,31 @@ public:
|
|||||||
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
||||||
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 1).uintval(), FPBits(res).uintval());
|
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 1).uintval(), FPBits(res).uintval());
|
||||||
|
|
||||||
EXPECT_EQ(0, func(&res, T(0x42.0p+0)));
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 6) {
|
||||||
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
EXPECT_EQ(0, func(&res, T(0x31.0p+0)));
|
||||||
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x42).uintval(),
|
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
||||||
FPBits(res).uintval());
|
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x31).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
|
||||||
EXPECT_EQ(0, func(&res, T(0x123.0p+0)));
|
EXPECT_EQ(0, func(&res, T(0x15.0p+0)));
|
||||||
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
||||||
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x123).uintval(),
|
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x15).uintval(),
|
||||||
FPBits(res).uintval());
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 7) {
|
||||||
|
EXPECT_EQ(0, func(&res, T(0x42.0p+0)));
|
||||||
|
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
||||||
|
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x42).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (FPBits::FRACTION_LEN - 1 >= 9) {
|
||||||
|
EXPECT_EQ(0, func(&res, T(0x123.0p+0)));
|
||||||
|
EXPECT_TRUE(FPBits(res).is_quiet_nan());
|
||||||
|
EXPECT_EQ(FPBits::quiet_nan(Sign::POS, 0x123).uintval(),
|
||||||
|
FPBits(res).uintval());
|
||||||
|
}
|
||||||
|
|
||||||
// The following code is creating a NaN payload manually to prevent a
|
// The following code is creating a NaN payload manually to prevent a
|
||||||
// conversion from BigInt to float128.
|
// conversion from BigInt to float128.
|
||||||
|
@ -76,8 +76,8 @@ public:
|
|||||||
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_UPWARD, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_UPWARD, 2U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.32), FP_INT_UPWARD, 4U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.32), FP_INT_UPWARD, 4U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_UPWARD, 4U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_UPWARD, 4U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.38), FP_INT_UPWARD, 7U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.25), FP_INT_UPWARD, 7U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_UPWARD, 7U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_UPWARD, 7U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsUpwardOutsideRange(UfromfpFunc func) {
|
void testFractionsUpwardOutsideRange(UfromfpFunc func) {
|
||||||
@ -120,8 +120,8 @@ public:
|
|||||||
EXPECT_FP_EQ(T(1.0), func(T(1.75), FP_INT_DOWNWARD, 1U));
|
EXPECT_FP_EQ(T(1.0), func(T(1.75), FP_INT_DOWNWARD, 1U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_DOWNWARD, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_DOWNWARD, 4U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 4U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_DOWNWARD, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_DOWNWARD, 7U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.96), FP_INT_DOWNWARD, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.75), FP_INT_DOWNWARD, 7U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsDownwardOutsideRange(UfromfpFunc func) {
|
void testFractionsDownwardOutsideRange(UfromfpFunc func) {
|
||||||
@ -167,8 +167,8 @@ public:
|
|||||||
EXPECT_FP_EQ(T(1.0), func(T(1.75), FP_INT_TOWARDZERO, 1U));
|
EXPECT_FP_EQ(T(1.0), func(T(1.75), FP_INT_TOWARDZERO, 1U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TOWARDZERO, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TOWARDZERO, 4U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 4U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TOWARDZERO, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TOWARDZERO, 7U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.96), FP_INT_TOWARDZERO, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.75), FP_INT_TOWARDZERO, 7U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsTowardZeroOutsideRange(UfromfpFunc func) {
|
void testFractionsTowardZeroOutsideRange(UfromfpFunc func) {
|
||||||
@ -206,8 +206,8 @@ public:
|
|||||||
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_TONEARESTFROMZERO, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_TONEARESTFROMZERO, 2U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TONEARESTFROMZERO, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TONEARESTFROMZERO, 4U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 4U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 4U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TONEARESTFROMZERO, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TONEARESTFROMZERO, 7U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_TONEARESTFROMZERO, 7U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_TONEARESTFROMZERO, 7U));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsToNearestFromZeroOutsideRange(UfromfpFunc func) {
|
void testFractionsToNearestFromZeroOutsideRange(UfromfpFunc func) {
|
||||||
@ -254,8 +254,8 @@ public:
|
|||||||
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_TONEAREST, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(1.75), FP_INT_TONEAREST, 2U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TONEAREST, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.32), FP_INT_TONEAREST, 4U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEAREST, 4U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), FP_INT_TONEAREST, 4U));
|
||||||
EXPECT_FP_EQ(T(123.0), func(T(123.38), FP_INT_TONEAREST, 7U));
|
EXPECT_FP_EQ(T(63.0), func(T(63.25), FP_INT_TONEAREST, 7U));
|
||||||
EXPECT_FP_EQ(T(124.0), func(T(123.96), FP_INT_TONEAREST, 7U));
|
EXPECT_FP_EQ(T(64.0), func(T(63.75), FP_INT_TONEAREST, 7U));
|
||||||
|
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.3), FP_INT_TONEAREST, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.3), FP_INT_TONEAREST, 2U));
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.5), FP_INT_TONEAREST, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.5), FP_INT_TONEAREST, 2U));
|
||||||
@ -332,10 +332,10 @@ public:
|
|||||||
EXPECT_FP_EQ(T(2.0), func(T(1.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(1.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
||||||
EXPECT_FP_EQ(T(10.0), func(T(10.32), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U));
|
EXPECT_FP_EQ(T(10.0), func(T(10.32), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U));
|
||||||
EXPECT_FP_EQ(T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U));
|
EXPECT_FP_EQ(T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U));
|
||||||
EXPECT_FP_EQ(T(123.0),
|
EXPECT_FP_EQ(T(63.0),
|
||||||
func(T(123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U));
|
func(T(63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U));
|
||||||
EXPECT_FP_EQ(T(124.0),
|
EXPECT_FP_EQ(T(64.0),
|
||||||
func(T(123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U));
|
func(T(63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U));
|
||||||
|
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.3), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
||||||
EXPECT_FP_EQ(T(2.0), func(T(2.5), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
EXPECT_FP_EQ(T(2.0), func(T(2.5), UNKNOWN_MATH_ROUNDING_DIRECTION, 2U));
|
||||||
|
@ -87,9 +87,9 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(11.0), func(T(10.65), FP_INT_UPWARD, 4U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(11.0), func(T(10.65), FP_INT_UPWARD, 4U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.38), FP_INT_UPWARD, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.25), FP_INT_UPWARD, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.96), FP_INT_UPWARD, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.75), FP_INT_UPWARD, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +141,9 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 4U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(10.0), func(T(10.65), FP_INT_DOWNWARD, 4U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.38), FP_INT_DOWNWARD, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.25), FP_INT_DOWNWARD, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.96), FP_INT_DOWNWARD, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.75), FP_INT_DOWNWARD, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +202,9 @@ public:
|
|||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 4U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(10.0), func(T(10.65), FP_INT_TOWARDZERO, 4U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), FP_INT_TOWARDZERO, 7U), FE_INEXACT);
|
T(63.0), func(T(63.25), FP_INT_TOWARDZERO, 7U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.96), FP_INT_TOWARDZERO, 7U), FE_INEXACT);
|
T(63.0), func(T(63.75), FP_INT_TOWARDZERO, 7U), FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsTowardZeroOutsideRange(UfromfpxFunc func) {
|
void testFractionsTowardZeroOutsideRange(UfromfpxFunc func) {
|
||||||
@ -252,9 +252,9 @@ public:
|
|||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 4U), FE_INEXACT);
|
T(11.0), func(T(10.65), FP_INT_TONEARESTFROMZERO, 4U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), FP_INT_TONEARESTFROMZERO, 7U), FE_INEXACT);
|
T(63.0), func(T(63.25), FP_INT_TONEARESTFROMZERO, 7U), FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(124.0), func(T(123.96), FP_INT_TONEARESTFROMZERO, 7U), FE_INEXACT);
|
T(64.0), func(T(63.75), FP_INT_TONEARESTFROMZERO, 7U), FE_INEXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFractionsToNearestFromZeroOutsideRange(UfromfpxFunc func) {
|
void testFractionsToNearestFromZeroOutsideRange(UfromfpxFunc func) {
|
||||||
@ -311,9 +311,9 @@ public:
|
|||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(11.0), func(T(10.65), FP_INT_TONEAREST, 4U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(11.0), func(T(10.65), FP_INT_TONEAREST, 4U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(123.0), func(T(123.38), FP_INT_TONEAREST, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(63.0), func(T(63.25), FP_INT_TONEAREST, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(124.0), func(T(123.96), FP_INT_TONEAREST, 7U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(64.0), func(T(63.75), FP_INT_TONEAREST, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
|
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(T(2.0), func(T(2.3), FP_INT_TONEAREST, 2U),
|
EXPECT_FP_EQ_WITH_EXCEPTION(T(2.0), func(T(2.3), FP_INT_TONEAREST, 2U),
|
||||||
@ -414,10 +414,10 @@ public:
|
|||||||
T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U),
|
T(11.0), func(T(10.65), UNKNOWN_MATH_ROUNDING_DIRECTION, 4U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(123.0), func(T(123.38), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U),
|
T(63.0), func(T(63.25), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
T(124.0), func(T(123.96), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U),
|
T(64.0), func(T(63.75), UNKNOWN_MATH_ROUNDING_DIRECTION, 7U),
|
||||||
FE_INEXACT);
|
FE_INEXACT);
|
||||||
|
|
||||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||||
|
14
libc/test/src/math/smoke/fromfpbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/fromfpbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for fromfpbf16 ------------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "FromfpTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/fromfpbf16.h"
|
||||||
|
|
||||||
|
LIST_FROMFP_TESTS(bfloat16, LIBC_NAMESPACE::fromfpbf16)
|
14
libc/test/src/math/smoke/fromfpxbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/fromfpxbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for fromfpxbf16 -----------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "FromfpxTest.h"
|
||||||
|
|
||||||
|
#include "src/math/fromfpxbf16.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
|
||||||
|
LIST_FROMFPX_TESTS(bfloat16, LIBC_NAMESPACE::fromfpxbf16)
|
14
libc/test/src/math/smoke/getpayloadbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/getpayloadbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for getpayloadbf16 --------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "GetPayloadTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/getpayloadbf16.h"
|
||||||
|
|
||||||
|
LIST_GETPAYLOAD_TESTS(bfloat16, LIBC_NAMESPACE::getpayloadbf16)
|
55
libc/test/src/math/smoke/nanbf16_test.cpp
Normal file
55
libc/test/src/math/smoke/nanbf16_test.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
//===-- Unittests for nanbf16 ---------------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "hdr/signal_macros.h"
|
||||||
|
#include "src/__support/FPUtil/FPBits.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nanbf16.h"
|
||||||
|
#include "test/UnitTest/FEnvSafeTest.h"
|
||||||
|
#include "test/UnitTest/FPMatcher.h"
|
||||||
|
#include "test/UnitTest/Test.h"
|
||||||
|
|
||||||
|
class LlvmLibcNanf16Test : public LIBC_NAMESPACE::testing::FEnvSafeTest {
|
||||||
|
public:
|
||||||
|
using StorageType = LIBC_NAMESPACE::fputil::FPBits<bfloat16>::StorageType;
|
||||||
|
|
||||||
|
void run_test(const char *input_str, StorageType bits) {
|
||||||
|
bfloat16 result = LIBC_NAMESPACE::nanbf16(input_str);
|
||||||
|
auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<bfloat16>(result);
|
||||||
|
auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<bfloat16>(bits);
|
||||||
|
EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(LlvmLibcNanf16Test, NCharSeq) {
|
||||||
|
run_test("", 0x7fc0);
|
||||||
|
|
||||||
|
// 0x7fc0 + 0x1f (31) = 0x7cdf
|
||||||
|
run_test("31", 0x7fdf);
|
||||||
|
|
||||||
|
// 0x7fc0 + 0x15 = 0x7fd5
|
||||||
|
run_test("0x15", 0x7fd5);
|
||||||
|
|
||||||
|
run_test("1a", 0x7fc0);
|
||||||
|
run_test("1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_",
|
||||||
|
0x7fc0);
|
||||||
|
run_test("10000000000000000000000000000", 0x7fc0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(LlvmLibcNanf16Test, RandomString) {
|
||||||
|
run_test(" 1234", 0x7fc0);
|
||||||
|
run_test("-1234", 0x7fc0);
|
||||||
|
run_test("asd&f", 0x7fc0);
|
||||||
|
run_test("123 ", 0x7fc0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(LIBC_ADD_NULL_CHECKS)
|
||||||
|
TEST_F(LlvmLibcNanf16Test, InvalidInput) {
|
||||||
|
EXPECT_DEATH([] { LIBC_NAMESPACE::nanbf16(nullptr); }, WITH_SIGNAL(-1));
|
||||||
|
}
|
||||||
|
#endif // LIBC_ADD_NULL_CHECKS
|
14
libc/test/src/math/smoke/nextafterbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextafterbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextafterbf16 ---------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "NextAfterTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextafterbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTAFTER_TESTS(bfloat16, LIBC_NAMESPACE::nextafterbf16)
|
14
libc/test/src/math/smoke/nextdownbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextdownbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextdownbf16 ----------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "NextDownTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextdownbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTDOWN_TESTS(bfloat16, LIBC_NAMESPACE::nextdownbf16)
|
14
libc/test/src/math/smoke/nexttowardbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nexttowardbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nexttowardbf16 --------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "NextTowardTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nexttowardbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTTOWARD_TESTS(bfloat16, LIBC_NAMESPACE::nexttowardbf16)
|
14
libc/test/src/math/smoke/nextupbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextupbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextupbf16 ------------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "NextUpTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextupbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTUP_TESTS(bfloat16, LIBC_NAMESPACE::nextupbf16)
|
14
libc/test/src/math/smoke/setpayloadbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/setpayloadbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for setpayloadbf16 --------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "SetPayloadTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/setpayloadbf16.h"
|
||||||
|
|
||||||
|
LIST_SETPAYLOAD_TESTS(bfloat16, LIBC_NAMESPACE::setpayloadbf16)
|
14
libc/test/src/math/smoke/setpayloadsigbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/setpayloadsigbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for setpayloadsigbf16 -----------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "SetPayloadSigTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/setpayloadsigbf16.h"
|
||||||
|
|
||||||
|
LIST_SETPAYLOADSIG_TESTS(bfloat16, LIBC_NAMESPACE::setpayloadsigbf16)
|
14
libc/test/src/math/smoke/ufromfpbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/ufromfpbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for ufromfpbf16 -----------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "UfromfpTest.h"
|
||||||
|
|
||||||
|
#include "src/math/ufromfpbf16.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
|
||||||
|
LIST_UFROMFP_TESTS(bfloat16, LIBC_NAMESPACE::ufromfpbf16)
|
14
libc/test/src/math/smoke/ufromfpxbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/ufromfpxbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for ufromfpxbf16 ----------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "UfromfpxTest.h"
|
||||||
|
|
||||||
|
#include "src/math/ufromfpxbf16.h"
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
|
||||||
|
LIST_UFROMFPX_TESTS(bfloat16, LIBC_NAMESPACE::ufromfpxbf16)
|
Loading…
x
Reference in New Issue
Block a user