[compiler-rt] compiler-rt/arm: Check for overflow when adding float denorms (PR #185245)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 09:03:47 PDT 2026


smithp35 wrote:

> > Getting the tests to run on an Arm machine in soft-float may be a bit of a faff. It needs compiler-rt built with tests enabled and a way of executing the tests. I expect that running qemu user mode arm emulation with a sysroot from the soft-float arm-linux-gnueabi toolchain would work.
> 
> A whole sysroot seems a bit excessive to me; the sample program included in the PR was built against picolibc which provides enough support without any external components.
> 
In terms of what would need to be added to upstream llvm, it would just be one file similar to https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/builtins/Unit/mulsf3_test.c but likely with only one test case derived from your example.

It the majority of architectures this would test the C implementation if the compiler-rt tests were enabled. It would be up to the person cross-compiling the tests to provide a means to run the test using the Arm assembly version.

I mention a sysroot as it was the easiest way I could think of to run the Arm soft float tests via the compiler CMake test infrastructure. It is likely not the only way, if you can get it running via picolibc and CMake then that's fine.

It seems like finding an arm-none-linux-gnueabi soft-float toolchain + sysroot is harder than I thought. Best I can find is https://developer.arm.com/Downloads/-/Legacy%20Linaro%20GNU%20Toolchains  which has some soft-float toolchains and sysroots that can be used.

> > Some years ago I wrote that up in https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html although I am not sure how up to date that is with a more modern compiler-rt
> 
> Yeah, I think that could be made to work if an arm32 Linux image were hanging around. Would it be reasonable to run them against picolibc instead? A lot fewer dependencies; binary versions are available in several places.

The sysroot method is the only one I've tried myself. At the time (2017 or so) there wasn't a functional bare-metal driver, in clang which made getting tests building and running in qemu-system-arm quite difficult.

https://github.com/llvm/llvm-project/pull/185245


More information about the llvm-commits mailing list