[libc-commits] [libc] [libc] Add support for MVE to Arm startup code (PR #167338)

via libc-commits libc-commits at lists.llvm.org
Tue Nov 11 07:08:37 PST 2025


================
@@ -131,20 +131,23 @@ namespace LIBC_NAMESPACE_DECL {
   __arm_wsr("CPSR_c", 0x13); // SVC
 #endif
 
-#ifdef __ARM_FP
-// Enable FPU
-#if __ARM_ARCH_PROFILE == 'M'
+#if __ARM_ARCH_PROFILE == 'M' &&                                               \
+    (defined(__ARM_FP) || defined(__ARM_FEATURE_MVE))
+  // Enable FPU and MVE. They can't be enabled independently: the two are
+  // governed by the same bits in CPACR.
   // Based on
   // https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/Floating-Point-Unit/Enabling-the-FPU
-  // Set CPACR cp10 and cp11
+  // Set CPACR cp10 and cp11.
   auto cpacr = (volatile uint32_t *const)0xE000ED88;
----------------
lntue wrote:

nit: Do you mind changing this to a C++ `reinterpret_cast`?

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


More information about the libc-commits mailing list