Apple M4 Support Added To The LLVM Compiler, Confirming Its ISA Capabilities
Apple compiler engineers have contributed Apple M4 CPU support to the upstream LLVM/Clang compiler via the new -mcpu=apple-m4 target. Interestingly the Apple M4 is exposed as an ARMv8.7 derived design.
In recent weeks there's been much speculation around the M4's ISA capabilities and this suspected to be Apple's first SoC relying on the ARMv9 architecture with some suggesting even ARMv9.4. So seeing the Apple-contributed compiler support for LLVM adding the M4 as an "ARMv8.7" based design was coming as a surprise. But in digging through the patch there is this code comment that explains the situation:
So there you have it straight from Apple... The Apple M4 is an ARMv9.2a based design. However, it lacks SVE (and SVE2) support. There were rumors that the Apple M4 supported Scalable Vector Extensions but now again by this Apple code comment and the associated ISA being exposed by the LLVM compiler, SVE/SVE2 is not present for the Apple M4.
Extensions atop ARMv8.7a exposed are AES, SHA2, SHA3, FP16, FP16FML, SME, SME2, SMEF64F64, and AEK_SMEI16I64.
The Apple M4 support with -mcpu=apple-m4 was merged as part of this patch to the LLVM Clang 19 codebase on Friday night. The Apple M4 was announced back in May and initially found with Apple's new iPad Pro hardware while with time should be found in more devices.
In recent weeks there's been much speculation around the M4's ISA capabilities and this suspected to be Apple's first SoC relying on the ARMv9 architecture with some suggesting even ARMv9.4. So seeing the Apple-contributed compiler support for LLVM adding the M4 as an "ARMv8.7" based design was coming as a surprise. But in digging through the patch there is this code comment that explains the situation:
"Technically apple-m4 is ARMv9.2a, but a quirk of LLVM defines v9.0 as requiring SVE, which is optional according to the Arm ARM and not supported by the core. ARMv8.7a is the next closest choice."
So there you have it straight from Apple... The Apple M4 is an ARMv9.2a based design. However, it lacks SVE (and SVE2) support. There were rumors that the Apple M4 supported Scalable Vector Extensions but now again by this Apple code comment and the associated ISA being exposed by the LLVM compiler, SVE/SVE2 is not present for the Apple M4.
Extensions atop ARMv8.7a exposed are AES, SHA2, SHA3, FP16, FP16FML, SME, SME2, SMEF64F64, and AEK_SMEI16I64.
The Apple M4 support with -mcpu=apple-m4 was merged as part of this patch to the LLVM Clang 19 codebase on Friday night. The Apple M4 was announced back in May and initially found with Apple's new iPad Pro hardware while with time should be found in more devices.
22 Comments