Commit graph

7 commits

Author SHA1 Message Date
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
Graham Sanderson
4242010f11
Misc cleanup (#2569)
* miscellaneous cleanup:

* cleanup some #ifdefs which were slightly hacky when RP2350 was added; use HAS_ flags in preference to PICO_RP2040/RP2350
* make some dependencies more explicit - i.e. compile if the user doesn't want to include certain libraries
* cleanup some directory A -> directory B relative path names in CMakeLists.txt to be SDK root -> directory B
2025-07-18 09:37:21 -05:00
Graham Sanderson
e85c3e5515
rationalize pico_float/pico_double libraries (#2208)
* on RP2350 _dcp variant now enables -msoft-float, since if you're using this at all it is likely because you don't want to use the VFP unit at all (to save stack space)
* implement all float_ and double_ conversion functions in all pico_float_pico_ variants and pico_double_pico on RP2040 and RP2350 (many were missing in some combinations)
* provide better granularity of what functions are wrapped in each case

also marked custom_xxx_funcs_test.c as not in bazel build yet
2025-02-04 16:19:17 -06:00
Luke Wren
d886df6eb0
Add fast single-precision add/sub/mul for Hazard3 (#1883)
* Add fast single-precision add/sub/mul for Hazard3

* Make test output less noisy. Map -nan to -inf in vector gen. Move random vectors to separate files.

* Re-disable USB stdout for pico_float_test by default...

* Disable pico/float.h exports on RISC-V as these functions aren't implemented

* Add hazard3 instructions to asm_helper. Split hazard3.h to support this.

You can still include hazard3.h to get everything. This just allows you
to pull in less.
2024-08-30 11:36:30 -05:00
graham sanderson
efe2103f9b SDK 2.0.0 release 2024-08-08 08:54:38 -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