Skip to content

Commit

Permalink
[libc][math] Implement fast pass for double precision pow function wi…
Browse files Browse the repository at this point in the history
…th up to 1ULP error. (#101926)
  • Loading branch information
lntue authored Aug 5, 2024
1 parent 1569e0e commit 9f6b440
Show file tree
Hide file tree
Showing 17 changed files with 849 additions and 65 deletions.
1 change: 1 addition & 0 deletions libc/config/darwin/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nexttoward
libc.src.math.nexttowardf
libc.src.math.nexttowardl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainderf
libc.src.math.remainder
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nextup
libc.src.math.nextupf
libc.src.math.nextupl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainder
libc.src.math.remainderf
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nextup
libc.src.math.nextupf
libc.src.math.nextupl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainder
libc.src.math.remainderf
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nextup
libc.src.math.nextupf
libc.src.math.nextupl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainder
libc.src.math.remainderf
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nextup
libc.src.math.nextupf
libc.src.math.nextupl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainder
libc.src.math.remainderf
Expand Down
1 change: 1 addition & 0 deletions libc/config/windows/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.nexttoward
libc.src.math.nexttowardf
libc.src.math.nexttowardl
libc.src.math.pow
libc.src.math.powf
libc.src.math.remainderf
libc.src.math.remainder
Expand Down
2 changes: 1 addition & 1 deletion libc/docs/math/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Higher Math Functions
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| logp1 | | | | | | 7.12.6.14 | F.10.3.14 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| pow | |check| | | | | | 7.12.7.5 | F.10.4.5 |
| pow | |check| | 1 ULP | | | | 7.12.7.5 | F.10.4.5 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| powi\* | | | | | | | |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
Expand Down
12 changes: 0 additions & 12 deletions libc/src/math/amdgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,6 @@ add_entrypoint_object(
VENDOR
)

add_entrypoint_object(
pow
SRCS
pow.cpp
HDRS
../pow.h
COMPILE_OPTIONS
${bitcode_link_flags}
-O2
VENDOR
)

add_entrypoint_object(
powi
SRCS
Expand Down
21 changes: 0 additions & 21 deletions libc/src/math/amdgpu/pow.cpp

This file was deleted.

23 changes: 23 additions & 0 deletions libc/src/math/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,29 @@ add_entrypoint_object(
-O3
)

add_entrypoint_object(
pow
SRCS
pow.cpp
HDRS
../pow.h
DEPENDS
.common_constants
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.CPP.bit
libc.src.__support.FPUtil.double_double
libc.src.__support.FPUtil.fenv_impl
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.multiply_add
libc.src.__support.FPUtil.nearest_integer
libc.src.__support.FPUtil.polyeval
libc.src.__support.FPUtil.sqrt
libc.src.__support.macros.optimization
COMPILE_OPTIONS
-O3
)

add_entrypoint_object(
copysign
SRCS
Expand Down
Loading

0 comments on commit 9f6b440

Please sign in to comment.