Commit graph

9 commits

Author SHA1 Message Date
Graham Sanderson
47226c63cf
various floating point fixes (#2849)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
* fix issues with and improve tests for dcp conversions of INFINITES to fixed point values

* improve comments

* fix outstanding todo in __aeabi_dmul via DCP which improves speed/size

* fix missing DCP state saves for float2int, float2uint and float2fix

* slightly improve implementation of saturation of INFINITES

* should not include sf_table.h in double.h

* point out that float/double->fixed/int saturate in the docs

* move some doxygen into RP2350 specific and change include guards ro be RP2350 specific

* more doc tweaks

* fixup check names to be more consistent
2026-03-06 13:48:11 -06:00
Graham Sanderson
9a4766867d
Add support for hard float on M33 via CMake variable PICO_HARD_FLOAT_ABI=1 (#2822)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
* Enable hard-float ABI support for pico_float and pico_double on m33

Resolves #2783

Signed-off-by: Andy Lin <andylinpersonal@gmail.com>

* Add (non google) LLVM support, and replace calling convention check with #if defined(__ARM_PCS_VFP)

* switch float.h to use static inline method for int2float() etc in VFP mode rather than #define

* float/double test cleanup - particularly:

- splitting out executable for each test type for pico_float/double_test
- removing undefined behavior from custom_float_funcs_test.c, to de-confuse clang
- add test of denormal->int

Note some tests still fail on llvm libc (at least version 19)

* fix some issues with newer llvm_libc/compiler as used by bazel build

* keep check_configs happy

* another bazel issue

* introduce pico_double_pico_dcp for consistency

* fixup debug output based on previous commit

* remove unnecessary build guard from double_conv_m33.S

* allow -1 for neg_denormal->int rounding towards minus infinity

* Update test/pico_float_test/CMakeLists.txt

Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>

* Update test/pico_float_test/CMakeLists.txt

Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>

* - add fma/_fast functions to pico_float_test/pico_double_test
- fix guard for TEST_SATURATION in pico_double_test - GCC doesn't clamp either

* - double functions were only wrapped in pico_double_pico not pico_double_pico_dcp explicitly (i.e. explicitly setting double impl to pico_dcp was not selecting our versions)

* avoid extra stack alignment push (per review comment)

* fix fma return code in VFP mode (register transfer was the wrong way around)

* separate PCS=VFP and non-PCS-VFP versions of fma_fast

* remove saving_func_return (which is just bx lr) and fold the separate pop of lr, into a pop of pc

* better fix for wrapping right libraries

* rename some labels from _entry (which is an internal entry point) to _softfp to be clear that these are the function entry points which work with softfp calling conventions

* Make bazel pico_float build not wrap SCI functions on RISC-V to match CMake build

* Split out FMAF as a selectable wrapped item since we don't want to wrap it for VFP

* fix typos

* fix test

---------

Signed-off-by: Andy Lin <andylinpersonal@gmail.com>
Co-authored-by: Andy Lin <andylinpersonal@gmail.com>
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
2026-03-04 10:22:27 -06:00
Andrew Scheller
7d5d9276a8
Workaround gcc/newlib issue on Ubuntu 24 (#1863) 2024-08-23 10:59:36 -05:00
graham sanderson
efe2103f9b SDK 2.0.0 release 2024-08-08 08:54:38 -05:00
Graham Sanderson
7f7232541a
switch all .S files to unified asm, and use a macro to setup compiler and some other misc changes (#1295)
* switch all .S files to unified asm, and use a new macro `pico_default_asm_setup` to setup compiler to help porting to other compilers. Also some minor tweaks:
* switch some code to use more recent helper methods (e.g. busy_wait_at_least_n_cycles)
* add documentation to host divider header (I had this ages ago and never promoted)
* fixup erroneous docs about 32p32 values in all divider headers
* fix some compiler warnings
* rename recently added `unified_asm` macro to `pico_default_asm`
2023-03-09 17:40:20 -06:00
Graham Sanderson
1ac90374e3
Various small fixes towards building with other compilers (#1285)
* Fix various non-GCC warnings (no effect on GCC)
* Reduce use of typeof since non GCC compilers may not support it
* Introduce PICO_C_COMPILER_IS_GNU, PICO_C_COMPILER_IS_CLANG, PICO_C_COMPILER_IS_IAR to CMake as if (CMAKE_C_COMPILER_ID STREQUAL "xxx") is a bit verbose
* Use "unified_asm" macro for all inline asm (it is "volatile __asm" on GNU with a .syntex unified)
* Use NOLOAD instead of COPY in linker scripts (arguably more correct anyway)
* Use the same style for setting _etext in all 4 linker scripts (to the beginning of .data). Clang aligns .data on a 16 byte boundary. Note ideally we'd
  add a new symbol __data_source, however that would break backwards compatibility with existing user linker scripts
* Use "a" for .stack, .heap sections because clang complains otherwise, and they are explicitly NOLOAD anyway
* Avoid duplicating __sev, __wfe, __wfi which Clang sometimes seems to provide as built-ins
* Add missing kitchen_sink_blocked_ram binary
* Allow build with LLVM Embedded Toolchain Form ARM v 14.0.0 (unsupported atm)
2023-03-01 15:10:18 -06:00
Graham Sanderson
9c616da1e5
fix bug in pico_float_test (#817) 2022-05-10 12:58:55 -05:00
Graham Sanderson
574fdee37b
Fixup divider save_restore for floating point too; improve tests (#405)
- The divider state needs to be saved for __aeabi_ddiv, __aeabi_fdiv, __aeabi_dtan and __aeabi_ftan or they won't work in interrupts *(probably not used much youd hope), or on an RTOS context switch
 - Refactored code out for the integer and floating point cases
 - Improved the floating point 'tests' in passing to check more return values against GCC implementations
 - Added floating point usage to the IRQ nesting test case
2021-05-13 07:38:42 -05:00
graham sanderson
26653ea81e Initial Release 2021-01-20 10:44:27 -06:00