1 //===-- Compile time architecture detection ---------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H 10 #define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H 11 12 #if defined(__AMDGPU__) 13 #define LIBC_TARGET_ARCH_IS_AMDGPU 14 #endif 15 16 #if defined(__NVPTX__) 17 #define LIBC_TARGET_ARCH_IS_NVPTX 18 #endif 19 20 #if defined(LIBC_TARGET_ARCH_IS_NVPTX) || defined(LIBC_TARGET_ARCH_IS_AMDGPU) 21 #define LIBC_TARGET_ARCH_IS_GPU 22 #endif 23 24 #if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU) 25 #define LIBC_TARGET_ARCH_IS_VM 26 #endif 27 28 #if (defined(_M_IX86) || defined(__i386__)) && !defined(LIBC_TARGET_ARCH_IS_VM) 29 #define LIBC_TARGET_ARCH_IS_X86_32 30 #endif 31 32 #if (defined(_M_X64) || defined(__x86_64__)) && !defined(LIBC_TARGET_ARCH_IS_VM) 33 #define LIBC_TARGET_ARCH_IS_X86_64 34 #endif 35 36 #if defined(LIBC_TARGET_ARCH_IS_X86_32) || defined(LIBC_TARGET_ARCH_IS_X86_64) 37 #define LIBC_TARGET_ARCH_IS_X86 38 #endif 39 40 #if (defined(__arm__) || defined(_M_ARM)) 41 #define LIBC_TARGET_ARCH_IS_ARM 42 #endif 43 44 #if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) 45 #define LIBC_TARGET_ARCH_IS_AARCH64 46 #endif 47 48 #if defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(LIBC_TARGET_ARCH_IS_ARM) 49 #define LIBC_TARGET_ARCH_IS_ANY_ARM 50 #endif 51 52 #if defined(__riscv) && (__riscv_xlen == 64) 53 #define LIBC_TARGET_ARCH_IS_RISCV64 54 #endif 55 56 #if defined(__riscv) && (__riscv_xlen == 32) 57 #define LIBC_TARGET_ARCH_IS_RISCV32 58 #endif 59 60 #if defined(LIBC_TARGET_ARCH_IS_RISCV64) || defined(LIBC_TARGET_ARCH_IS_RISCV32) 61 #define LIBC_TARGET_ARCH_IS_ANY_RISCV 62 #endif 63 64 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_ARCHITECTURES_H 65