37 lines · c
1//===-- Definition of float128 type ---------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_TYPES_FLOAT128_H10#define LLVM_LIBC_TYPES_FLOAT128_H11 12#include "../llvm-libc-macros/float-macros.h" // LDBL_MANT_DIG13 14// Currently, C23 `_Float128` type is only defined as a built-in type in GCC 715// or later, and only for C. For C++, or for clang, `__float128` is defined16// instead, and only on x86-64 targets.17//18// TODO: Update C23 `_Float128` type detection again when clang supports it.19// https://github.com/llvm/llvm-project/issues/8019520#if defined(__STDC_IEC_60559_BFP__) && !defined(__clang__) && \21 !defined(__cplusplus)22#define LIBC_TYPES_HAS_FLOAT12823typedef _Float128 float128;24#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)25// Use __float128 type. gcc and clang sometime use __SIZEOF_FLOAT128__ to26// notify the availability of __float128.27// clang also uses __FLOAT128__ macro to notify the availability of __float12828// type: https://reviews.llvm.org/D1512029#define LIBC_TYPES_HAS_FLOAT12830typedef __float128 float128;31#elif (LDBL_MANT_DIG == 113)32#define LIBC_TYPES_HAS_FLOAT12833typedef long double float128;34#endif35 36#endif // LLVM_LIBC_TYPES_FLOAT128_H37