Skip to content

[libc][math][c23] Enable _Float16 entrypoints on 32-bit Arm and on RISC-V #109700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions libc/config/linux/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,84 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ufromfpxl
)

if(LIBC_TYPES_HAS_FLOAT16)
list(APPEND TARGET_LIBM_ENTRYPOINTS
# math.h C23 _Float16 entrypoints
libc.src.math.canonicalizef16
libc.src.math.ceilf16
libc.src.math.copysignf16
libc.src.math.exp10f16
libc.src.math.exp2f16
libc.src.math.expf16
libc.src.math.expm1f16
libc.src.math.f16add
libc.src.math.f16addf
libc.src.math.f16addl
libc.src.math.f16div
libc.src.math.f16divf
libc.src.math.f16divl
libc.src.math.f16fma
libc.src.math.f16fmaf
libc.src.math.f16fmal
libc.src.math.f16mul
libc.src.math.f16mulf
libc.src.math.f16mull
libc.src.math.f16sqrt
libc.src.math.f16sqrtf
libc.src.math.f16sqrtl
libc.src.math.f16sub
libc.src.math.f16subf
libc.src.math.f16subl
libc.src.math.fabsf16
libc.src.math.fdimf16
libc.src.math.floorf16
libc.src.math.fmaxf16
libc.src.math.fmaximum_mag_numf16
libc.src.math.fmaximum_magf16
libc.src.math.fmaximum_numf16
libc.src.math.fmaximumf16
libc.src.math.fminf16
libc.src.math.fminimum_mag_numf16
libc.src.math.fminimum_magf16
libc.src.math.fminimum_numf16
libc.src.math.fminimumf16
libc.src.math.fmodf16
libc.src.math.frexpf16
libc.src.math.fromfpf16
libc.src.math.fromfpxf16
libc.src.math.getpayloadf16
libc.src.math.ilogbf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
libc.src.math.llrintf16
libc.src.math.llroundf16
libc.src.math.logbf16
libc.src.math.lrintf16
libc.src.math.lroundf16
libc.src.math.modff16
libc.src.math.nanf16
libc.src.math.nearbyintf16
libc.src.math.nextafterf16
libc.src.math.nextdownf16
libc.src.math.nexttowardf16
libc.src.math.nextupf16
libc.src.math.remainderf16
libc.src.math.remquof16
libc.src.math.rintf16
libc.src.math.roundevenf16
libc.src.math.roundf16
libc.src.math.scalblnf16
libc.src.math.scalbnf16
libc.src.math.setpayloadf16
libc.src.math.setpayloadsigf16
libc.src.math.totalorderf16
libc.src.math.totalordermagf16
libc.src.math.truncf16
libc.src.math.ufromfpf16
libc.src.math.ufromfpxf16
)
endif()

set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
Expand Down
90 changes: 90 additions & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,96 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ufromfpxl
)

if(LIBC_TYPES_HAS_FLOAT16)
list(APPEND TARGET_LIBM_ENTRYPOINTS
# math.h C23 _Float16 entrypoints
libc.src.math.canonicalizef16
libc.src.math.ceilf16
libc.src.math.copysignf16
libc.src.math.exp10f16
libc.src.math.exp2f16
libc.src.math.expf16
libc.src.math.expm1f16
libc.src.math.f16add
libc.src.math.f16addf
libc.src.math.f16addl
libc.src.math.f16div
libc.src.math.f16divf
libc.src.math.f16divl
libc.src.math.f16fma
libc.src.math.f16fmaf
libc.src.math.f16fmal
libc.src.math.f16mul
libc.src.math.f16mulf
libc.src.math.f16mull
libc.src.math.f16sqrt
libc.src.math.f16sqrtf
libc.src.math.f16sqrtl
libc.src.math.f16sub
libc.src.math.f16subf
libc.src.math.f16subl
libc.src.math.fabsf16
libc.src.math.fdimf16
libc.src.math.floorf16
libc.src.math.fmaxf16
libc.src.math.fmaximum_mag_numf16
libc.src.math.fmaximum_magf16
libc.src.math.fmaximum_numf16
libc.src.math.fmaximumf16
libc.src.math.fminf16
libc.src.math.fminimum_mag_numf16
libc.src.math.fminimum_magf16
libc.src.math.fminimum_numf16
libc.src.math.fminimumf16
libc.src.math.fmodf16
libc.src.math.frexpf16
libc.src.math.fromfpf16
libc.src.math.fromfpxf16
libc.src.math.getpayloadf16
libc.src.math.ilogbf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
libc.src.math.llrintf16
libc.src.math.llroundf16
libc.src.math.logbf16
libc.src.math.lrintf16
libc.src.math.lroundf16
libc.src.math.modff16
libc.src.math.nanf16
libc.src.math.nearbyintf16
libc.src.math.nextafterf16
libc.src.math.nextdownf16
libc.src.math.nexttowardf16
libc.src.math.nextupf16
libc.src.math.remainderf16
libc.src.math.remquof16
libc.src.math.rintf16
libc.src.math.roundevenf16
libc.src.math.roundf16
libc.src.math.scalblnf16
libc.src.math.scalbnf16
libc.src.math.setpayloadf16
libc.src.math.setpayloadsigf16
libc.src.math.totalorderf16
libc.src.math.totalordermagf16
libc.src.math.truncf16
libc.src.math.ufromfpf16
libc.src.math.ufromfpxf16
)

if(LIBC_TYPES_HAS_FLOAT128)
list(APPEND TARGET_LIBM_ENTRYPOINTS
# math.h C23 mixed _Float16 and _Float128 entrypoints
Copy link
Member

Choose a reason for hiding this comment

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

Are you going to add these for arm, too?

Copy link
Contributor

Choose a reason for hiding this comment

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

arm fp16 is facing some clang compiler problems as I remember.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a comment w/ a TODO linking to the issue on file would be appropriate then.

Copy link
Member Author

Choose a reason for hiding this comment

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

_Float128 is not supported on 32-bit Arm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do they have sth similar to force-enable-int128

Copy link
Member

Choose a reason for hiding this comment

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

_Float128 is not supported on 32-bit Arm.

Filed ARM-software/abi-aa#287 for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do they have sth similar to force-enable-int128

Clang doesn't have one, and GCC doesn't seem to either.

libc.src.math.f16addf128
libc.src.math.f16divf128
libc.src.math.f16fmaf128
libc.src.math.f16mulf128
libc.src.math.f16sqrtf128
libc.src.math.f16subf128
)
endif()
endif()

if(LIBC_TYPES_HAS_FLOAT128)
list(APPEND TARGET_LIBM_ENTRYPOINTS
# math.h C23 _Float128 entrypoints
Expand Down
1 change: 0 additions & 1 deletion libc/include/llvm-libc-macros/float16-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#if defined(__FLT16_MANT_DIG__) && \
(!defined(__GNUC__) || __GNUC__ >= 13 || defined(__clang__)) && \
!defined(__arm__) && !defined(_M_ARM) && !defined(__riscv) && \
!defined(_WIN32)
#define LIBC_TYPES_HAS_FLOAT16

Expand Down
Loading