1 //===-- Compile time architecture detection ---------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H
10 #define LLVM_LIBC_SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H
12 #if defined(__AMDGPU__)
13 #define LIBC_TARGET_ARCH_IS_AMDGPU
16 #if defined(__NVPTX__)
17 #define LIBC_TARGET_ARCH_IS_NVPTX
20 #if defined(LIBC_TARGET_ARCH_IS_NVPTX) || defined(LIBC_TARGET_ARCH_IS_AMDGPU)
21 #define LIBC_TARGET_ARCH_IS_GPU
24 #if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
25 #define LIBC_TARGET_ARCH_IS_VM
28 #if (defined(_M_IX86) || defined(__i386__)) && !defined(LIBC_TARGET_ARCH_IS_VM)
29 #define LIBC_TARGET_ARCH_IS_X86_32
32 #if (defined(_M_X64) || defined(__x86_64__)) && !defined(LIBC_TARGET_ARCH_IS_VM)
33 #define LIBC_TARGET_ARCH_IS_X86_64
36 #if defined(LIBC_TARGET_ARCH_IS_X86_32) || defined(LIBC_TARGET_ARCH_IS_X86_64)
37 #define LIBC_TARGET_ARCH_IS_X86
40 #if (defined(__arm__) || defined(_M_ARM))
41 #define LIBC_TARGET_ARCH_IS_ARM
44 #if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
45 #define LIBC_TARGET_ARCH_IS_AARCH64
48 #if defined(__riscv) && (__riscv_xlen == 64)
49 #define LIBC_TARGET_ARCH_IS_RISCV64
52 #if defined(__riscv) && (__riscv_xlen == 32)
53 #define LIBC_TARGET_ARCH_IS_RISCV32
56 #if (defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(LIBC_TARGET_ARCH_IS_ARM))
57 #define LIBC_TARGET_ARCH_IS_ANY_ARM
60 #endif // LLVM_LIBC_SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H