Skip to content

Commit a2569a7

Browse files
committed
[libc][NFC] Rename macros
1 parent e2263f1 commit a2569a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+155
-150
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_AVX2
3+
#ifndef LIBC_TARGET_CPU_HAS_AVX2
44
#error unsupported
55
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_AVX512BW
3+
#ifndef LIBC_TARGET_CPU_HAS_AVX512BW
44
#error unsupported
55
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_AVX512F
3+
#ifndef LIBC_TARGET_CPU_HAS_AVX512F
44
#error unsupported
55
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_FMA
3+
#ifndef LIBC_TARGET_CPU_HAS_FMA
44
#error unsupported
55
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_SSE2
3+
#ifndef LIBC_TARGET_CPU_HAS_SSE2
44
#error unsupported
55
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/cpu_features.h"
22

3-
#ifndef LIBC_TARGET_HAS_SSE4_2
3+
#ifndef LIBC_TARGET_CPU_HAS_SSE4_2
44
#error unsupported
55
#endif

libc/config/linux/app.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct TLSImage {
3535
uintptr_t align;
3636
};
3737

38-
#if defined(LIBC_TARGET_IS_X86_64) || defined(LIBC_TARGET_IS_AARCH64)
38+
#if defined(LIBC_TARGET_ARCH_IS_X86_64) || defined(LIBC_TARGET_ARCH_IS_AARCH64)
3939
// At the language level, argc is an int. But we use uint64_t as the x86_64
4040
// ABI specifies it as an 8 byte value. Likewise, in the ARM64 ABI, arguments
4141
// are usually passed in registers. x0 is a doubleword register, so this is

libc/docs/code_style.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ We define two kinds of macros: **code defined** and **build defined** macros.
3939

4040
* **Properties** - Build related properties like used compiler, target
4141
architecture or enabled CPU features defined by introspecting compiler
42-
defined preprocessor defininitions. e.g., ``LIBC_TARGET_IS_ARM``,
43-
``LIBC_TARGET_HAS_AVX2``, ``LIBC_COMPILER_IS_CLANG``, ...
42+
defined preprocessor defininitions. e.g., ``LIBC_TARGET_ARCH_IS_ARM``,
43+
``LIBC_TARGET_CPU_HAS_AVX2``, ``LIBC_COMPILER_IS_CLANG``, ...
4444
* **Attributes** - Compiler agnostic attributes or functions to handle
4545
specific operations. e.g., ``LIBC_INLINE``, ``LIBC_NO_LOOP_UNROLL``,
4646
``LIBC_LIKELY``, ``LIBC_INLINE_ASM``.

libc/src/__support/FPUtil/FEnvImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if defined(LIBC_TARGET_IS_AARCH64)
15+
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
1616
#if defined(__APPLE__)
1717
#include "aarch64/fenv_darwin_impl.h"
1818
#else
1919
#include "aarch64/FEnvImpl.h"
2020
#endif
21-
#elif defined(LIBC_TARGET_IS_X86)
21+
#elif defined(LIBC_TARGET_ARCH_IS_X86)
2222
#include "x86_64/FEnvImpl.h"
2323
#else
2424
#include <fenv.h>

libc/src/__support/FPUtil/FMA.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#include "src/__support/macros/architectures.h"
1414
#include "src/__support/macros/cpu_features.h"
1515

16-
#if defined(LIBC_TARGET_HAS_FMA)
16+
#if defined(LIBC_TARGET_CPU_HAS_FMA)
1717

18-
#if defined(LIBC_TARGET_IS_X86_64)
18+
#if defined(LIBC_TARGET_ARCH_IS_X86_64)
1919
#include "x86_64/FMA.h"
20-
#elif defined(LIBC_TARGET_IS_AARCH64)
20+
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
2121
#include "aarch64/FMA.h"
2222
#endif
2323

libc/src/__support/FPUtil/PlatformDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "src/__support/macros/architectures.h"
1313

14-
#if defined(LIBC_TARGET_IS_X86)
14+
#if defined(LIBC_TARGET_ARCH_IS_X86)
1515
#define X87_FPU
1616
#endif
1717

libc/src/__support/FPUtil/aarch64/FEnvImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_AARCH64) || defined(__APPLE__)
15+
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(__APPLE__)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/aarch64/FMA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include "src/__support/macros/architectures.h"
1313
#include "src/__support/macros/cpu_features.h"
1414

15-
#if !defined(LIBC_TARGET_IS_AARCH64)
15+
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64)
1616
#error "Invalid include"
1717
#endif
1818

19-
#if !defined(LIBC_TARGET_HAS_FMA)
19+
#if !defined(LIBC_TARGET_CPU_HAS_FMA)
2020
#error "FMA instructions are not supported"
2121
#endif
2222

libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_AARCH64) || !defined(__APPLE__)
15+
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || !defined(__APPLE__)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/aarch64/nearest_integer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_AARCH64)
15+
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/aarch64/sqrt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_AARCH64)
15+
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/multiply_add.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ template <typename T> LIBC_INLINE T multiply_add(T x, T y, T z) {
2727
} // namespace fputil
2828
} // namespace __llvm_libc
2929

30-
#if defined(LIBC_TARGET_HAS_FMA)
30+
#if defined(LIBC_TARGET_CPU_HAS_FMA)
3131

3232
// FMA instructions are available.
3333
#include "FMA.h"
@@ -47,6 +47,6 @@ LIBC_INLINE double multiply_add<double>(double x, double y, double z) {
4747
} // namespace fputil
4848
} // namespace __llvm_libc
4949

50-
#endif // LIBC_TARGET_HAS_FMA
50+
#endif // LIBC_TARGET_CPU_HAS_FMA
5151

5252
#endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_MULTIPLY_ADD_H

libc/src/__support/FPUtil/nearest_integer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
14+
#include "src/__support/macros/cpu_features.h"
1415

15-
#if (defined(LIBC_TARGET_IS_X86_64) && defined(__SSE4_2__))
16+
#if (defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE4_2))
1617
#include "x86_64/nearest_integer.h"
17-
#elif defined(LIBC_TARGET_IS_AARCH64)
18+
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
1819
#include "aarch64/nearest_integer.h"
1920
#else
2021

libc/src/__support/FPUtil/sqrt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
#include "src/__support/macros/architectures.h"
1313

14-
#if defined(LIBC_TARGET_IS_X86_64)
14+
#if defined(LIBC_TARGET_ARCH_IS_X86_64)
1515
#include "x86_64/sqrt.h"
16-
#elif defined(LIBC_TARGET_IS_AARCH64)
16+
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
1717
#include "aarch64/sqrt.h"
1818
#else
1919
#include "generic/sqrt.h"

libc/src/__support/FPUtil/x86_64/FEnvImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "src/__support/macros/architectures.h"
1313

14-
#if !defined(LIBC_TARGET_IS_X86)
14+
#if !defined(LIBC_TARGET_ARCH_IS_X86)
1515
#error "Invalid include"
1616
#endif
1717

libc/src/__support/FPUtil/x86_64/FMA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#include "src/__support/macros/architectures.h"
1414
#include "src/__support/macros/cpu_features.h"
1515

16-
#if !defined(LIBC_TARGET_IS_X86_64)
16+
#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
1717
#error "Invalid include"
1818
#endif
1919

20-
#if !defined(LIBC_TARGET_HAS_FMA)
20+
#if !defined(LIBC_TARGET_CPU_HAS_FMA)
2121
#error "FMA instructions are not supported"
2222
#endif
2323

libc/src/__support/FPUtil/x86_64/LongDoubleBits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "src/__support/common.h"
1515
#include "src/__support/macros/architectures.h"
1616

17-
#if !defined(LIBC_TARGET_IS_X86)
17+
#if !defined(LIBC_TARGET_ARCH_IS_X86)
1818
#error "Invalid include"
1919
#endif
2020

libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "src/__support/macros/architectures.h"
1313

14-
#if !defined(LIBC_TARGET_IS_X86)
14+
#if !defined(LIBC_TARGET_ARCH_IS_X86)
1515
#error "Invalid include"
1616
#endif
1717

libc/src/__support/FPUtil/x86_64/PolyEval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_X86_64)
15+
#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/x86_64/nearest_integer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_X86_64)
15+
#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/FPUtil/x86_64/sqrt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#if !defined(LIBC_TARGET_IS_X86)
15+
#if !defined(LIBC_TARGET_ARCH_IS_X86)
1616
#error "Invalid include"
1717
#endif
1818

libc/src/__support/OSUtil/linux/syscall.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/architectures.h"
1414

15-
#ifdef LIBC_TARGET_IS_X86_64
15+
#ifdef LIBC_TARGET_ARCH_IS_X86_64
1616
#include "x86_64/syscall.h"
17-
#elif defined(LIBC_TARGET_IS_AARCH64)
17+
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
1818
#include "aarch64/syscall.h"
19-
#elif defined(LIBC_TARGET_IS_ARM)
19+
#elif defined(LIBC_TARGET_ARCH_IS_ARM)
2020
#include "arm/syscall.h"
2121
#endif
2222

libc/src/__support/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#endif
1818

1919
// GPU targets do not support aliasing.
20-
#if defined(LLVM_LIBC_PUBLIC_PACKAGING) && defined(LIBC_TARGET_IS_GPU)
20+
#if defined(LLVM_LIBC_PUBLIC_PACKAGING) && defined(LIBC_TARGET_ARCH_IS_GPU)
2121
#define LLVM_LIBC_FUNCTION(type, name, arglist) \
2222
LLVM_LIBC_FUNCTION_ATTR decltype(__llvm_libc::name) \
2323
__##name##_impl__ __asm__(#name); \

libc/src/__support/macros/architectures.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,43 @@
1010
#define LLVM_LIBC_SUPPORT_MACROS_ARCHITECTURES_H
1111

1212
#if defined(__AMDGPU__)
13-
#define LIBC_TARGET_IS_AMDGPU
13+
#define LIBC_TARGET_ARCH_IS_AMDGPU
1414
#endif
1515

1616
#if defined(__NVPTX__)
17-
#define LIBC_TARGET_IS_NVPTX
17+
#define LIBC_TARGET_ARCH_IS_NVPTX
1818
#endif
1919

20-
#if defined(LIBC_TARGET_IS_NVPTX) || defined(LIBC_TARGET_IS_AMDGPU)
21-
#define LIBC_TARGET_IS_GPU
20+
#if defined(LIBC_TARGET_ARCH_IS_NVPTX) || defined(LIBC_TARGET_ARCH_IS_AMDGPU)
21+
#define LIBC_TARGET_ARCH_IS_GPU
2222
#endif
2323

24-
#if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_IS_GPU)
25-
#define LIBC_TARGET_IS_VM
24+
#if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
25+
#define LIBC_TARGET_ARCH_IS_VM
2626
#endif
2727

28-
#if (defined(_M_IX86) || defined(__i386__)) && !defined(LIBC_TARGET_IS_VM)
29-
#define LIBC_TARGET_IS_X86_32
28+
#if (defined(_M_IX86) || defined(__i386__)) && !defined(LIBC_TARGET_ARCH_IS_VM)
29+
#define LIBC_TARGET_ARCH_IS_X86_32
3030
#endif
3131

32-
#if (defined(_M_X64) || defined(__x86_64__)) && !defined(LIBC_TARGET_IS_VM)
33-
#define LIBC_TARGET_IS_X86_64
32+
#if (defined(_M_X64) || defined(__x86_64__)) && !defined(LIBC_TARGET_ARCH_IS_VM)
33+
#define LIBC_TARGET_ARCH_IS_X86_64
3434
#endif
3535

36-
#if defined(LIBC_TARGET_IS_X86_32) || defined(LIBC_TARGET_IS_X86_64)
37-
#define LIBC_TARGET_IS_X86
36+
#if defined(LIBC_TARGET_ARCH_IS_X86_32) || defined(LIBC_TARGET_ARCH_IS_X86_64)
37+
#define LIBC_TARGET_ARCH_IS_X86
3838
#endif
3939

4040
#if (defined(__arm__) || defined(_M_ARM))
41-
#define LIBC_TARGET_IS_ARM
41+
#define LIBC_TARGET_ARCH_IS_ARM
4242
#endif
4343

4444
#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
45-
#define LIBC_TARGET_IS_AARCH64
45+
#define LIBC_TARGET_ARCH_IS_AARCH64
4646
#endif
4747

48-
#if (defined(LIBC_TARGET_IS_AARCH64) || defined(LIBC_TARGET_IS_ARM))
49-
#define LIBC_TARGET_IS_ANY_ARM
48+
#if (defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(LIBC_TARGET_ARCH_IS_ARM))
49+
#define LIBC_TARGET_ARCH_IS_ANY_ARM
5050
#endif
5151

5252
#endif // LLVM_LIBC_SUPPORT_MACROS_ARCHITECTURES_H

libc/src/__support/macros/cpu_features.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313
#define LLVM_LIBC_SRC_SUPPORT_MACROS_CPU_FEATURES_H
1414

1515
#if defined(__SSE2__)
16-
#define LIBC_TARGET_HAS_SSE2
16+
#define LIBC_TARGET_CPU_HAS_SSE2
1717
#endif
1818

1919
#if defined(__SSE4_2__)
20-
#define LIBC_TARGET_HAS_SSE4_2
20+
#define LIBC_TARGET_CPU_HAS_SSE4_2
2121
#endif
2222

2323
#if defined(__AVX__)
24-
#define LIBC_TARGET_HAS_AVX
24+
#define LIBC_TARGET_CPU_HAS_AVX
2525
#endif
2626

2727
#if defined(__AVX2__)
28-
#define LIBC_TARGET_HAS_AVX2
28+
#define LIBC_TARGET_CPU_HAS_AVX2
2929
#endif
3030

3131
#if defined(__AVX512F__)
32-
#define LIBC_TARGET_HAS_AVX512F
32+
#define LIBC_TARGET_CPU_HAS_AVX512F
3333
#endif
3434

3535
#if defined(__AVX512BW__)
36-
#define LIBC_TARGET_HAS_AVX512BW
36+
#define LIBC_TARGET_CPU_HAS_AVX512BW
3737
#endif
3838

3939
#if defined(__ARM_FEATURE_FMA) || defined(__AVX2__) || defined(__FMA__)
40-
#define LIBC_TARGET_HAS_FMA
40+
#define LIBC_TARGET_CPU_HAS_FMA
4141
#endif
4242

4343
#endif // LLVM_LIBC_SRC_SUPPORT_MACROS_CPU_FEATURES_H

0 commit comments

Comments
 (0)