Skip to content

Commit 75fb825

Browse files
authored
[libc][NFC] Rename LIBC_COMPILER_HAS_FLOAT128 to LIBC_TYPES_HAS_FLOAT128 (#83395)
Umbrella bug #83182
1 parent 21be2fb commit 75fb825

File tree

12 files changed

+32
-37
lines changed

12 files changed

+32
-37
lines changed

libc/cmake/modules/CheckCompilerFeatures.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ foreach(feature IN LISTS ALL_COMPILER_FEATURES)
5555
if(has_feature)
5656
list(APPEND AVAILABLE_COMPILER_FEATURES ${feature})
5757
if(${feature} STREQUAL "float128")
58-
set(LIBC_COMPILER_HAS_FLOAT128 TRUE)
58+
set(LIBC_TYPES_HAS_FLOAT128 TRUE)
5959
elseif(${feature} STREQUAL "fixed_point")
6060
set(LIBC_COMPILER_HAS_FIXED_POINT TRUE)
6161
endif()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "src/__support/macros/properties/types.h"
22

3-
#ifndef LIBC_COMPILER_HAS_FLOAT128
3+
#ifndef LIBC_TYPES_HAS_FLOAT128
44
#error unsupported
55
#endif

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ set(TARGET_LIBM_ENTRYPOINTS
414414
libc.src.math.truncl
415415
)
416416

417-
if(LIBC_COMPILER_HAS_FLOAT128)
417+
if(LIBC_TYPES_HAS_FLOAT128)
418418
list(APPEND TARGET_LIBM_ENTRYPOINTS
419419
# math.h C23 _Float128 entrypoints
420420
libc.src.math.ceilf128

libc/config/linux/riscv/entrypoints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ set(TARGET_LIBM_ENTRYPOINTS
423423
libc.src.math.truncl
424424
)
425425

426-
if(LIBC_COMPILER_HAS_FLOAT128)
426+
if(LIBC_TYPES_HAS_FLOAT128)
427427
list(APPEND TARGET_LIBM_ENTRYPOINTS
428428
# math.h C23 _Float128 entrypoints
429429
libc.src.math.ceilf128

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ set(TARGET_LIBM_ENTRYPOINTS
442442
libc.src.math.truncl
443443
)
444444

445-
if(LIBC_COMPILER_HAS_FLOAT128)
445+
if(LIBC_TYPES_HAS_FLOAT128)
446446
list(APPEND TARGET_LIBM_ENTRYPOINTS
447447
# math.h C23 _Float128 entrypoints
448448
libc.src.math.ceilf128

libc/docs/dev/code_style.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ We define two kinds of macros:
4848
* ``cpu_features.h`` - Target cpu feature availability.
4949
e.g., ``LIBC_TARGET_CPU_HAS_AVX2``.
5050
* ``types.h`` - Type properties and availability.
51-
e.g., ``LIBC_COMPILER_HAS_FLOAT128``.
51+
e.g., ``LIBC_TYPES_HAS_FLOAT128``.
5252
* ``os.h`` - Target os properties.
5353
e.g., ``LIBC_TARGET_OS_IS_LINUX``.
5454

libc/spec/stdc.td

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,37 +364,37 @@ def StdC : StandardSpec<"stdc"> {
364364
FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
365365
FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
366366
FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
367-
GuardedFunctionSpec<"copysignf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
367+
GuardedFunctionSpec<"copysignf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
368368

369369
FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
370370
FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
371371
FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
372-
GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
372+
GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
373373

374374
FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
375375
FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
376376
FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
377-
GuardedFunctionSpec<"fabsf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
377+
GuardedFunctionSpec<"fabsf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
378378

379379
FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
380380
FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
381381
FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
382-
GuardedFunctionSpec<"fdimf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
382+
GuardedFunctionSpec<"fdimf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
383383

384384
FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
385385
FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
386386
FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
387-
GuardedFunctionSpec<"floorf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
387+
GuardedFunctionSpec<"floorf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
388388

389389
FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
390390
FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
391391
FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
392-
GuardedFunctionSpec<"fminf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
392+
GuardedFunctionSpec<"fminf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
393393

394394
FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
395395
FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
396396
FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
397-
GuardedFunctionSpec<"fmaxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
397+
GuardedFunctionSpec<"fmaxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
398398

399399
FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
400400
FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
@@ -406,25 +406,25 @@ def StdC : StandardSpec<"stdc"> {
406406
FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
407407
FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
408408
FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
409-
GuardedFunctionSpec<"frexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntPtr>], "LIBC_COMPILER_HAS_FLOAT128">,
409+
GuardedFunctionSpec<"frexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT128">,
410410

411411
FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
412412
FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
413413

414414
FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
415415
FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
416416
FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
417-
GuardedFunctionSpec<"ilogbf128", RetValSpec<IntType>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
417+
GuardedFunctionSpec<"ilogbf128", RetValSpec<IntType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
418418

419419
FunctionSpec<"llogb", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
420420
FunctionSpec<"llogbf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
421421
FunctionSpec<"llogbl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
422-
GuardedFunctionSpec<"llogbf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
422+
GuardedFunctionSpec<"llogbf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
423423

424424
FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
425425
FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
426426
FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
427-
GuardedFunctionSpec<"ldexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FLOAT128">,
427+
GuardedFunctionSpec<"ldexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT128">,
428428

429429
FunctionSpec<"log10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
430430
FunctionSpec<"log10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
@@ -441,7 +441,7 @@ def StdC : StandardSpec<"stdc"> {
441441
FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
442442
FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
443443
FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
444-
GuardedFunctionSpec<"logbf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
444+
GuardedFunctionSpec<"logbf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
445445

446446
FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>,
447447
FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>,
@@ -476,7 +476,7 @@ def StdC : StandardSpec<"stdc"> {
476476
FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
477477
FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
478478
FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
479-
GuardedFunctionSpec<"roundf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
479+
GuardedFunctionSpec<"roundf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
480480

481481
FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
482482
FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
@@ -501,12 +501,12 @@ def StdC : StandardSpec<"stdc"> {
501501
FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
502502
FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
503503
FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
504-
GuardedFunctionSpec<"sqrtf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
504+
GuardedFunctionSpec<"sqrtf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
505505

506506
FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
507507
FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
508508
FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
509-
GuardedFunctionSpec<"truncf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_COMPILER_HAS_FLOAT128">,
509+
GuardedFunctionSpec<"truncf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
510510

511511
FunctionSpec<"nearbyint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
512512
FunctionSpec<"nearbyintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,

libc/src/__support/CPP/type_traits/is_floating_point.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "src/__support/CPP/type_traits/is_same.h"
1212
#include "src/__support/CPP/type_traits/remove_cv.h"
1313
#include "src/__support/macros/attributes.h"
14-
#include "src/__support/macros/properties/types.h"
14+
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_FLOAT128
1515

1616
namespace LIBC_NAMESPACE::cpp {
1717

@@ -24,13 +24,13 @@ template <typename T> struct is_floating_point {
2424
}
2525

2626
public:
27-
#if defined(LIBC_COMPILER_HAS_FLOAT128)
27+
#if defined(LIBC_TYPES_HAS_FLOAT128)
2828
LIBC_INLINE_VAR static constexpr bool value =
2929
__is_unqualified_any_of<T, float, double, long double, float128>();
3030
#else
3131
LIBC_INLINE_VAR static constexpr bool value =
3232
__is_unqualified_any_of<T, float, double, long double>();
33-
#endif // LIBC_COMPILER_HAS_FLOAT128
33+
#endif // LIBC_TYPES_HAS_FLOAT128
3434
};
3535
template <typename T>
3636
LIBC_INLINE_VAR constexpr bool is_floating_point_v =

libc/src/__support/FPUtil/FPBits.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "src/__support/common.h"
1616
#include "src/__support/libc_assert.h" // LIBC_ASSERT
1717
#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
18-
#include "src/__support/macros/properties/types.h" // LIBC_COMPILER_HAS_FLOAT128
18+
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_FLOAT128
1919
#include "src/__support/math_extras.h" // mask_trailing_ones
2020

2121
#include <stdint.h>
@@ -808,12 +808,8 @@ template <typename T> LIBC_INLINE static constexpr FPType get_fp_type() {
808808
else if constexpr (cpp::is_same_v<UnqualT, float16>)
809809
return FPType::IEEE754_Binary16;
810810
#endif
811-
#if defined(LIBC_COMPILER_HAS_C23_FLOAT128)
812-
else if constexpr (cpp::is_same_v<UnqualT, _Float128>)
813-
return FPType::IEEE754_Binary128;
814-
#endif
815-
#if defined(LIBC_COMPILER_HAS_FLOAT128_EXTENSION)
816-
else if constexpr (cpp::is_same_v<UnqualT, __float128>)
811+
#if defined(LIBC_TYPES_HAS_FLOAT128)
812+
else if constexpr (cpp::is_same_v<UnqualT, float128>)
817813
return FPType::IEEE754_Binary128;
818814
#endif
819815
else

libc/src/__support/macros/properties/types.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ using float16 = _Float16;
5454
#if defined(LIBC_COMPILER_HAS_C23_FLOAT128) || \
5555
defined(LIBC_COMPILER_HAS_FLOAT128_EXTENSION) || \
5656
defined(LIBC_LONG_DOUBLE_IS_FLOAT128)
57-
// TODO: Replace with LIBC_HAS_FLOAT128
58-
#define LIBC_COMPILER_HAS_FLOAT128
57+
#define LIBC_TYPES_HAS_FLOAT128
5958
#endif
6059

6160
#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H

libc/test/src/__support/FPUtil/fpbits_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
575575
}
576576
#endif
577577

578-
#if defined(LIBC_COMPILER_HAS_FLOAT128)
578+
#if defined(LIBC_TYPES_HAS_FLOAT128)
579579
TEST(LlvmLibcFPBitsTest, Float128Type) {
580580
using Float128Bits = FPBits<float128>;
581581

@@ -643,4 +643,4 @@ TEST(LlvmLibcFPBitsTest, Float128Type) {
643643
Float128Bits quiet_nan = Float128Bits::quiet_nan();
644644
EXPECT_EQ(quiet_nan.is_quiet_nan(), true);
645645
}
646-
#endif // LIBC_COMPILER_HAS_FLOAT128
646+
#endif // LIBC_TYPES_HAS_FLOAT128

libc/test/src/__support/uint_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TEST(LlvmLibcUIntClassTest, BitCastToFromNativeUint128) {
5454
}
5555
#endif
5656

57-
#ifdef LIBC_COMPILER_HAS_FLOAT128
57+
#ifdef LIBC_TYPES_HAS_FLOAT128
5858
TEST(LlvmLibcUIntClassTest, BitCastToFromNativeFloat128) {
5959
static_assert(cpp::is_trivially_copyable<LL_UInt128>::value);
6060
static_assert(sizeof(LL_UInt128) == sizeof(float128));
@@ -65,7 +65,7 @@ TEST(LlvmLibcUIntClassTest, BitCastToFromNativeFloat128) {
6565
EXPECT_TRUE(value == forth);
6666
}
6767
}
68-
#endif
68+
#endif // LIBC_TYPES_HAS_FLOAT128
6969

7070
TEST(LlvmLibcUIntClassTest, BasicInit) {
7171
LL_UInt128 half_val(12345);

0 commit comments

Comments
 (0)