clang

How to know all supported values for clang -march argument?


Using Clang 16.0 or later, I would like to know what values could be used for the -march argument.

The command clang --print-supported-cpus shows for -mcpu=, but I see no alternative for -march.

I could check the LLVM code as well, but I want to know only related to my pre-built version of Clang.

What command could I use to obtain such information?


Solution

  • On clang v18 and newer, there is now --print-supported-extensions flag -

    Docs: https://releases.llvm.org/18.1.8/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-print-supported-extensions

    $ clang --print-targets
    
      Registered Targets:
        aarch64     - AArch64 (little endian)
        aarch64_32  - AArch64 (little endian ILP32)
        aarch64_be  - AArch64 (big endian)
    
    ...
    
    $ clang --target=aarch64 --print-supported-extensions
    
    Homebrew clang version 19.1.7
    Target: aarch64
    Thread model: posix
    InstalledDir: /opt/homebrew/Cellar/llvm/19.1.7_1/bin
    All available -march extensions for AArch64
    
        Name                Architecture Feature(s)                                Description
        aes                 FEAT_AES, FEAT_PMULL                                   Enable AES support
        b16b16              FEAT_SVE_B16B16                                        Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions
        bf16                FEAT_BF16                                              Enable BFloat16 Extension
    
    ...