Skip to content

Commit 2c976a1

Browse files
authored
[libc] Fix _Float16 detection for x86 (#73947)
1 parent 1726b65 commit 2c976a1

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

libc/src/__support/macros/properties/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ add_header_library(
3131
DEPENDS
3232
.architectures
3333
.compiler
34+
.cpu_features
3435
.os
3536
)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "src/__support/macros/properties/architectures.h"
1515
#include "src/__support/macros/properties/compiler.h"
16+
#include "src/__support/macros/properties/cpu_features.h"
1617
#include "src/__support/macros/properties/os.h"
1718

1819
#include <float.h> // LDBL_MANT_DIG
@@ -30,7 +31,7 @@
3031
#endif
3132

3233
// float16 support.
33-
#if defined(LIBC_TARGET_ARCH_IS_X86_64)
34+
#if defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2)
3435
#if (defined(LIBC_COMPILER_CLANG_VER) && (LIBC_COMPILER_CLANG_VER >= 1500)) || \
3536
(defined(LIBC_COMPILER_GCC_VER) && (LIBC_COMPILER_GCC_VER >= 1201))
3637
#define LIBC_COMPILER_HAS_C23_FLOAT16

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ libc_support_library(
8686
deps = [
8787
":__support_macros_properties_architectures",
8888
":__support_macros_properties_compiler",
89+
":__support_macros_properties_cpu_features",
8990
":__support_macros_properties_os",
9091
],
9192
)

0 commit comments

Comments
 (0)