You can pass -DLLVM_TARGETS_TO_BUILD=X86 to the initial cmake invocation.

Answer from Ismail Badawi on Stack Overflow
🌐
Google Groups
groups.google.com › g › llvm-dev › c › 5qSTO3VUUe4
[llvm-dev] LLVM_TARGETS_TO_BUILD
c:\cmake-3.8.0-rc1-win64-x64\bin\cmake.exe -DLLVM_TARGETS_TO_BUILD=x86_64 -G "Visual Studio 14" -A Win64
🌐
LLVM
llvm.org › docs › CMake.html
Building LLVM with CMake — LLVM 23.0.0git documentation
You can also specify host or Native to automatically detect and include the target corresponding to the host machine’s architecture, or use all to include all available targets. For example, on an x86_64 machine, specifying -DLLVM_TARGETS_TO_BUILD=host will include the X86 target.
Discussions

compilation - How to compile LLVM with a specific target - Stack Overflow
For some reason the compile speed of LLVM is extremely slow on my Mac, and based on my observation most of the time is spend on compiling the different target in llvm/lib/Target. However, the only More on stackoverflow.com
🌐 stackoverflow.com
Help with Values of LLVM_TARGETS_TO_BUILD
which one does x64 fall under? X86 covers both i{3,4,5,6}86 and x86_64. More on reddit.com
🌐 r/LLVM
2
4
January 5, 2024
How to list supported target architectures in clang? - Stack Overflow
64-bit Windows uses the same Win32 API. 2025-11-18T13:19:06.287Z+00:00 ... Save this answer. ... Show activity on this post. According to Jonathan Roelofs in this talk “Which targets does Clang support?”: $ llc --version LLVM (http://llvm.org/): LLVM version 3.6.0 Optimized build with assertions. Built Apr 2 2015 (01:25:22). Default target: x86... More on stackoverflow.com
🌐 stackoverflow.com
build of clang with LLVM_TARGETS_TO_BUILD set to X86 breaks when building clang shared library
Bugzilla Link 43009 Resolution INVALID Resolved on Aug 19, 2019 10:52 Version 8.0 OS Linux Reporter LLVM Bugzilla Contributor CC @tstellar Extended Description I was building clang 8.0.1 from sourc... More on github.com
🌐 github.com
2
August 15, 2019
🌐
GitHub
github.com › llvm › llvm-project › blob › main › llvm › lib › Target › X86 › X86.td
llvm-project/llvm/lib/Target/X86/X86.td at main · llvm/llvm-project
include "llvm/Target/Target.td" · //===----------------------------------------------------------------------===// // X86 Subtarget state · // // disregarding specific ABI / programming model · def Is64Bit : SubtargetFeature<"64bit-mode", "Is64Bit", "true", "64-bit mode (x86_64)">; def Is32Bit : SubtargetFeature<"32bit-mode", "Is32Bit", "true", "32-bit mode (80386)">; def Is16Bit : SubtargetFeature<"16bit-mode", "Is16Bit", "true", "16-bit mode (i8086)">; def IsX32 : SubtargetFeature<"x32", "IsX32", "true", "64-bit with ILP32 programming model (e.g.
Author   llvm
🌐
LLVM
llvm.org › docs › GettingStarted.html
Getting Started with the LLVM System — LLVM 23.0.0git documentation
Files describing target architectures for code generation. For example, llvm/lib/Target/X86 holds the X86 machine description.
🌐
LLVM
llvm.org › docs › GettingStartedVS.html
Getting Started with the LLVM System using Microsoft Visual Studio — LLVM 23.0.0git documentation
cmake -S llvm\llvm -B build -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -Thost=x64 exit ... By default, the Visual Studio project files generated by CMake use the 32-bit toolset. If you are developing on a 64-bit version of Windows and want to use the 64-bit toolset, pass the -Thost=x64 flag when generating the Visual Studio solution.
🌐
Reddit
reddit.com › r/llvm › help with values of llvm_targets_to_build
r/LLVM on Reddit: Help with Values of LLVM_TARGETS_TO_BUILD
January 5, 2024 -

I found the stable instruction sets yet can't find any additional info on them, which one does x64 fall under? Or can I just pass "x64" to "LLVM_TARGETS_TO_BUILD" and magic will happen? I Only want to compile what is needed for the target.

The list I found; AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SystemZ, WebAssembly, X86, XCore.

Find elsewhere
🌐
LLVM
llvm.org › devmtg › 2023-10 › slides › tutorials › Hosek-UnderstandingtheLLVMbuild.pdf pdf
Understanding the LLVM build
The build targets are available as builtins-<target> and runtimes-<target>. Cross-compiling runtimes · 36 · # MyCache.cmake · set(LLVM_BUILTIN_TARGETS "x86_64-linux-gnu;aarch64-linux-gnu" CACHE STRING "") foreach(target ${LLVM_BUILTIN_TARGETS}) set(BUILTINS_${target}_CMAKE_SYSTEM_NAME "Linux" CACHE STRING "") set(BUILTINS_${target}_CMAKE_SYSROOT "${SYSROOT_${target}}" CACHE PATH "") …
🌐
Microsoft Learn
learn.microsoft.com › en-us › vcpkg › users › examples › selecting-llvm-features
Selecting LLVM Features | Microsoft Learn
Registered Targets: x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 · But llvm supports many more targets, from ARM to SPARC to SystemZ. However, clearly our current installation doesn't include ARM as a target; thus, we need to learn how vcpkg allows us to install other LLVM targets. The llvm port allows this via the "target-*" features. If we do: > vcpkg search llvm · We can see: llvm 10.0.0#6 The LLVM Compiler Infrastructure llvm[clang] Build C Language Family Front-end.
🌐
LLVM
llvm.org › docs › HowToBuildOnARM.html
How To Build On ARM — LLVM 23.0.0git documentation
It’s also a lot quicker to only build the relevant back-ends (ARM and AArch64), since it’s very unlikely that you’ll use an ARM board to cross-compile to other architectures. If you’re running Compiler-RT tests, also include the x86 back-end, or some tests will fail. cmake $LLVM_SRC_DIR -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64"
🌐
Google Groups
groups.google.com › g › llvm-dev › c › IINEIVmfbD8 › m › SQKFpUo7AQAJ
[llvm-dev] New x86-64 micro-architecture levels
No one is building a new GNU/Linux distribution that is based on glibc 2.12 today, for example. But not so much for x86 CPUs. If you think my worry is unfounded, then a year-based approach sounds compelling. ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message · to Florian Weimer, g...@gcc.gnu.org, libc-...@sourceware.org, Dongsheng Song, llvm...@lists.llvm.org, Mallappa, Premachandra, x86-6...@googlegroups.com
Top answer
1 of 14
86

Starting with Clang 11 (trunk), the list of supported target architectures could be handily printed using the newly added -print-targets flag:

$ clang -print-targets
  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    avr        - Atmel AVR Microcontroller
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    hexagon    - Hexagon
    lanai      - Lanai
    mips       - MIPS (32-bit big endian)
    mips64     - MIPS (64-bit big endian)
    mips64el   - MIPS (64-bit little endian)
    mipsel     - MIPS (32-bit little endian)
    msp430     - MSP430 [experimental]
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
    riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    sparc      - Sparc
    sparcel    - Sparc LE
    sparcv9    - Sparc V9
    systemz    - SystemZ
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    wasm32     - WebAssembly 32-bit
    wasm64     - WebAssembly 64-bit
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64
    xcore      - XCore

References: LLVM PR, LLVM commit, Clang 11 documentation.

2 of 14
81

So far as I can tell, there is no command-line option to list which architectures a given clang binary supports, and even running strings on it doesn't really help. Clang is essentially just a C to LLVM translator, and it's LLVM itself that deals with the nitty-gritty of generating actual machine code, so it's not entirely surprising that Clang isn't paying much attention to the underlying architecture.

As others have already noted, you can ask llc which architectures it supports. This isn't all that helpful not just because these LLVM components might not be installed, but because of the vagaries of search paths and packaging systems, your llc and clang binaries may not correspond to the same version of LLVM.

However, for the sake of argument, let's say that you compiled both LLVM and Clang yourself or that you're otherwise happy to accept your LLVM binaries as good enough:

  • llc --version will give a list of all architectures it supports. By default, it is compiled to support all architectures. What you may think of as a single architecture such as ARM may have several LLVM architectures such as regular ARM, Thumb and AArch64. This is mainly for implementation convenience because the different execution modes have very different instruction encodings and semantics.
  • For each of the architectures listed, llc -march=ARCH -mattr=help will list "available CPUs" and "available features". The CPUs are generally just a convenient way of setting a default collection of features.

But now for the bad news. There is no convenient table of triples in Clang or LLVM that can be dumped, because the architecture-specific backends have the option of parsing the triple string into an llvm::Triple object (defined in include/llvm/ADT/Triple.h). In other words, to dump all available triples requires solving the Halting Problem. See, for example, llvm::ARM_MC::ParseARMTriple(...) which special-cases parsing the string "generic".

Ultimately, though, the "triple" is mostly a backwards-compatibility feature to make Clang a drop-in replacement for GCC, so you generally don't need to pay much attention to it unless you are porting Clang or LLVM to a new platform or architecture. Instead, you will probably find the output of llc -march=arm -mattr=help and boggling at the huge array of different ARM features to be more useful in your investigations.

Good luck with your research!

🌐
LLVM
lists.llvm.org › pipermail › llvm-commits › Week-of-Mon-20201012 › 840244.html
[llvm] 012dd42 - [X86] Support -march=x86-64-v[234]
+// X86_64_V2: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1 +// X86_64_V2: #define __LAHF_SAHF__ 1 +// X86_64_V2: #define __POPCNT__ 1 +// X86_64_V2: #define __SSE3__ 1 +// X86_64_V2-NEXT: #define __SSE4_1__ 1 +// X86_64_V2-NEXT: #define __SSE4_2__ 1 +// X86_64_V2: #define __SSSE3__ 1 + +/// v3 is close to Haswell. +// RUN: %clang -target x86_64 -march=x86-64-v3 -E -dM %s > %tv3 +// RUN: diff %tv2 %tv3 > %t.txt || true +// RUN: FileCheck %s --check-prefix=X86_64_V3 < %t.txt + +// X86_64_V3: #define __AVX2__ 1 +// X86_64_V3-NEXT: #define __AVX__ 1 +// X86_64_V3: #define __BMI2__ 1 +// X86_64_V3-NEXT: #define __BMI__ 1 +// X86_64_V3: #define __F16C__ 1 +// X86_64_V3: #define __FMA__ 1 +// X86_64_V3: #define __LZCNT__ 1 +// X86_64_V3: #define __MOVBE__ 1 +// X86_64_V3: #define __XSAVE__ 1 + +/// v4 is close to the AVX-512 level implemented by Xeon Scalable Processors.
🌐
Android Developers
developer.android.com › ndk › use the ndk with other build systems
Use the NDK with other build systems | Android NDK | Android Developers
March 6, 2026 - # Check out the source. git clone https://gitlab.com/bzip/bzip2.git cd bzip2 # Only choose one of these, depending on your build machine... export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64 export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64 # Only choose one of these, depending on your device... export TARGET=aarch64-linux-android export TARGET=armv7a-linux-androideabi export TARGET=i686-linux-android export TARGET=x86_64-linux-android # Set this to your minSdkVersion.
🌐
GitHub
github.com › llvm › llvm-project › issues › 42354
build of clang with LLVM_TARGETS_TO_BUILD set to X86 breaks when building clang shared library · Issue #42354 · llvm/llvm-project
August 15, 2019 - As soon as I change X86 to all for both llvm and clang, it works fine. I am bootstrapping with gcc9/ld first in this case. cmake command for llvm: LD_LIBRARY_PATH="/usr/local/compilers/gcc9/lib64" cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/local/compilers/gcc9/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/compilers/gcc9/bin/g++ -DCMAKE_INSTALL_PREFIX=/usr/local/compilers/clang8 -DLLVM_TARGETS_TO_BUILD="all" -DLLVM_BUILD_LLVM_DYLIB=true -DLLVM_LINK_LLVM_DYLIB=true ../../llvm-8.0.1.src
Author   llvm
🌐
LLVM Discussion Forums
discourse.llvm.org › code generation › x86
Plans to add x86-64-v5 target? - X86 - LLVM Discussion Forums
April 3, 2024 - I’ve been using -march=x86-64-v{2-4} for a project to get code generated roughly according to the SSE/AVX2/AVX512 developments in x86 CPUs. However, -v4 is a bit “behind” now, as it was introduced to cover the AVX512 set of Skylake CPUs. We are now at least 3 to 4 Intel CPU generations down the line, and there are quite a few new extensions since then, as shown in this image.
🌐
LLVM
llvm.org › docs › WritingAnLLVMBackend.html
Writing an LLVM Backend — LLVM 23.0.0git documentation
Some common immediate Operand types (for instance i8, i32, i64, f32, f64) are defined for all targets in include/llvm/Target/Target.td, and are available in each Target’s OpTypes enum. Also, only named Operand types appear in the enumeration: anonymous types are ignored. For example, the X86 backend defines brtarget and brtarget8, both instances of the TableGen Operand class, which represent branch target operands:
🌐
GitHub
github.com › sfbakturin › llvm-m86
GitHub - sfbakturin/llvm-m86: The M86 (Meliorated x86) custom architecture LLVM Project.
Added register's info for architecture. Consult the Getting Started with LLVM page for information on building and running LLVM. For M86 target you should define LLVM_TARGETS_TO_BUILD to M86 when building with CMake.
Author   sfbakturin
🌐
Clang
clang.llvm.org › doxygen › Basic_2Targets_2X86_8cpp_source.html
lib/Basic/Targets/X86.cpp Source File - Clang
static constexpr int NumX86_64Builtins · Definition X86.cpp:28 · clang::targets::DefineStd · LLVM_LIBRARY_VISIBILITY void DefineStd(clang::MacroBuilder &Builder, llvm::StringRef MacroName, const clang::LangOptions &Opts) Define a macro name and standard variants. clang · The JSON file list parser is used to communicate input to InstallAPI.