[compiler-rt] [compiler-rt][ARM] Optimized mulsf3 and divsf3 (PR #161546)

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 08:03:31 PDT 2025


================
@@ -422,6 +422,24 @@ set(arm_or_thumb2_base_SOURCES
   ${GENERIC_SOURCES}
 )
 
+option(COMPILER_RT_ARM_OPTIMIZED_FP
+  "On 32-bit Arm, use optimized assembly implementations of FP arithmetic. Likely to increase code size, but be faster." ON)
+
+if(COMPILER_RT_ARM_OPTIMIZED_FP)
+  set(assembly_files
+    arm/mulsf3.S
+    arm/divsf3.S)
+  set_source_files_properties(${assembly_files}
+    PROPERTIES COMPILE_OPTIONS "-Wa,-mimplicit-it=always")
----------------
statham-arm wrote:

I was delayed getting back to this, sorry. But I think the answer to this is that if you're trying to build the Arm assembler builtins with bare GNU `as`, you're doomed anyway.

The most immediate problem, when I tried it just now, was that invocations of `as` would fail with error messages of the form "Fatal error: bad defsym; format is --defsym name=value". That arises because cmake has put things like `--defsym VISIBILITY_HIDDEN` and `--defsym _LARGEFILE_SOURCE` on the as command line, which indeed violates the syntax of `--defsym`, which requires an explicit value in every definition.

But worse, those `--defsym` symbols are clearly the ones that would have been used with `-D` if cmake had thought it was using a compiler driver as its assembler. So it's expecting them to turn into macros that can be tested using `#ifdef`. And even if there hadn't been a command-line syntax error, that won't work – `--defsym` and `-D` don't mean the same thing, and in any case, bare `as` doesn't run cpp at all, so the `#ifdef`s in the source files will be syntax errors regardless of what was defined on the command line. Not to mention the `#include`s.

This is all true of the _existing_ assembly language source files in `lib/builtins`, not just my new ones. I think there's no hope of getting any of them to build with any kind of bare assembler like `as` or `llvm-mc`; they _need_ a compiler driver which supports `-D` and will run the preprocessor.

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


More information about the llvm-commits mailing list