Skip to content

Commit 1022929

Browse files
ViralBShahclaude
andcommitted
riscv: allow single-precision float ABI (lp64f / ilp32f)
The header rejected __riscv_float_abi_single with an #error, but the F and D extensions share the same FCSR. The hard-float inline implementations below the guard use only csrr/csrw/csrc on fcsr and fflags, both of which are present whenever F is present. So lp64f / ilp32f can use the same code path as the double ABI. Closes #262. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3329022 commit 1022929

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

include/openlibm_fenv_riscv.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,10 @@ __BEGIN_DECLS
7474
extern const fenv_t __fe_dfl_env;
7575
#define FE_DFL_ENV (&__fe_dfl_env)
7676

77-
#if !defined(__riscv_float_abi_soft) && !defined(__riscv_float_abi_double)
78-
#if defined(__riscv_float_abi_single)
79-
#error single precision floating point ABI not supported
80-
#else
77+
#if !defined(__riscv_float_abi_soft) && !defined(__riscv_float_abi_double) && \
78+
!defined(__riscv_float_abi_single)
8179
#error compiler did not set soft/hard float macros
8280
#endif
83-
#endif
8481

8582
#ifndef __riscv_float_abi_soft
8683
#define __rfs(__fcsr) __asm __volatile("csrr %0, fcsr" : "=r" (__fcsr))

0 commit comments

Comments
 (0)