[libc-commits] [libc] [libc][math] Fix arm-linux-gnueabihf target when building with gcc/g++. (PR #202090)

Simon Tatham via libc-commits libc-commits at lists.llvm.org
Mon Jun 8 02:33:09 PDT 2026


================
@@ -26,15 +26,15 @@ namespace fputil {
 #ifdef LIBC_TARGET_CPU_HAS_FPU_FLOAT
 template <> LIBC_INLINE float sqrt<float>(float x) {
   float y;
-  asm("vsqrt %0, %1\n\t" : "=w"(y) : "w"(x));
+  asm("vsqrt.f32 %0, %1\n\t" : "=w"(y) : "w"(x));
   return y;
 }
 #endif // LIBC_TARGET_CPU_HAS_FPU_FLOAT
 
 #ifdef LIBC_TARGET_CPU_HAS_FPU_DOUBLE
 template <> LIBC_INLINE double sqrt<double>(double x) {
   double y;
-  asm("vsqrt %0, %1\n\t" : "=w"(y) : "w"(x));
+  asm("vsqrt.f64 %P0, %P1\n\t" : "=w"(y) : "w"(x));
----------------
statham-arm wrote:

I know this is already landed, but I'm curious: what was the purpose of adding the `P` modifier here? As far as I can see, it makes no difference at all. (It lowers to the corresponding `P` modifier in IR, which LangRef documents for ARM as "P: No effect.")

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


More information about the libc-commits mailing list