Skip to content

Commit d5d24c6

Browse files
committed
fixup! [libc][math][c23] Add fabsf16 C23 math function
Fix llvm-libc-types/float16.h including internal header and exposing internal C++ using float16 stmt.
1 parent c651c80 commit d5d24c6

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- Definition of float16 type ----------------------------------------===//
1+
//===-- Detection of _Float16 compiler builtin type -----------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,12 +9,9 @@
99
#ifndef LLVM_LIBC_TYPES_FLOAT16_H
1010
#define LLVM_LIBC_TYPES_FLOAT16_H
1111

12-
#include "src/__support/macros/properties/compiler.h"
13-
1412
#if defined(__FLT16_MANT_DIG__) && \
15-
(!defined(LIBC_COMPILER_IS_GCC) || LIBC_COMPILER_GCC_VER >= 1301)
13+
(!defined(__GNUC__) || __GNUC__ >= 13 || defined(__clang__))
1614
#define LIBC_TYPES_HAS_FLOAT16
17-
using float16 = _Float16;
1815
#endif
1916

2017
#endif // LLVM_LIBC_TYPES_FLOAT16_H

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "hdr/float_macros.h" // LDBL_MANT_DIG
1414
#include "include/llvm-libc-types/float128.h" // float128
15-
#include "include/llvm-libc-types/float16.h" // float16
15+
#include "include/llvm-libc-types/float16.h" // LIBC_TYPES_HAS_FLOAT16
1616
#include "src/__support/macros/properties/architectures.h"
1717
#include "src/__support/macros/properties/compiler.h"
1818
#include "src/__support/macros/properties/cpu_features.h"
@@ -40,8 +40,11 @@
4040
#endif // defined(__SIZEOF_INT128__)
4141

4242
// -- float16 support ---------------------------------------------------------
43-
// LIBC_TYPES_HAS_FLOAT16 and 'float16' type are provided by
44-
// "include/llvm-libc-types/float16.h"
43+
// LIBC_TYPES_HAS_FLOAT16 is provided by "include/llvm-libc-types/float16.h"
44+
#ifdef LIBC_TYPES_HAS_FLOAT16
45+
// Type alias for internal use.
46+
using float16 = _Float16;
47+
#endif // LIBC_TYPES_HAS_FLOAT16
4548

4649
// -- float128 support --------------------------------------------------------
4750
// LIBC_TYPES_HAS_FLOAT128 and 'float128' type are provided by

libc/src/math/fabsf16.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_LIBC_SRC_MATH_FABSF16_H
1010
#define LLVM_LIBC_SRC_MATH_FABSF16_H
1111

12-
#include "include/llvm-libc-types/float16.h"
12+
#include "src/__support/macros/properties/types.h"
1313

1414
namespace LIBC_NAMESPACE {
1515

0 commit comments

Comments
 (0)