[llvm] [AArch64] Improve host feature detection. (PR #160410)

Daniel Paoliello via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 09:02:42 PDT 2025


dpaoliello wrote:

Before the patch:

```
> .\build\bin\clang.exe -mcpu=native -print-enabled-extensions
clang version 22.0.0git (https://github.com/dpaoliello/llvm-project.git d136fbdf8cf626a446cc53345810d3f59b7e433c)
Target: aarch64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\repos\llvm\build\bin
Build config: +assertions
Extensions enabled for the given AArch64 target

    Architecture Feature(s)                                Description
    FEAT_AES, FEAT_PMULL                                   Enable AES support
    FEAT_AMUv1                                             Enable Armv8.4-A Activity Monitors extension
    FEAT_AMUv1p1                                           Enable Armv8.6-A Activity Monitors Virtualization support
    FEAT_AdvSIMD                                           Enable Advanced SIMD instructions
    FEAT_BF16                                              Enable BFloat16 Extension
    FEAT_BTI                                               Enable Branch Target Identification
    FEAT_CCIDX                                             Enable Armv8.3-A Extend of the CCSIDR number of sets
    FEAT_CRC32                                             Enable Armv8.0-A CRC-32 checksum instructions
    FEAT_CSV2_2                                            Enable architectural speculation restriction
    FEAT_DIT                                               Enable Armv8.4-A Data Independent Timing instructions
    FEAT_DPB                                               Enable Armv8.2-A data Cache Clean to Point of Persistence
    FEAT_DPB2                                              Enable Armv8.5-A Cache Clean to Point of Deep Persistence
    FEAT_DotProd                                           Enable dot product support
    FEAT_ECV                                               Enable enhanced counter virtualization extension
    FEAT_FCMA                                              Enable Armv8.3-A Floating-point complex number support
    FEAT_FGT                                               Enable fine grained virtualization traps extension
    FEAT_FHM                                               Enable FP16 FML instructions
    FEAT_FP                                                Enable Armv8.0-A Floating Point Extensions
    FEAT_FP16                                              Enable half-precision floating-point data processing
    FEAT_FRINTTS                                           Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int
    FEAT_FlagM                                             Enable Armv8.4-A Flag Manipulation instructions
    FEAT_FlagM2                                            Enable alternative NZCV format for floating point comparisons
    FEAT_I8MM                                              Enable Matrix Multiply Int8 Extension
    FEAT_JSCVT                                             Enable Armv8.3-A JavaScript FP conversion instructions
    FEAT_LOR                                               Enable Armv8.1-A Limited Ordering Regions extension
    FEAT_LRCPC                                             Enable support for RCPC extension
    FEAT_LRCPC2                                            Enable Armv8.4-A RCPC instructions with Immediate Offsets
    FEAT_LSE                                               Enable Armv8.1-A Large System Extension (LSE) atomic instructions
    FEAT_LSE2                                              Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules
    FEAT_MPAM                                              Enable Armv8.4-A Memory system Partitioning and Monitoring extension
    FEAT_NV, FEAT_NV2                                      Enable Armv8.4-A Nested Virtualization Enchancement
    FEAT_PAN                                               Enable Armv8.1-A Privileged Access-Never extension
    FEAT_PAN2                                              Enable Armv8.2-A PAN s1e1R and s1e1W Variants
    FEAT_PAuth                                             Enable Armv8.3-A Pointer Authentication extension
    FEAT_PMUv3                                             Enable Armv8.0-A PMUv3 Performance Monitors extension
    FEAT_RAS, FEAT_RASv1p1                                 Enable Armv8.0-A Reliability, Availability and Serviceability Extensions
    FEAT_RDM                                               Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions
    FEAT_RNG                                               Enable Random Number generation instructions
    FEAT_SB                                                Enable Armv8.5-A Speculation Barrier
    FEAT_SEL2                                              Enable Armv8.4-A Secure Exception Level 2 extension
    FEAT_SHA1, FEAT_SHA256                                 Enable SHA1 and SHA256 support
    FEAT_SHA3, FEAT_SHA512                                 Enable SHA512 and SHA3 support
    FEAT_SM4, FEAT_SM3                                     Enable SM3 and SM4 support
    FEAT_SPE                                               Enable Statistical Profiling extension
    FEAT_SPECRES                                           Enable Armv8.5-A execution and data prediction invalidation instructions
    FEAT_SSBS, FEAT_SSBS2                                  Enable Speculative Store Bypass Safe bit
    FEAT_TLBIOS, FEAT_TLBIRANGE                            Enable Armv8.4-A TLB Range and Maintenance instructions
    FEAT_TRF                                               Enable Armv8.4-A Trace extension
    FEAT_UAO                                               Enable Armv8.2-A UAO PState
    FEAT_VHE                                               Enable Armv8.1-A Virtual Host extension

> .\build\bin\clang.exe -mcpu=native -### empty.c -c -nostdinc
clang version 22.0.0git (https://github.com/dpaoliello/llvm-project.git d136fbdf8cf626a446cc53345810d3f59b7e433c)
Target: aarch64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\repos\llvm\build\bin
Build config: +assertions
 (in-process)
 "C:\\repos\\llvm\\build\\bin\\clang.exe" "-cc1" "-triple" "aarch64-pc-windows-msvc19.44.35213" "-emit-obj" "-mincremental-linker-compatible" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "empty.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=reserved" "-relaxed-aliasing" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-enable-tlsdesc" "-target-cpu" "oryon-1" "-target-feature" "+v8.6a" "-target-feature" "+aes" "-target-feature" "+bf16" "-target-feature" "+ccidx" "-target-feature" "+complxnum" "-target-feature" "+crc" "-target-feature" "+dotprod" "-target-feature" "+fp-armv8" "-target-feature" "+i8mm" "-target-feature" "+jsconv" "-target-feature" "+lse" "-target-feature" "+neon" "-target-feature" "+pauth" "-target-feature" "+perfmon" "-target-feature" "+rand" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+sha3" "-target-feature" "+sm4" "-target-feature" "+spe" "-target-feature" "+ssbs" "-target-abi" "aapcs" "-fdebug-compilation-dir=C:\\repos\\llvm" "-fcoverage-compilation-dir=C:\\repos\\llvm" "-nostdsysteminc" "-nobuiltininc" "-resource-dir" "C:\\repos\\llvm\\build\\lib\\clang\\22" "-ferror-limit" "19" "-fmessage-length=120" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.44.35213" "-fskip-odr-check-in-gmf" "-fdelayed-template-parsing" "-fcolor-diagnostics" "-target-feature" "-fmv" "-faddrsig" "-o" "empty.o" "-x" "c" "empty.c"
```

Looks like the patch adds the following target feature args:
```
-sve-sm4
-sve2
-sve-sha3
-sve
+jscvt
-f32mm
-sve-aes
-f64mm
```

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


More information about the llvm-commits mailing list