Compare commits
6 commits
main
...
upstream/u
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfd7f8bbeb | ||
|
|
1984097bcf | ||
|
|
01d882a741 | ||
|
|
63d6e8d99e | ||
|
|
e2564f080a | ||
|
|
8fd4c22272 |
27 changed files with 948 additions and 0 deletions
|
|
@ -288,6 +288,9 @@ if(COMPILER_RT_USE_LIBC_MATH)
|
|||
use_libc_builtin(GENERIC_SOURCES adddf3)
|
||||
use_libc_builtin(GENERIC_SOURCES addsf3)
|
||||
use_libc_builtin(GENERIC_TF_SOURCES addtf3)
|
||||
use_libc_builtin(GENERIC_SOURCES comparedf2)
|
||||
use_libc_builtin(GENERIC_SOURCES comparesf2)
|
||||
use_libc_builtin(GENERIC_TF_SOURCES comparetf2)
|
||||
use_libc_builtin(GENERIC_SOURCES divdf3)
|
||||
use_libc_builtin(GENERIC_SOURCES divsf3)
|
||||
use_libc_builtin(GENERIC_TF_SOURCES divtf3)
|
||||
|
|
|
|||
54
compiler-rt/lib/builtins/comparedf2.cpp
Normal file
54
compiler-rt/lib/builtins/comparedf2.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This file implements compiler-rt's double comparison routines
|
||||
/// (__ledf2/__gedf2/__unorddf2 and their aliases) on top of LLVM-libc's shared
|
||||
/// comparison builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DOUBLE_PRECISION
|
||||
#include "fp_lib.h"
|
||||
|
||||
#include "fp_compare_impl.inc"
|
||||
#include "fp_libc_config.h"
|
||||
#include "shared/builtins/gedf2.h"
|
||||
#include "shared/builtins/ledf2.h"
|
||||
#include "shared/builtins/unorddf2.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __ledf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::ledf2(a, b);
|
||||
}
|
||||
#if defined(__ELF__)
|
||||
COMPILER_RT_ALIAS(__ledf2, __cmpdf2)
|
||||
#endif
|
||||
COMPILER_RT_ALIAS(__ledf2, __eqdf2)
|
||||
COMPILER_RT_ALIAS(__ledf2, __ltdf2)
|
||||
COMPILER_RT_ALIAS(__ledf2, __nedf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __gedf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::gedf2(a, b);
|
||||
}
|
||||
COMPILER_RT_ALIAS(__gedf2, __gtdf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __unorddf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::unorddf2(a, b);
|
||||
}
|
||||
|
||||
#if defined(__ARM_EABI__)
|
||||
#if defined(COMPILER_RT_ARMHF_TARGET)
|
||||
AEABI_RTABI int __aeabi_dcmpun(fp_t a, fp_t b) { return __unorddf2(a, b); }
|
||||
#else
|
||||
COMPILER_RT_ALIAS(__unorddf2, __aeabi_dcmpun)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
54
compiler-rt/lib/builtins/comparesf2.cpp
Normal file
54
compiler-rt/lib/builtins/comparesf2.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This file implements compiler-rt's float comparison routines
|
||||
/// (__lesf2/__gesf2/__unordsf2 and their aliases) on top of LLVM-libc's shared
|
||||
/// comparison builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define SINGLE_PRECISION
|
||||
#include "fp_lib.h"
|
||||
|
||||
#include "fp_compare_impl.inc"
|
||||
#include "fp_libc_config.h"
|
||||
#include "shared/builtins/gesf2.h"
|
||||
#include "shared/builtins/lesf2.h"
|
||||
#include "shared/builtins/unordsf2.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __lesf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::lesf2(a, b);
|
||||
}
|
||||
#if defined(__ELF__)
|
||||
COMPILER_RT_ALIAS(__lesf2, __cmpsf2)
|
||||
#endif
|
||||
COMPILER_RT_ALIAS(__lesf2, __eqsf2)
|
||||
COMPILER_RT_ALIAS(__lesf2, __ltsf2)
|
||||
COMPILER_RT_ALIAS(__lesf2, __nesf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __gesf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::gesf2(a, b);
|
||||
}
|
||||
COMPILER_RT_ALIAS(__gesf2, __gtsf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __unordsf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::unordsf2(a, b);
|
||||
}
|
||||
|
||||
#if defined(__ARM_EABI__)
|
||||
#if defined(COMPILER_RT_ARMHF_TARGET)
|
||||
AEABI_RTABI int __aeabi_fcmpun(fp_t a, fp_t b) { return __unordsf2(a, b); }
|
||||
#else
|
||||
COMPILER_RT_ALIAS(__unordsf2, __aeabi_fcmpun)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
49
compiler-rt/lib/builtins/comparetf2.cpp
Normal file
49
compiler-rt/lib/builtins/comparetf2.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This file implements compiler-rt's float128 comparison routines
|
||||
/// (__letf2/__getf2/__unordtf2 and their aliases) on top of LLVM-libc's shared
|
||||
/// comparison builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define QUAD_PRECISION
|
||||
#include "fp_lib.h"
|
||||
|
||||
#if defined(CRT_HAS_TF_MODE)
|
||||
#include "fp_compare_impl.inc"
|
||||
#include "fp_libc_config.h"
|
||||
#include "shared/builtins/getf2.h"
|
||||
#include "shared/builtins/letf2.h"
|
||||
#include "shared/builtins/unordtf2.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __letf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::letf2(a, b);
|
||||
}
|
||||
#if defined(__ELF__)
|
||||
COMPILER_RT_ALIAS(__letf2, __cmptf2)
|
||||
#endif
|
||||
COMPILER_RT_ALIAS(__letf2, __eqtf2)
|
||||
COMPILER_RT_ALIAS(__letf2, __lttf2)
|
||||
COMPILER_RT_ALIAS(__letf2, __netf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __getf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::getf2(a, b);
|
||||
}
|
||||
COMPILER_RT_ALIAS(__getf2, __gttf2)
|
||||
|
||||
COMPILER_RT_ABI CMP_RESULT __unordtf2(fp_t a, fp_t b) {
|
||||
return LIBC_NAMESPACE::shared::unordtf2(a, b);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif
|
||||
|
|
@ -27,6 +27,12 @@
|
|||
#include "builtins/extendsfdf2.h"
|
||||
#include "builtins/extendsftf2.h"
|
||||
#include "builtins/extendxftf2.h"
|
||||
#include "builtins/gedf2.h"
|
||||
#include "builtins/gesf2.h"
|
||||
#include "builtins/getf2.h"
|
||||
#include "builtins/ledf2.h"
|
||||
#include "builtins/lesf2.h"
|
||||
#include "builtins/letf2.h"
|
||||
#include "builtins/muldf3.h"
|
||||
#include "builtins/mulsf3.h"
|
||||
#include "builtins/multf3.h"
|
||||
|
|
@ -39,5 +45,8 @@
|
|||
#include "builtins/trunctfdf2.h"
|
||||
#include "builtins/trunctfsf2.h"
|
||||
#include "builtins/trunctfxf2.h"
|
||||
#include "builtins/unorddf2.h"
|
||||
#include "builtins/unordsf2.h"
|
||||
#include "builtins/unordtf2.h"
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_H
|
||||
|
|
|
|||
29
libc/shared/builtins/gedf2.h
Normal file
29
libc/shared/builtins/gedf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __gedf2 implementation as shared::gedf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_GEDF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_GEDF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/gedf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::gedf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_GEDF2_H
|
||||
29
libc/shared/builtins/gesf2.h
Normal file
29
libc/shared/builtins/gesf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __gesf2 implementation as shared::gesf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_GESF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_GESF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/gesf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::gesf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_GESF2_H
|
||||
35
libc/shared/builtins/getf2.h
Normal file
35
libc/shared/builtins/getf2.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __getf2 implementation as shared::getf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_GETF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_GETF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/getf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::getf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_GETF2_H
|
||||
29
libc/shared/builtins/ledf2.h
Normal file
29
libc/shared/builtins/ledf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __ledf2 implementation as shared::ledf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_LEDF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_LEDF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/ledf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::ledf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_LEDF2_H
|
||||
29
libc/shared/builtins/lesf2.h
Normal file
29
libc/shared/builtins/lesf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __lesf2 implementation as shared::lesf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_LESF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_LESF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/lesf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::lesf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_LESF2_H
|
||||
35
libc/shared/builtins/letf2.h
Normal file
35
libc/shared/builtins/letf2.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __letf2 implementation as shared::letf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_LETF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_LETF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/letf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::letf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_LETF2_H
|
||||
29
libc/shared/builtins/unorddf2.h
Normal file
29
libc/shared/builtins/unorddf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unorddf2 implementation as
|
||||
/// shared::unorddf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_UNORDDF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_UNORDDF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/unorddf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::unorddf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_UNORDDF2_H
|
||||
29
libc/shared/builtins/unordsf2.h
Normal file
29
libc/shared/builtins/unordsf2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unordsf2 implementation as
|
||||
/// shared::unordsf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/unordsf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::unordsf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
|
||||
35
libc/shared/builtins/unordtf2.h
Normal file
35
libc/shared/builtins/unordtf2.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unordtf2 implementation as
|
||||
/// shared::unordtf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_BUILTINS_UNORDTF2_H
|
||||
#define LLVM_LIBC_SHARED_BUILTINS_UNORDTF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/builtins/unordtf2.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using builtins::unordtf2;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_BUILTINS_UNORDTF2_H
|
||||
|
|
@ -221,5 +221,96 @@ add_header_library(
|
|||
truncdfsf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.fpconvert_helper
|
||||
cmp_helper
|
||||
HDRS
|
||||
cmp_helper.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.comparison_operations
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
libc.src.__support.macros.attributes
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
lesf2
|
||||
HDRS
|
||||
lesf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
gesf2
|
||||
HDRS
|
||||
gesf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
unordsf2
|
||||
HDRS
|
||||
unordsf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
ledf2
|
||||
HDRS
|
||||
ledf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
gedf2
|
||||
HDRS
|
||||
gedf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
unorddf2
|
||||
HDRS
|
||||
unorddf2.h
|
||||
DEPENDS
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
letf2
|
||||
HDRS
|
||||
letf2.h
|
||||
DEPENDS
|
||||
libc.include.llvm-libc-types.float128
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
getf2
|
||||
HDRS
|
||||
getf2.h
|
||||
DEPENDS
|
||||
libc.include.llvm-libc-types.float128
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
unordtf2
|
||||
HDRS
|
||||
unordtf2.h
|
||||
DEPENDS
|
||||
libc.include.llvm-libc-types.float128
|
||||
libc.src.__support.builtins.cmp_helper
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
|
|
|||
63
libc/src/__support/builtins/cmp_helper.h
Normal file
63
libc/src/__support/builtins/cmp_helper.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// Shared floating-point comparison results for compiler-rt's soft-float
|
||||
/// compare builtins. These mirror compiler-rt's GCC-compatible __le<f>2 /
|
||||
/// __ge<f>2 / __unord<f>2 (quiet: they raise no FP exceptions), reusing
|
||||
/// LLVM-libc's IEEE comparison predicates, so they can be reused by
|
||||
/// compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H
|
||||
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/__support/FPUtil/comparison_operations.h"
|
||||
#include "src/__support/macros/attributes.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// GCC soft-float compare, "LE" convention: -1 if a<b, 0 if a==b, 1 if a>b, and
|
||||
// 1 when unordered (either operand is NaN). Quiet -- raises no FP exceptions,
|
||||
// matching compiler-rt's __le<f>2 (which __eq/__ne/__lt/__cmp alias). NaN is
|
||||
// handled up front so the ordering predicates are only reached for non-NaN
|
||||
// inputs, where they never signal.
|
||||
template <typename T> LIBC_INLINE int cmp_le(T a, T b) {
|
||||
using FPBits = fputil::FPBits<T>;
|
||||
if (FPBits(a).is_nan() || FPBits(b).is_nan())
|
||||
return 1; // LE_UNORDERED
|
||||
if (fputil::equals(a, b))
|
||||
return 0; // LE_EQUAL
|
||||
return fputil::less_than(a, b) ? -1 : 1; // LE_LESS : LE_GREATER
|
||||
}
|
||||
|
||||
// Same as cmp_le, but unordered yields -1; matches compiler-rt's __ge<f>2
|
||||
// (which __gt aliases).
|
||||
template <typename T> LIBC_INLINE int cmp_ge(T a, T b) {
|
||||
using FPBits = fputil::FPBits<T>;
|
||||
if (FPBits(a).is_nan() || FPBits(b).is_nan())
|
||||
return -1; // GE_UNORDERED
|
||||
if (fputil::equals(a, b))
|
||||
return 0; // GE_EQUAL
|
||||
return fputil::greater_than(a, b) ? 1 : -1; // GE_GREATER : GE_LESS
|
||||
}
|
||||
|
||||
// 1 iff either operand is NaN, else 0; matches compiler-rt's __unord<f>2.
|
||||
template <typename T> LIBC_INLINE int cmp_unord(T a, T b) {
|
||||
using FPBits = fputil::FPBits<T>;
|
||||
return FPBits(a).is_nan() || FPBits(b).is_nan();
|
||||
}
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H
|
||||
30
libc/src/__support/builtins/gedf2.h
Normal file
30
libc/src/__support/builtins/gedf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __gedf2 implementation as builtins::gedf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_GEDF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_GEDF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Greater-equal comparison of double; mirrors compiler-rt's __gedf2.
|
||||
LIBC_INLINE int gedf2(double a, double b) { return cmp_ge(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_GEDF2_H
|
||||
30
libc/src/__support/builtins/gesf2.h
Normal file
30
libc/src/__support/builtins/gesf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __gesf2 implementation as builtins::gesf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Greater-equal comparison of float; mirrors compiler-rt's __gesf2.
|
||||
LIBC_INLINE int gesf2(float a, float b) { return cmp_ge(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
|
||||
36
libc/src/__support/builtins/getf2.h
Normal file
36
libc/src/__support/builtins/getf2.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __getf2 implementation as builtins::getf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_GETF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_GETF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Greater-equal comparison of float128; mirrors compiler-rt's __getf2.
|
||||
LIBC_INLINE int getf2(float128 a, float128 b) { return cmp_ge(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_GETF2_H
|
||||
30
libc/src/__support/builtins/ledf2.h
Normal file
30
libc/src/__support/builtins/ledf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __ledf2 implementation as builtins::ledf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_LEDF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_LEDF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Less-equal comparison of double; mirrors compiler-rt's __ledf2.
|
||||
LIBC_INLINE int ledf2(double a, double b) { return cmp_le(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_LEDF2_H
|
||||
30
libc/src/__support/builtins/lesf2.h
Normal file
30
libc/src/__support/builtins/lesf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __lesf2 implementation as builtins::lesf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Less-equal comparison of float; mirrors compiler-rt's __lesf2.
|
||||
LIBC_INLINE int lesf2(float a, float b) { return cmp_le(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
|
||||
36
libc/src/__support/builtins/letf2.h
Normal file
36
libc/src/__support/builtins/letf2.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __letf2 implementation as builtins::letf2 so
|
||||
/// that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_LETF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_LETF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Less-equal comparison of float128; mirrors compiler-rt's __letf2.
|
||||
LIBC_INLINE int letf2(float128 a, float128 b) { return cmp_le(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_LETF2_H
|
||||
30
libc/src/__support/builtins/unorddf2.h
Normal file
30
libc/src/__support/builtins/unorddf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unorddf2 implementation as
|
||||
/// builtins::unorddf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDDF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDDF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Unordered comparison of double; mirrors compiler-rt's __unorddf2.
|
||||
LIBC_INLINE int unorddf2(double a, double b) { return cmp_unord(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDDF2_H
|
||||
30
libc/src/__support/builtins/unordsf2.h
Normal file
30
libc/src/__support/builtins/unordsf2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unordsf2 implementation as
|
||||
/// builtins::unordsf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Unordered comparison of float; mirrors compiler-rt's __unordsf2.
|
||||
LIBC_INLINE int unordsf2(float a, float b) { return cmp_unord(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
|
||||
36
libc/src/__support/builtins/unordtf2.h
Normal file
36
libc/src/__support/builtins/unordtf2.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This header exposes LLVM-libc's __unordtf2 implementation as
|
||||
/// builtins::unordtf2 so that it can be reused by compiler-rt's builtins.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDTF2_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDTF2_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "src/__support/builtins/cmp_helper.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace builtins {
|
||||
|
||||
// Unordered comparison of float128; mirrors compiler-rt's __unordtf2.
|
||||
LIBC_INLINE int unordtf2(float128 a, float128 b) { return cmp_unord(a, b); }
|
||||
|
||||
} // namespace builtins
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDTF2_H
|
||||
|
|
@ -838,6 +838,12 @@ add_fp_unittest(
|
|||
libc.src.__support.builtins.extendsfdf2
|
||||
libc.src.__support.builtins.extendsftf2
|
||||
libc.src.__support.builtins.extendxftf2
|
||||
libc.src.__support.builtins.gedf2
|
||||
libc.src.__support.builtins.gesf2
|
||||
libc.src.__support.builtins.getf2
|
||||
libc.src.__support.builtins.ledf2
|
||||
libc.src.__support.builtins.lesf2
|
||||
libc.src.__support.builtins.letf2
|
||||
libc.src.__support.builtins.muldf3
|
||||
libc.src.__support.builtins.mulsf3
|
||||
libc.src.__support.builtins.multf3
|
||||
|
|
@ -850,6 +856,9 @@ add_fp_unittest(
|
|||
libc.src.__support.builtins.trunctfdf2
|
||||
libc.src.__support.builtins.trunctfsf2
|
||||
libc.src.__support.builtins.trunctfxf2
|
||||
libc.src.__support.builtins.unorddf2
|
||||
libc.src.__support.builtins.unordsf2
|
||||
libc.src.__support.builtins.unordtf2
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
|
|
|
|||
|
|
@ -60,3 +60,52 @@ TEST(LlvmLibcSharedBuiltinsTest, TruncateConversion) {
|
|||
#endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSharedBuiltinsTest, SingleCompare) {
|
||||
const float aNaN =
|
||||
LIBC_NAMESPACE::fputil::FPBits<float>::quiet_nan().get_val();
|
||||
EXPECT_EQ(-1, shared::gesf2(1.0f, 2.0f));
|
||||
EXPECT_EQ(0, shared::gesf2(1.0f, 1.0f));
|
||||
EXPECT_EQ(1, shared::gesf2(2.0f, 1.0f));
|
||||
EXPECT_EQ(-1, shared::gesf2(aNaN, 1.0f));
|
||||
EXPECT_EQ(-1, shared::lesf2(1.0f, 2.0f));
|
||||
EXPECT_EQ(0, shared::lesf2(1.0f, 1.0f));
|
||||
EXPECT_EQ(1, shared::lesf2(2.0f, 1.0f));
|
||||
EXPECT_EQ(1, shared::lesf2(aNaN, 1.0f));
|
||||
EXPECT_EQ(0, shared::unordsf2(1.0f, 2.0f));
|
||||
EXPECT_EQ(1, shared::unordsf2(aNaN, 1.0f));
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSharedBuiltinsTest, DoubleCompare) {
|
||||
const double aNaN =
|
||||
LIBC_NAMESPACE::fputil::FPBits<double>::quiet_nan().get_val();
|
||||
EXPECT_EQ(-1, shared::gedf2(1.0, 2.0));
|
||||
EXPECT_EQ(0, shared::gedf2(1.0, 1.0));
|
||||
EXPECT_EQ(1, shared::gedf2(2.0, 1.0));
|
||||
EXPECT_EQ(-1, shared::gedf2(aNaN, 1.0));
|
||||
EXPECT_EQ(-1, shared::ledf2(1.0, 2.0));
|
||||
EXPECT_EQ(0, shared::ledf2(1.0, 1.0));
|
||||
EXPECT_EQ(1, shared::ledf2(2.0, 1.0));
|
||||
EXPECT_EQ(1, shared::ledf2(aNaN, 1.0));
|
||||
EXPECT_EQ(0, shared::unorddf2(1.0, 2.0));
|
||||
EXPECT_EQ(1, shared::unorddf2(aNaN, 1.0));
|
||||
}
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
TEST(LlvmLibcSharedBuiltinsTest, Comparison) {
|
||||
const float128 aNaN =
|
||||
LIBC_NAMESPACE::fputil::FPBits<float128>::quiet_nan().get_val();
|
||||
EXPECT_EQ(-1, shared::getf2(float128(1.0), float128(2.0)));
|
||||
EXPECT_EQ(0, shared::getf2(float128(1.0), float128(1.0)));
|
||||
EXPECT_EQ(1, shared::getf2(float128(2.0), float128(1.0)));
|
||||
EXPECT_EQ(-1, shared::getf2(aNaN, float128(1.0)));
|
||||
EXPECT_EQ(-1, shared::letf2(float128(1.0), float128(2.0)));
|
||||
EXPECT_EQ(0, shared::letf2(float128(1.0), float128(1.0)));
|
||||
EXPECT_EQ(1, shared::letf2(float128(2.0), float128(1.0)));
|
||||
EXPECT_EQ(1, shared::letf2(aNaN, float128(1.0)));
|
||||
EXPECT_EQ(0, shared::unordtf2(float128(1.0), float128(2.0)));
|
||||
EXPECT_EQ(1, shared::unordtf2(aNaN, float128(1.0)));
|
||||
}
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
|
|
|||
Loading…
Reference in a new issue