Skip to content

Commit 9f6b440

Browse files
authored
[libc][math] Implement fast pass for double precision pow function with up to 1ULP error. (#101926)
1 parent 1569e0e commit 9f6b440

File tree

17 files changed

+849
-65
lines changed

17 files changed

+849
-65
lines changed

libc/config/darwin/arm/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ set(TARGET_LIBM_ENTRYPOINTS
227227
libc.src.math.nexttoward
228228
libc.src.math.nexttowardf
229229
libc.src.math.nexttowardl
230+
libc.src.math.pow
230231
libc.src.math.powf
231232
libc.src.math.remainderf
232233
libc.src.math.remainder

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ set(TARGET_LIBM_ENTRYPOINTS
521521
libc.src.math.nextup
522522
libc.src.math.nextupf
523523
libc.src.math.nextupl
524+
libc.src.math.pow
524525
libc.src.math.powf
525526
libc.src.math.remainder
526527
libc.src.math.remainderf

libc/config/linux/arm/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ set(TARGET_LIBM_ENTRYPOINTS
350350
libc.src.math.nextup
351351
libc.src.math.nextupf
352352
libc.src.math.nextupl
353+
libc.src.math.pow
353354
libc.src.math.powf
354355
libc.src.math.remainder
355356
libc.src.math.remainderf

libc/config/linux/riscv/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ set(TARGET_LIBM_ENTRYPOINTS
520520
libc.src.math.nextup
521521
libc.src.math.nextupf
522522
libc.src.math.nextupl
523+
libc.src.math.pow
523524
libc.src.math.powf
524525
libc.src.math.remainder
525526
libc.src.math.remainderf

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ set(TARGET_LIBM_ENTRYPOINTS
520520
libc.src.math.nextup
521521
libc.src.math.nextupf
522522
libc.src.math.nextupl
523+
libc.src.math.pow
523524
libc.src.math.powf
524525
libc.src.math.remainder
525526
libc.src.math.remainderf

libc/config/windows/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ set(TARGET_LIBM_ENTRYPOINTS
240240
libc.src.math.nexttoward
241241
libc.src.math.nexttowardf
242242
libc.src.math.nexttowardl
243+
libc.src.math.pow
243244
libc.src.math.powf
244245
libc.src.math.remainderf
245246
libc.src.math.remainder

libc/docs/math/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Higher Math Functions
320320
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
321321
| logp1 | | | | | | 7.12.6.14 | F.10.3.14 |
322322
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
323-
| pow | |check| | | | | | 7.12.7.5 | F.10.4.5 |
323+
| pow | |check| | 1 ULP | | | | 7.12.7.5 | F.10.4.5 |
324324
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
325325
| powi\* | | | | | | | |
326326
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

libc/src/math/amdgpu/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,6 @@ add_entrypoint_object(
444444
VENDOR
445445
)
446446

447-
add_entrypoint_object(
448-
pow
449-
SRCS
450-
pow.cpp
451-
HDRS
452-
../pow.h
453-
COMPILE_OPTIONS
454-
${bitcode_link_flags}
455-
-O2
456-
VENDOR
457-
)
458-
459447
add_entrypoint_object(
460448
powi
461449
SRCS

libc/src/math/amdgpu/pow.cpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

libc/src/math/generic/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,29 @@ add_entrypoint_object(
15521552
-O3
15531553
)
15541554

1555+
add_entrypoint_object(
1556+
pow
1557+
SRCS
1558+
pow.cpp
1559+
HDRS
1560+
../pow.h
1561+
DEPENDS
1562+
.common_constants
1563+
libc.hdr.errno_macros
1564+
libc.hdr.fenv_macros
1565+
libc.src.__support.CPP.bit
1566+
libc.src.__support.FPUtil.double_double
1567+
libc.src.__support.FPUtil.fenv_impl
1568+
libc.src.__support.FPUtil.fp_bits
1569+
libc.src.__support.FPUtil.multiply_add
1570+
libc.src.__support.FPUtil.nearest_integer
1571+
libc.src.__support.FPUtil.polyeval
1572+
libc.src.__support.FPUtil.sqrt
1573+
libc.src.__support.macros.optimization
1574+
COMPILE_OPTIONS
1575+
-O3
1576+
)
1577+
15551578
add_entrypoint_object(
15561579
copysign
15571580
SRCS

0 commit comments

Comments
 (0)