Apple M4 Support Added To The LLVM Compiler, Confirming Its ISA Capabilities
([LLVM] 6 Hours Ago
Apple M4)
- Reference: 0001470926
- News link: https://www.phoronix.com/news/Apple-M4-Added-To-LLVM-Clang
- Source link:
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:
"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.
[1]
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 [2]this patch to the LLVM Clang 19 codebase on Friday night. The [3]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.
[1] https://www.phoronix.com/image-viewer.php?id=2024&image=llvm_apple_m4_lrg
[2] https://github.com/llvm/llvm-project/commit/2b33591386e855cf82a4104092e1a1d2888f32b1
[3] https://www.phoronix.com/news/Apple-Announces-M4
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.
[1]
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 [2]this patch to the LLVM Clang 19 codebase on Friday night. The [3]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.
[1] https://www.phoronix.com/image-viewer.php?id=2024&image=llvm_apple_m4_lrg
[2] https://github.com/llvm/llvm-project/commit/2b33591386e855cf82a4104092e1a1d2888f32b1
[3] https://www.phoronix.com/news/Apple-Announces-M4
SteamPunker