[libc-commits] [libc] [libc] Enable the FPU in Arm startup code (PR #166349)

Simon Tatham via libc-commits libc-commits at lists.llvm.org
Wed Nov 5 06:38:50 PST 2025


================
@@ -131,6 +131,28 @@ namespace LIBC_NAMESPACE_DECL {
   __arm_wsr("CPSR_c", 0x13); // SVC
 #endif
 
+#ifdef __ARM_FP
+// Enable FPU
+#if __ARM_ARCH_PROFILE == 'M'
+  // Set CPACR cp10 and cp11
+  auto cpacr = (volatile uint32_t *const)0xE000ED88;
+  *cpacr |= (0xF << 20);
+  __dsb(0xF);
----------------
statham-arm wrote:

All of this makes sense to me except that I'm not sure why this `__dsb` is here and not in the A/R branch. I didn't see any ArmARM documentation that mentioned it. Is it deliberately M-only?

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


More information about the libc-commits mailing list