[libc-commits] [libc] 1637351 - [libc][NFC] Rename architecture macros and move to macros folder

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Feb 7 02:20:37 PST 2023


Author: Guillaume Chatelet
Date: 2023-02-07T10:20:22Z
New Revision: 1637351fd125c9a8236602c2aefdac0b64c7db75

URL: https://github.com/llvm/llvm-project/commit/1637351fd125c9a8236602c2aefdac0b64c7db75
DIFF: https://github.com/llvm/llvm-project/commit/1637351fd125c9a8236602c2aefdac0b64c7db75.diff

LOG: [libc][NFC] Rename architecture macros and move to macros folder

Added: 
    libc/src/__support/macros/README.md
    libc/src/__support/macros/architectures.h

Modified: 
    libc/config/linux/app.h
    libc/src/__support/CMakeLists.txt
    libc/src/__support/FPUtil/FEnvImpl.h
    libc/src/__support/FPUtil/FMA.h
    libc/src/__support/FPUtil/PlatformDefs.h
    libc/src/__support/FPUtil/aarch64/FEnvImpl.h
    libc/src/__support/FPUtil/aarch64/FMA.h
    libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
    libc/src/__support/FPUtil/aarch64/nearest_integer.h
    libc/src/__support/FPUtil/aarch64/sqrt.h
    libc/src/__support/FPUtil/multiply_add.h
    libc/src/__support/FPUtil/nearest_integer.h
    libc/src/__support/FPUtil/sqrt.h
    libc/src/__support/FPUtil/x86_64/FEnvImpl.h
    libc/src/__support/FPUtil/x86_64/FMA.h
    libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
    libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
    libc/src/__support/FPUtil/x86_64/PolyEval.h
    libc/src/__support/FPUtil/x86_64/nearest_integer.h
    libc/src/__support/FPUtil/x86_64/sqrt.h
    libc/src/__support/OSUtil/linux/syscall.h
    libc/src/__support/threads/linux/thread.cpp
    libc/src/__support/threads/thread.h
    libc/src/setjmp/longjmp.cpp
    libc/src/setjmp/setjmp.cpp
    libc/src/string/memory_utils/bcmp_implementations.h
    libc/src/string/memory_utils/memcmp_implementations.h
    libc/src/string/memory_utils/memcpy_implementations.h
    libc/src/string/memory_utils/memmove_implementations.h
    libc/src/string/memory_utils/memset_implementations.h
    libc/src/string/memory_utils/op_aarch64.h
    libc/src/string/memory_utils/op_generic.h
    libc/src/string/memory_utils/op_x86.h
    libc/src/threads/linux/Futex.h
    libc/test/src/fenv/enabled_exceptions_test.cpp
    libc/test/src/fenv/feenableexcept_test.cpp
    libc/test/src/fenv/feholdexcept_test.cpp
    libc/test/src/string/memory_utils/op_tests.cpp
    libc/test/src/sys/utsname/uname_test.cpp
    utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Removed: 
    libc/src/__support/architectures.h


################################################################################
diff  --git a/libc/config/linux/app.h b/libc/config/linux/app.h
index c4cf6dfea5bb4..67a36240bf06a 100644
--- a/libc/config/linux/app.h
+++ b/libc/config/linux/app.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_CONFIG_LINUX_APP_H
 #define LLVM_LIBC_CONFIG_LINUX_APP_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
 #include <stdint.h>
 
@@ -35,7 +35,7 @@ struct TLSImage {
   uintptr_t align;
 };
 
-#if defined(LLVM_LIBC_ARCH_X86_64) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86_64) || defined(LIBC_TARGET_IS_AARCH64)
 // At the language level, argc is an int. But we use uint64_t as the x86_64
 // ABI specifies it as an 8 byte value. Likewise, in the ARM64 ABI, arguments
 // are usually passed in registers.  x0 is a doubleword register, so this is

diff  --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index daaabcad428dd..7d68137c2c104 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -31,7 +31,7 @@ add_header_library(
 add_header_library(
   common
   HDRS
-    architectures.h
+    macros/architectures.h
     common.h
     cpu_features.h
     endian.h

diff  --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 85818a67dfa05..6d060b8dd888b 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -9,16 +9,16 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FENVIMPL_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FENVIMPL_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 #if defined(__APPLE__)
 #include "aarch64/fenv_darwin_impl.h"
 #else
 #include "aarch64/FEnvImpl.h"
 #endif
-#elif defined(LLVM_LIBC_ARCH_X86)
+#elif defined(LIBC_TARGET_IS_X86)
 #include "x86_64/FEnvImpl.h"
 #else
 #include <fenv.h>

diff  --git a/libc/src/__support/FPUtil/FMA.h b/libc/src/__support/FPUtil/FMA.h
index 7b0dbe4c1a928..68bb952d57f68 100644
--- a/libc/src/__support/FPUtil/FMA.h
+++ b/libc/src/__support/FPUtil/FMA.h
@@ -9,15 +9,15 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
 #include "src/__support/cpu_features.h"
+#include "src/__support/macros/architectures.h"
 
 #if defined(LIBC_TARGET_HAS_FMA)
 
-#if defined(LLVM_LIBC_ARCH_X86_64)
+#if defined(LIBC_TARGET_IS_X86_64)
 #include "x86_64/FMA.h"
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
 #include "aarch64/FMA.h"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/PlatformDefs.h b/libc/src/__support/FPUtil/PlatformDefs.h
index 6f22bc38bdff3..3d97b1052eebd 100644
--- a/libc/src/__support/FPUtil/PlatformDefs.h
+++ b/libc/src/__support/FPUtil/PlatformDefs.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_PLATFORM_DEFS_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_PLATFORM_DEFS_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
 #define X87_FPU
 #endif
 

diff  --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index c82d1be3eb564..03730dddecd8c 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_AARCH64) || defined(__APPLE__)
+#if !defined(LIBC_TARGET_IS_AARCH64) || defined(__APPLE__)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/aarch64/FMA.h b/libc/src/__support/FPUtil/aarch64/FMA.h
index 1591c9b9ee091..0f319a7bfd83a 100644
--- a/libc/src/__support/FPUtil/aarch64/FMA.h
+++ b/libc/src/__support/FPUtil/aarch64/FMA.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FMA_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FMA_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/cpu_features.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_AARCH64)
+#if !defined(LIBC_TARGET_IS_AARCH64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index a916dc54f3a54..da7b44da8e116 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_AARCH64) || !defined(__APPLE__)
+#if !defined(LIBC_TARGET_IS_AARCH64) || !defined(__APPLE__)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/aarch64/nearest_integer.h b/libc/src/__support/FPUtil/aarch64/nearest_integer.h
index 1d94e66d0e1dc..351e147b15023 100644
--- a/libc/src/__support/FPUtil/aarch64/nearest_integer.h
+++ b/libc/src/__support/FPUtil/aarch64/nearest_integer.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_NEAREST_INTEGER_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_NEAREST_INTEGER_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_AARCH64)
+#if !defined(LIBC_TARGET_IS_AARCH64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/aarch64/sqrt.h b/libc/src/__support/FPUtil/aarch64/sqrt.h
index 2a8912e65a8af..b6e3f68203292 100644
--- a/libc/src/__support/FPUtil/aarch64/sqrt.h
+++ b/libc/src/__support/FPUtil/aarch64/sqrt.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_SQRT_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_SQRT_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_AARCH64)
+#if !defined(LIBC_TARGET_IS_AARCH64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/multiply_add.h b/libc/src/__support/FPUtil/multiply_add.h
index aef102e9c483e..f2db75945850d 100644
--- a/libc/src/__support/FPUtil/multiply_add.h
+++ b/libc/src/__support/FPUtil/multiply_add.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_MULTIPLY_ADD_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_MULTIPLY_ADD_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
 #include "src/__support/cpu_features.h"
+#include "src/__support/macros/architectures.h"
 
 namespace __llvm_libc {
 namespace fputil {

diff  --git a/libc/src/__support/FPUtil/nearest_integer.h b/libc/src/__support/FPUtil/nearest_integer.h
index bf2bf4b797c69..4ff19ca8a7c5b 100644
--- a/libc/src/__support/FPUtil/nearest_integer.h
+++ b/libc/src/__support/FPUtil/nearest_integer.h
@@ -9,12 +9,12 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_NEAREST_INTEGER_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_NEAREST_INTEGER_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if (defined(LLVM_LIBC_ARCH_X86_64) && defined(__SSE4_2__))
+#if (defined(LIBC_TARGET_IS_X86_64) && defined(__SSE4_2__))
 #include "x86_64/nearest_integer.h"
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
 #include "aarch64/nearest_integer.h"
 #else
 

diff  --git a/libc/src/__support/FPUtil/sqrt.h b/libc/src/__support/FPUtil/sqrt.h
index 6e02d9c77e8e0..5c48967c1f41b 100644
--- a/libc/src/__support/FPUtil/sqrt.h
+++ b/libc/src/__support/FPUtil/sqrt.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_SQRT_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_SQRT_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_X86_64)
+#if defined(LIBC_TARGET_IS_X86_64)
 #include "x86_64/sqrt.h"
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
 #include "aarch64/sqrt.h"
 #else
 #include "generic/sqrt.h"

diff  --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
index 5c30ee35efae3..d80fa5ba9a227 100644
--- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FENVIMPL_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FENVIMPL_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86)
+#if !defined(LIBC_TARGET_IS_X86)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/FMA.h b/libc/src/__support/FPUtil/x86_64/FMA.h
index 43b144331ce5c..466f41316258a 100644
--- a/libc/src/__support/FPUtil/x86_64/FMA.h
+++ b/libc/src/__support/FPUtil/x86_64/FMA.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FMA_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FMA_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
 #include "src/__support/cpu_features.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86_64)
+#if !defined(LIBC_TARGET_IS_X86_64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
index 2c49a485073c0..183309168ef09 100644
--- a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
+++ b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
@@ -11,10 +11,10 @@
 
 #include "src/__support/CPP/bit.h"
 #include "src/__support/UInt128.h"
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86)
+#if !defined(LIBC_TARGET_IS_X86)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
index 8d3dd30c47dbc..1b8d95d779cc5 100644
--- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
+++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_NEXT_AFTER_LONG_DOUBLE_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_NEXT_AFTER_LONG_DOUBLE_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86)
+#if !defined(LIBC_TARGET_IS_X86)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/PolyEval.h b/libc/src/__support/FPUtil/x86_64/PolyEval.h
index d6cd28da83cd4..d38af43d00759 100644
--- a/libc/src/__support/FPUtil/x86_64/PolyEval.h
+++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_POLYEVAL_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_POLYEVAL_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86_64)
+#if !defined(LIBC_TARGET_IS_X86_64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/nearest_integer.h b/libc/src/__support/FPUtil/x86_64/nearest_integer.h
index f9a2a6a07b556..12fe62e6bbf6f 100644
--- a/libc/src/__support/FPUtil/x86_64/nearest_integer.h
+++ b/libc/src/__support/FPUtil/x86_64/nearest_integer.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_NEAREST_INTEGER_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_NEAREST_INTEGER_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86_64)
+#if !defined(LIBC_TARGET_IS_X86_64)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index 07009d656664b..0ee57b087bcbd 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_SQRT_H
 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_SQRT_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#if !defined(LLVM_LIBC_ARCH_X86)
+#if !defined(LIBC_TARGET_IS_X86)
 #error "Invalid include"
 #endif
 

diff  --git a/libc/src/__support/OSUtil/linux/syscall.h b/libc/src/__support/OSUtil/linux/syscall.h
index d4defd3ff2852..ff9810e220937 100644
--- a/libc/src/__support/OSUtil/linux/syscall.h
+++ b/libc/src/__support/OSUtil/linux/syscall.h
@@ -9,14 +9,14 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H
 #define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
 #include "x86_64/syscall.h"
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
 #include "aarch64/syscall.h"
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
 #include "arm/syscall.h"
 #endif
 

diff  --git a/libc/src/__support/architectures.h b/libc/src/__support/architectures.h
deleted file mode 100644
index af97469f60b09..0000000000000
--- a/libc/src/__support/architectures.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===-- Compile time architecture detection ---------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SUPPORT_ARCHITECTURES_H
-#define LLVM_LIBC_SUPPORT_ARCHITECTURES_H
-
-#if defined(__AMDGPU__)
-#define LLVM_LIBC_ARCH_AMDGPU
-#endif
-
-#if defined(__NVPTX__)
-#define LLVM_LIBC_ARCH_NVPTX
-#endif
-
-#if defined(LLVM_LIBC_ARCH_NVPTX) || defined(LLVM_LIBC_ARCH_AMDGPU)
-#define LLVM_LIBC_ARCH_GPU
-#endif
-
-#if defined(__pnacl__) || defined(__CLR_VER) || defined(LLVM_LIBC_ARCH_GPU)
-#define LLVM_LIBC_ARCH_VM
-#endif
-
-#if (defined(_M_IX86) || defined(__i386__)) && !defined(LLVM_LIBC_ARCH_VM)
-#define LLVM_LIBC_ARCH_X86_32
-#endif
-
-#if (defined(_M_X64) || defined(__x86_64__)) && !defined(LLVM_LIBC_ARCH_VM)
-#define LLVM_LIBC_ARCH_X86_64
-#endif
-
-#if defined(LLVM_LIBC_ARCH_X86_32) || defined(LLVM_LIBC_ARCH_X86_64)
-#define LLVM_LIBC_ARCH_X86
-#endif
-
-#if (defined(__arm__) || defined(_M_ARM))
-#define LLVM_LIBC_ARCH_ARM
-#endif
-
-#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
-#define LLVM_LIBC_ARCH_AARCH64
-#endif
-
-#if (defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_ARM))
-#define LLVM_LIBC_ARCH_ANY_ARM
-#endif
-
-#endif // LLVM_LIBC_SUPPORT_ARCHITECTURES_H

diff  --git a/libc/src/__support/macros/README.md b/libc/src/__support/macros/README.md
new file mode 100644
index 0000000000000..d9a008d8384c7
--- /dev/null
+++ b/libc/src/__support/macros/README.md
@@ -0,0 +1,6 @@
+This folder contains freestanding header only files.
+
+They define macros either properties or attributes.
+
+Properties are derived from existing preprocessor definitions and present a
+uniform presentation of the target for which we build.

diff  --git a/libc/src/__support/macros/architectures.h b/libc/src/__support/macros/architectures.h
new file mode 100644
index 0000000000000..234ed3e380d4f
--- /dev/null
+++ b/libc/src/__support/macros/architectures.h
@@ -0,0 +1,52 @@
+//===-- Compile time architecture detection ---------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SUPPORT_MACROS_ARCHITECTURES_H
+#define LLVM_LIBC_SUPPORT_MACROS_ARCHITECTURES_H
+
+#if defined(__AMDGPU__)
+#define LIBC_TARGET_IS_AMDGPU
+#endif
+
+#if defined(__NVPTX__)
+#define LIBC_TARGET_IS_NVPTX
+#endif
+
+#if defined(LIBC_TARGET_IS_NVPTX) || defined(LIBC_TARGET_IS_AMDGPU)
+#define LIBC_TARGET_IS_GPU
+#endif
+
+#if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_IS_GPU)
+#define LIBC_TARGET_IS_VM
+#endif
+
+#if (defined(_M_IX86) || defined(__i386__)) && !defined(LIBC_TARGET_IS_VM)
+#define LIBC_TARGET_IS_X86_32
+#endif
+
+#if (defined(_M_X64) || defined(__x86_64__)) && !defined(LIBC_TARGET_IS_VM)
+#define LIBC_TARGET_IS_X86_64
+#endif
+
+#if defined(LIBC_TARGET_IS_X86_32) || defined(LIBC_TARGET_IS_X86_64)
+#define LIBC_TARGET_IS_X86
+#endif
+
+#if (defined(__arm__) || defined(_M_ARM))
+#define LIBC_TARGET_IS_ARM
+#endif
+
+#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
+#define LIBC_TARGET_IS_AARCH64
+#endif
+
+#if (defined(LIBC_TARGET_IS_AARCH64) || defined(LIBC_TARGET_IS_ARM))
+#define LIBC_TARGET_IS_ANY_ARM
+#endif
+
+#endif // LLVM_LIBC_SUPPORT_MACROS_ARCHITECTURES_H

diff  --git a/libc/src/__support/threads/linux/thread.cpp b/libc/src/__support/threads/linux/thread.cpp
index 62e24e58b9ec3..599082a0caef3 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -16,7 +16,7 @@
 #include "src/__support/error_or.h"
 #include "src/__support/threads/linux/futex_word.h" // For FutexWordType
 
-#ifdef LLVM_LIBC_ARCH_AARCH64
+#ifdef LIBC_TARGET_IS_AARCH64
 #include <arm_acle.h>
 #endif
 
@@ -99,14 +99,14 @@ __attribute__((always_inline)) inline uintptr_t get_start_args_addr() {
 // NOTE: For __builtin_frame_address to work reliably across compilers,
 // architectures and various optimization levels, the TU including this file
 // should be compiled with -fno-omit-frame-pointer.
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
   return reinterpret_cast<uintptr_t>(__builtin_frame_address(0))
          // The x86_64 call instruction pushes resume address on to the stack.
          // Next, The x86_64 SysV ABI requires that the frame pointer be pushed
          // on to the stack. So, we have to step past two 64-bit values to get
          // to the start args.
          + sizeof(uintptr_t) * 2;
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   // The frame pointer after cloning the new thread in the Thread::run method
   // is set to the stack pointer where start args are stored. So, we fetch
   // from there.
@@ -190,7 +190,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack,
   // Also, we want the result of the syscall to be in a register as the child
   // thread gets a completely 
diff erent stack after it is created. The stack
   // variables from this function will not be availalbe to the child thread.
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
   long register clone_result asm("rax");
   clone_result = __llvm_libc::syscall_impl(
       SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack,
@@ -198,7 +198,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack,
       &clear_tid->val, // The futex where the child thread status is signalled
       tls.tp           // The thread pointer value for the new thread.
   );
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   long register clone_result asm("x0");
   clone_result = __llvm_libc::syscall_impl(
       SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack,
@@ -211,7 +211,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack,
 #endif
 
   if (clone_result == 0) {
-#ifdef LLVM_LIBC_ARCH_AARCH64
+#ifdef LIBC_TARGET_IS_AARCH64
     // We set the frame pointer to be the same as the "sp" so that start args
     // can be sniffed out from start_thread.
     __arm_wsr64("x29", __arm_rsr64("sp"));

diff  --git a/libc/src/__support/threads/thread.h b/libc/src/__support/threads/thread.h
index 0ac2a06bf33d5..fe95d8f4e9e98 100644
--- a/libc/src/__support/threads/thread.h
+++ b/libc/src/__support/threads/thread.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_THREADS_THREAD_H
 #define LLVM_LIBC_SRC_SUPPORT_THREADS_THREAD_H
 
-#include "src/__support/CPP/string_view.h"
 #include "src/__support/CPP/atomic.h"
 #include "src/__support/CPP/optional.h"
+#include "src/__support/CPP/string_view.h"
 #include "src/__support/CPP/stringstream.h"
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
 #include <stddef.h> // For size_t
 #include <stdint.h>
@@ -36,7 +36,7 @@ union ThreadReturnValue {
   constexpr ThreadReturnValue(void *r) : posix_retval(r) {}
 };
 
-#if (defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_X86_64))
+#if (defined(LIBC_TARGET_IS_AARCH64) || defined(LIBC_TARGET_IS_X86_64))
 constexpr unsigned int STACK_ALIGNMENT = 16;
 #endif
 // TODO: Provide stack alignment requirements for other architectures.

diff  --git a/libc/src/setjmp/longjmp.cpp b/libc/src/setjmp/longjmp.cpp
index 9d2d783a536fc..da323ddb4f0ce 100644
--- a/libc/src/setjmp/longjmp.cpp
+++ b/libc/src/setjmp/longjmp.cpp
@@ -7,15 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/setjmp/longjmp.h"
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 
 #include <setjmp.h>
 
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
   register __UINT64_TYPE__ rbx __asm__("rbx");
   register __UINT64_TYPE__ rbp __asm__("rbp");
   register __UINT64_TYPE__ r12 __asm__("r12");
@@ -38,7 +38,7 @@ LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
   LIBC_INLINE_ASM("mov %1, %0\n\t" : "=r"(r15) : "m"(buf->r15) :);
   LIBC_INLINE_ASM("mov %1, %0\n\t" : "=r"(rsp) : "m"(buf->rsp) :);
   LIBC_INLINE_ASM("jmp *%0\n\t" : : "m"(buf->rip));
-#else // LLVM_LIBC_ARCH_X86_64
+#else // LIBC_TARGET_IS_X86_64
 #error "longjmp implementation not available for the target architecture."
 #endif
 }

diff  --git a/libc/src/setjmp/setjmp.cpp b/libc/src/setjmp/setjmp.cpp
index 11d2d7079ad54..9506eda2c2a47 100644
--- a/libc/src/setjmp/setjmp.cpp
+++ b/libc/src/setjmp/setjmp.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 #include "src/setjmp/setjmp_impl.h"
 
 #include <setjmp.h>
@@ -15,7 +15,7 @@
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
   register __UINT64_TYPE__ rbx __asm__("rbx");
   register __UINT64_TYPE__ r12 __asm__("r12");
   register __UINT64_TYPE__ r13 __asm__("r13");
@@ -50,7 +50,7 @@ LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
   buf->rsp = reinterpret_cast<__UINTPTR_TYPE__>(__builtin_frame_address(0)) +
              sizeof(__UINTPTR_TYPE__) * 2;
   buf->rip = reinterpret_cast<__UINTPTR_TYPE__>(__builtin_return_address(0));
-#else // LLVM_LIBC_ARCH_X86_64
+#else // LIBC_TARGET_IS_X86_64
 #error "setjmp implementation not available for the target architecture."
 #endif
 

diff  --git a/libc/src/string/memory_utils/bcmp_implementations.h b/libc/src/string/memory_utils/bcmp_implementations.h
index 4e31cc92bd838..f3622dd2e3f8f 100644
--- a/libc/src/string/memory_utils/bcmp_implementations.h
+++ b/libc/src/string/memory_utils/bcmp_implementations.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_BCMP_IMPLEMENTATIONS_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_BCMP_IMPLEMENTATIONS_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 #include "src/string/memory_utils/op_aarch64.h"
 #include "src/string/memory_utils/op_builtin.h"
 #include "src/string/memory_utils/op_generic.h"
@@ -29,7 +29,7 @@ inline_bcmp_embedded_tiny(CPtr p1, CPtr p2, size_t count) {
   return BcmpReturnType::ZERO();
 }
 
-#if defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
 [[maybe_unused]] LIBC_INLINE BcmpReturnType
 inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
   if (count < 256)
@@ -39,9 +39,9 @@ inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
   align_to_next_boundary<64, Arg::P1>(p1, p2, count);
   return generic::Bcmp<64>::loop_and_tail(p1, p2, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
 [[maybe_unused]] LIBC_INLINE BcmpReturnType
 inline_bcmp_x86_sse2_gt16(CPtr p1, CPtr p2, size_t count) {
   if (count <= 32)
@@ -109,9 +109,9 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
   else
     return inline_bcmp_generic_gt16(p1, p2, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_X86)
+#endif // defined(LIBC_TARGET_IS_X86)
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_aarch64(CPtr p1,
                                                                 CPtr p2,
                                                                 size_t count) {
@@ -158,16 +158,16 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
   }
   return aarch64::Bcmp<32>::loop_and_tail(p1, p2, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
 LIBC_INLINE BcmpReturnType inline_bcmp(CPtr p1, CPtr p2, size_t count) {
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
   return inline_bcmp_x86(p1, p2, count);
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   return inline_bcmp_aarch64(p1, p2, count);
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
   return inline_bcmp_embedded_tiny(p1, p2, count);
-#elif defined(LLVM_LIBC_ARCH_GPU)
+#elif defined(LIBC_TARGET_IS_GPU)
   return inline_bcmp_embedded_tiny(p1, p2, count);
 #else
 #error "Unsupported platform"

diff  --git a/libc/src/string/memory_utils/memcmp_implementations.h b/libc/src/string/memory_utils/memcmp_implementations.h
index 1f0f5b91bc05b..e9fed02dba503 100644
--- a/libc/src/string/memory_utils/memcmp_implementations.h
+++ b/libc/src/string/memory_utils/memcmp_implementations.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP_IMPLEMENTATIONS_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP_IMPLEMENTATIONS_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 #include "src/string/memory_utils/op_aarch64.h"
 #include "src/string/memory_utils/op_builtin.h"
 #include "src/string/memory_utils/op_generic.h"
@@ -29,7 +29,7 @@ inline_memcmp_embedded_tiny(CPtr p1, CPtr p2, size_t count) {
   return MemcmpReturnType::ZERO();
 }
 
-#if defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
 [[maybe_unused]] LIBC_INLINE MemcmpReturnType
 inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
   if (unlikely(count >= 384)) {
@@ -39,9 +39,9 @@ inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
   }
   return generic::Memcmp<16>::loop_and_tail(p1, p2, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
 [[maybe_unused]] LIBC_INLINE MemcmpReturnType
 inline_memcmp_x86_sse2_gt16(CPtr p1, CPtr p2, size_t count) {
   if (unlikely(count >= 384)) {
@@ -84,9 +84,9 @@ inline_memcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
   return x86::avx512bw::Memcmp<64>::loop_and_tail(p1, p2, count);
 }
 
-#endif // defined(LLVM_LIBC_ARCH_X86)
+#endif // defined(LIBC_TARGET_IS_X86)
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 [[maybe_unused]] LIBC_INLINE MemcmpReturnType
 inline_memcmp_aarch64_neon_gt16(CPtr p1, CPtr p2, size_t count) {
   if (unlikely(count >= 128)) { // [128, ∞]
@@ -106,10 +106,10 @@ inline_memcmp_aarch64_neon_gt16(CPtr p1, CPtr p2, size_t count) {
   // [64, 127]
   return generic::Memcmp<16>::loop_and_tail(p1 + 32, p2 + 32, count - 32);
 }
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
 LIBC_INLINE MemcmpReturnType inline_memcmp(CPtr p1, CPtr p2, size_t count) {
-#if defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
   if (count == 0)
     return MemcmpReturnType::ZERO();
   if (count == 1)
@@ -122,7 +122,7 @@ LIBC_INLINE MemcmpReturnType inline_memcmp(CPtr p1, CPtr p2, size_t count) {
     return generic::Memcmp<4>::head_tail(p1, p2, count);
   if (count <= 16)
     return generic::Memcmp<8>::head_tail(p1, p2, count);
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
   if constexpr (x86::kAvx512BW)
     return inline_memcmp_x86_avx512bw_gt16(p1, p2, count);
   else if constexpr (x86::kAvx2)
@@ -131,15 +131,15 @@ LIBC_INLINE MemcmpReturnType inline_memcmp(CPtr p1, CPtr p2, size_t count) {
     return inline_memcmp_x86_sse2_gt16(p1, p2, count);
   else
     return inline_memcmp_generic_gt16(p1, p2, count);
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   if constexpr (aarch64::kNeon)
     return inline_memcmp_aarch64_neon_gt16(p1, p2, count);
   else
     return inline_memcmp_generic_gt16(p1, p2, count);
 #endif
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
   return inline_memcmp_embedded_tiny(p1, p2, count);
-#elif defined(LLVM_LIBC_ARCH_GPU)
+#elif defined(LIBC_TARGET_IS_GPU)
   return inline_memcmp_embedded_tiny(p1, p2, count);
 #else
 #error "Unsupported platform"

diff  --git a/libc/src/string/memory_utils/memcpy_implementations.h b/libc/src/string/memory_utils/memcpy_implementations.h
index 23abdb8003896..7af309f72f111 100644
--- a/libc/src/string/memory_utils/memcpy_implementations.h
+++ b/libc/src/string/memory_utils/memcpy_implementations.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY_IMPLEMENTATIONS_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY_IMPLEMENTATIONS_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 #include "src/string/memory_utils/op_aarch64.h"
 #include "src/string/memory_utils/op_builtin.h"
 #include "src/string/memory_utils/op_generic.h"
@@ -29,7 +29,7 @@ inline_memcpy_embedded_tiny(Ptr __restrict dst, CPtr __restrict src,
     builtin::Memcpy<1>::block(dst + offset, src + offset);
 }
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
 [[maybe_unused]] LIBC_INLINE void
 inline_memcpy_x86(Ptr __restrict dst, CPtr __restrict src, size_t count) {
   if (count == 0)
@@ -86,9 +86,9 @@ inline_memcpy_x86_maybe_interpose_repmovsb(Ptr __restrict dst,
       return inline_memcpy_x86(dst, src, count);
   }
 }
-#endif // defined(LLVM_LIBC_ARCH_X86)
+#endif // defined(LIBC_TARGET_IS_X86)
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 [[maybe_unused]] LIBC_INLINE void
 inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
   if (count == 0)
@@ -115,18 +115,18 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
   align_to_next_boundary<16, Arg::Src>(dst, src, count);
   return builtin::Memcpy<64>::loop_and_tail(dst, src, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
 LIBC_INLINE void inline_memcpy(Ptr __restrict dst, CPtr __restrict src,
                                size_t count) {
   using namespace __llvm_libc::builtin;
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
   return inline_memcpy_x86_maybe_interpose_repmovsb(dst, src, count);
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   return inline_memcpy_aarch64(dst, src, count);
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
   return inline_memcpy_embedded_tiny(dst, src, count);
-#elif defined(LLVM_LIBC_ARCH_GPU)
+#elif defined(LIBC_TARGET_IS_GPU)
   return inline_memcpy_embedded_tiny(dst, src, count);
 #else
 #error "Unsupported platform"

diff  --git a/libc/src/string/memory_utils/memmove_implementations.h b/libc/src/string/memory_utils/memmove_implementations.h
index 0444aedb3bf7e..d6b7e63c08ba5 100644
--- a/libc/src/string/memory_utils/memmove_implementations.h
+++ b/libc/src/string/memory_utils/memmove_implementations.h
@@ -66,13 +66,13 @@ template <size_t MaxSize>
 }
 
 LIBC_INLINE void inline_memmove(Ptr dst, CPtr src, size_t count) {
-#if defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_AARCH64)
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86) || defined(LIBC_TARGET_IS_AARCH64)
+#if defined(LIBC_TARGET_IS_X86)
   static constexpr size_t kMaxSize = x86::kAvx512F ? 64
                                      : x86::kAvx   ? 32
                                      : x86::kSse2  ? 16
                                                    : 8;
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   static constexpr size_t kMaxSize = aarch64::kNeon ? 16 : 8;
 #endif
   // return inline_memmove_generic<kMaxSize>(dst, src, count);
@@ -101,9 +101,9 @@ LIBC_INLINE void inline_memmove(Ptr dst, CPtr src, size_t count) {
     return generic::Memmove<64, kMaxSize>::loop_and_tail_backward(dst, src,
                                                                   count);
   }
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
   return inline_memmove_embedded_tiny(dst, src, count);
-#elif defined(LLVM_LIBC_ARCH_GPU)
+#elif defined(LIBC_TARGET_IS_GPU)
   return inline_memmove_embedded_tiny(dst, src, count);
 #else
 #error "Unsupported platform"

diff  --git a/libc/src/string/memory_utils/memset_implementations.h b/libc/src/string/memory_utils/memset_implementations.h
index c9d047c01044c..2640bd2077373 100644
--- a/libc/src/string/memory_utils/memset_implementations.h
+++ b/libc/src/string/memory_utils/memset_implementations.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMSET_IMPLEMENTATIONS_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMSET_IMPLEMENTATIONS_H
 
-#include "src/__support/architectures.h"
 #include "src/__support/common.h"
+#include "src/__support/macros/architectures.h"
 #include "src/string/memory_utils/op_aarch64.h"
 #include "src/string/memory_utils/op_builtin.h"
 #include "src/string/memory_utils/op_generic.h"
@@ -28,7 +28,7 @@ inline_memset_embedded_tiny(Ptr dst, uint8_t value, size_t count) {
     generic::Memset<1, 1>::block(dst + offset, value);
 }
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
 template <size_t MaxSize>
 [[maybe_unused]] LIBC_INLINE static void
 inline_memset_x86(Ptr dst, uint8_t value, size_t count) {
@@ -55,9 +55,9 @@ inline_memset_x86(Ptr dst, uint8_t value, size_t count) {
   align_to_next_boundary<32>(dst, count);
   return generic::Memset<32, MaxSize>::loop_and_tail(dst, value, count);
 }
-#endif // defined(LLVM_LIBC_ARCH_X86)
+#endif // defined(LIBC_TARGET_IS_X86)
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 template <size_t MaxSize>
 [[maybe_unused]] LIBC_INLINE static void
 inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
@@ -93,21 +93,21 @@ inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
     return generic::Memset<64, MaxSize>::loop_and_tail(dst, value, count);
   }
 }
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
 LIBC_INLINE static void inline_memset(Ptr dst, uint8_t value, size_t count) {
-#if defined(LLVM_LIBC_ARCH_X86)
+#if defined(LIBC_TARGET_IS_X86)
   static constexpr size_t kMaxSize = x86::kAvx512F ? 64
                                      : x86::kAvx   ? 32
                                      : x86::kSse2  ? 16
                                                    : 8;
   return inline_memset_x86<kMaxSize>(dst, value, count);
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   static constexpr size_t kMaxSize = aarch64::kNeon ? 16 : 8;
   return inline_memset_aarch64<kMaxSize>(dst, value, count);
-#elif defined(LLVM_LIBC_ARCH_ARM)
+#elif defined(LIBC_TARGET_IS_ARM)
   return inline_memset_embedded_tiny(dst, value, count);
-#elif defined(LLVM_LIBC_ARCH_GPU)
+#elif defined(LIBC_TARGET_IS_GPU)
   return inline_memset_embedded_tiny(dst, value, count);
 #else
 #error "Unsupported platform"

diff  --git a/libc/src/string/memory_utils/op_aarch64.h b/libc/src/string/memory_utils/op_aarch64.h
index 3d625c20c7624..ac0d956ce93db 100644
--- a/libc/src/string/memory_utils/op_aarch64.h
+++ b/libc/src/string/memory_utils/op_aarch64.h
@@ -13,9 +13,9 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_AARCH64_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_AARCH64_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
 
 #include "src/__support/common.h"
 #include "src/string/memory_utils/op_generic.h"
@@ -174,6 +174,6 @@ template <size_t Size> struct Bcmp {
 
 } // namespace __llvm_libc::aarch64
 
-#endif // LLVM_LIBC_ARCH_AARCH64
+#endif // LIBC_TARGET_IS_AARCH64
 
 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_AARCH64_H

diff  --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h
index 3d505fbd9d2c1..70d234d9c2bb2 100644
--- a/libc/src/string/memory_utils/op_generic.h
+++ b/libc/src/string/memory_utils/op_generic.h
@@ -123,7 +123,7 @@ static_assert((UINTPTR_MAX == 4294967295U) ||
                   (UINTPTR_MAX == 18446744073709551615UL),
               "We currently only support 32- or 64-bit platforms");
 
-#if defined(LLVM_LIBC_ARCH_X86_64) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86_64) || defined(LIBC_TARGET_IS_AARCH64)
 #define LLVM_LIBC_HAS_UINT64
 #endif
 

diff  --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index dd96e9c9aec1a..5310255dd652e 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -12,9 +12,9 @@
 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_X86_64)
+#if defined(LIBC_TARGET_IS_X86_64)
 
 #include "src/__support/common.h"
 #include "src/string/memory_utils/op_builtin.h"
@@ -269,6 +269,6 @@ template <size_t Size> using Memcmp = MemcmpImpl<Size, 64, memcmp64, bcmp64>;
 
 } // namespace __llvm_libc::x86
 
-#endif // LLVM_LIBC_ARCH_X86_64
+#endif // LIBC_TARGET_IS_X86_64
 
 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H

diff  --git a/libc/src/threads/linux/Futex.h b/libc/src/threads/linux/Futex.h
index fab1b6ddc74bd..80300921b36ac 100644
--- a/libc/src/threads/linux/Futex.h
+++ b/libc/src/threads/linux/Futex.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H
 #define LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H
 
-#include "src/__support/architectures.h" // Architecture macros
+#include "src/__support/macros/architectures.h" // Architecture macros
 
 namespace __llvm_libc {
 
-#if (defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_X86_64))
+#if (defined(LIBC_TARGET_IS_AARCH64) || defined(LIBC_TARGET_IS_X86_64))
 // The futex data has to be exactly 4 bytes long. However, we use a uint type
 // here as we do not want to use `uint32_t` type to match the public definitions
 // of types which include a field for a futex word. With public definitions, we

diff  --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp
index 75e3cdaa9da9c..c51a00c9b2d74 100644
--- a/libc/test/src/fenv/enabled_exceptions_test.cpp
+++ b/libc/test/src/fenv/enabled_exceptions_test.cpp
@@ -11,7 +11,7 @@
 #include "src/fenv/fetestexcept.h"
 
 #include "src/__support/FPUtil/FEnvImpl.h"
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 #include "utils/UnitTest/FPExceptMatcher.h"
 #include "utils/UnitTest/Test.h"
 
@@ -21,7 +21,7 @@
 // This test enables an exception and verifies that raising that exception
 // triggers SIGFPE.
 TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
   // Few aarch64 HW implementations do not trap exceptions. We skip this test
   // completely on such HW.
   //
@@ -33,7 +33,7 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
   __llvm_libc::fputil::enable_except(FE_DIVBYZERO);
   if (__llvm_libc::fputil::get_except() == 0)
     return;
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
   // TODO: Install a floating point exception handler and verify that the
   // the expected exception was raised. One will have to longjmp back from

diff  --git a/libc/test/src/fenv/feenableexcept_test.cpp b/libc/test/src/fenv/feenableexcept_test.cpp
index f1cb8a32ea677..910702f2b36f6 100644
--- a/libc/test/src/fenv/feenableexcept_test.cpp
+++ b/libc/test/src/fenv/feenableexcept_test.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 #include "src/fenv/fedisableexcept.h"
 #include "src/fenv/feenableexcept.h"
 #include "src/fenv/fegetexcept.h"
@@ -16,7 +16,7 @@
 #include <fenv.h>
 
 TEST(LlvmLibcFEnvTest, EnableTest) {
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
   // Few aarch64 HW implementations do not trap exceptions. We skip this test
   // completely on such HW.
   //
@@ -28,7 +28,7 @@ TEST(LlvmLibcFEnvTest, EnableTest) {
   __llvm_libc::feenableexcept(FE_DIVBYZERO);
   if (__llvm_libc::fegetexcept() == 0)
     return;
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
   int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
                    FE_UNDERFLOW};

diff  --git a/libc/test/src/fenv/feholdexcept_test.cpp b/libc/test/src/fenv/feholdexcept_test.cpp
index 99df0bb6dacf7..f3c4e12ac9447 100644
--- a/libc/test/src/fenv/feholdexcept_test.cpp
+++ b/libc/test/src/fenv/feholdexcept_test.cpp
@@ -9,14 +9,14 @@
 #include "src/fenv/feholdexcept.h"
 
 #include "src/__support/FPUtil/FEnvImpl.h"
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 #include "utils/UnitTest/FPExceptMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <fenv.h>
 
 TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_AARCH64)
   // Few aarch64 HW implementations do not trap exceptions. We skip this test
   // completely on such HW.
   //
@@ -28,7 +28,7 @@ TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
   __llvm_libc::fputil::enable_except(FE_DIVBYZERO);
   if (__llvm_libc::fputil::get_except() == 0)
     return;
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
+#endif // defined(LIBC_TARGET_IS_AARCH64)
 
   int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
                    FE_UNDERFLOW};

diff  --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp
index fdfe9d92ce096..8b54cfec7fca5 100644
--- a/libc/test/src/string/memory_utils/op_tests.cpp
+++ b/libc/test/src/string/memory_utils/op_tests.cpp
@@ -15,7 +15,7 @@
 
 #include <assert.h>
 
-#if defined(LLVM_LIBC_ARCH_X86_64) || defined(LLVM_LIBC_ARCH_AARCH64)
+#if defined(LIBC_TARGET_IS_X86_64) || defined(LIBC_TARGET_IS_AARCH64)
 #define LLVM_LIBC_HAS_UINT64
 #endif
 
@@ -200,7 +200,7 @@ using BcmpImplementations = testing::TypeList<
     x86::avx512bw::Bcmp<64>,  //
     x86::avx512bw::Bcmp<128>, //
 #endif
-#ifdef LLVM_LIBC_ARCH_AARCH64
+#ifdef LIBC_TARGET_IS_AARCH64
     aarch64::Bcmp<16>, //
     aarch64::Bcmp<32>, //
 #endif

diff  --git a/libc/test/src/sys/utsname/uname_test.cpp b/libc/test/src/sys/utsname/uname_test.cpp
index 1a1e4a77dae00..ffe63cfd3c5f4 100644
--- a/libc/test/src/sys/utsname/uname_test.cpp
+++ b/libc/test/src/sys/utsname/uname_test.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/CPP/string_view.h"
-#include "src/__support/architectures.h"
+#include "src/__support/macros/architectures.h"
 #include "src/sys/utsname/uname.h"
 #include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
@@ -18,9 +18,9 @@
 TEST(LlvmLibcUnameTest, GetMachineName) {
   struct utsname names;
   ASSERT_GE(__llvm_libc::uname(&names), 0);
-#ifdef LLVM_LIBC_ARCH_X86_64
+#ifdef LIBC_TARGET_IS_X86_64
   ASSERT_STREQ(names.machine, "x86_64");
-#elif defined(LLVM_LIBC_ARCH_AARCH64)
+#elif defined(LIBC_TARGET_IS_AARCH64)
   ASSERT_STREQ(names.machine, "aarch64");
 #endif
 }

diff  --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 9b189df152bef..4e243602cd79c 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -77,7 +77,7 @@ libc_support_library(
 libc_support_library(
     name = "__support_common",
     hdrs = [
-        "src/__support/architectures.h",
+        "src/__support/macros/architectures.h",
         "src/__support/common.h",
         "src/__support/cpu_features.h",
         "src/__support/endian.h",


        


More information about the libc-commits mailing list