| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| //===-- Half-precision cosh(x) function -----------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/coshf16.h" | ||
| #include "expxf16.h" | ||
| #include "hdr/errno_macros.h" | ||
| #include "hdr/fenv_macros.h" | ||
| #include "src/__support/FPUtil/FEnvImpl.h" | ||
| #include "src/__support/FPUtil/FPBits.h" | ||
| #include "src/__support/FPUtil/except_value_utils.h" | ||
| #include "src/__support/FPUtil/rounding_mode.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
| #include "src/__support/macros/optimization.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| static constexpr fputil::ExceptValues<float16, 9> COSHF16_EXCEPTS_POS = {{ | ||
| // x = 0x1.6ap-5, coshf16(x) = 0x1p+0 (RZ) | ||
| {0x29a8U, 0x3c00U, 1U, 0U, 1U}, | ||
| // x = 0x1.8c4p+0, coshf16(x) = 0x1.3a8p+1 (RZ) | ||
| {0x3e31U, 0x40eaU, 1U, 0U, 0U}, | ||
| // x = 0x1.994p+0, coshf16(x) = 0x1.498p+1 (RZ) | ||
| {0x3e65U, 0x4126U, 1U, 0U, 0U}, | ||
| // x = 0x1.b6p+0, coshf16(x) = 0x1.6d8p+1 (RZ) | ||
| {0x3ed8U, 0x41b6U, 1U, 0U, 1U}, | ||
| // x = 0x1.aap+1, coshf16(x) = 0x1.be8p+3 (RZ) | ||
| {0x42a8U, 0x4afaU, 1U, 0U, 1U}, | ||
| // x = 0x1.cc4p+1, coshf16(x) = 0x1.23cp+4 (RZ) | ||
| {0x4331U, 0x4c8fU, 1U, 0U, 0U}, | ||
| // x = 0x1.288p+2, coshf16(x) = 0x1.9b4p+5 (RZ) | ||
| {0x44a2U, 0x526dU, 1U, 0U, 0U}, | ||
| // x = 0x1.958p+2, coshf16(x) = 0x1.1a4p+8 (RZ) | ||
| {0x4656U, 0x5c69U, 1U, 0U, 0U}, | ||
| // x = 0x1.5fp+3, coshf16(x) = 0x1.c54p+14 (RZ) | ||
| {0x497cU, 0x7715U, 1U, 0U, 1U}, | ||
| }}; | ||
|
|
||
| static constexpr fputil::ExceptValues<float16, 4> COSHF16_EXCEPTS_NEG = {{ | ||
| // x = -0x1.6ap-5, coshf16(x) = 0x1p+0 (RZ) | ||
| {0xa9a8U, 0x3c00U, 1U, 0U, 1U}, | ||
| // x = -0x1.b6p+0, coshf16(x) = 0x1.6d8p+1 (RZ) | ||
| {0xbed8U, 0x41b6U, 1U, 0U, 1U}, | ||
| // x = -0x1.288p+2, coshf16(x) = 0x1.9b4p+5 (RZ) | ||
| {0xc4a2U, 0x526dU, 1U, 0U, 0U}, | ||
| // x = -0x1.5fp+3, coshf16(x) = 0x1.c54p+14 (RZ) | ||
| {0xc97cU, 0x7715U, 1U, 0U, 1U}, | ||
| }}; | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, coshf16, (float16 x)) { | ||
| using FPBits = fputil::FPBits<float16>; | ||
| FPBits x_bits(x); | ||
|
|
||
| uint16_t x_u = x_bits.uintval(); | ||
| uint16_t x_abs = x_u & 0x7fffU; | ||
|
|
||
| // When |x| >= acosh(2^16), or x is NaN. | ||
| if (LIBC_UNLIKELY(x_abs >= 0x49e5U)) { | ||
| // cosh(NaN) = NaN | ||
| if (x_bits.is_nan()) { | ||
| if (x_bits.is_signaling_nan()) { | ||
| fputil::raise_except_if_required(FE_INVALID); | ||
| return FPBits::quiet_nan().get_val(); | ||
| } | ||
|
|
||
| return x; | ||
| } | ||
|
|
||
| // When |x| >= acosh(2^16). | ||
| if (x_abs >= 0x49e5U) { | ||
| // cosh(+/-inf) = +inf | ||
| if (x_bits.is_inf()) | ||
| return FPBits::inf().get_val(); | ||
|
|
||
| switch (fputil::quick_get_round()) { | ||
| case FE_TONEAREST: | ||
| case FE_UPWARD: | ||
| fputil::set_errno_if_required(ERANGE); | ||
| fputil::raise_except_if_required(FE_OVERFLOW | FE_INEXACT); | ||
| return FPBits::inf().get_val(); | ||
| default: | ||
| return FPBits::max_normal().get_val(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (x_bits.is_pos()) { | ||
| if (auto r = COSHF16_EXCEPTS_POS.lookup(x_u); LIBC_UNLIKELY(r.has_value())) | ||
| return r.value(); | ||
| } else { | ||
| if (auto r = COSHF16_EXCEPTS_NEG.lookup(x_u); LIBC_UNLIKELY(r.has_value())) | ||
| return r.value(); | ||
| } | ||
|
|
||
| return eval_sinh_or_cosh</*IsSinh=*/false>(x); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| //===-- Half-precision sinh(x) function -----------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/sinhf16.h" | ||
| #include "expxf16.h" | ||
| #include "hdr/errno_macros.h" | ||
| #include "hdr/fenv_macros.h" | ||
| #include "src/__support/FPUtil/FEnvImpl.h" | ||
| #include "src/__support/FPUtil/FPBits.h" | ||
| #include "src/__support/FPUtil/except_value_utils.h" | ||
| #include "src/__support/FPUtil/rounding_mode.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
| #include "src/__support/macros/optimization.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| static constexpr fputil::ExceptValues<float16, 16> SINHF16_EXCEPTS_POS = {{ | ||
| // x = 0x1.714p-5, sinhf16(x) = 0x1.714p-5 (RZ) | ||
| {0x29c5U, 0x29c5U, 1U, 0U, 1U}, | ||
| // x = 0x1.25p-4, sinhf16(x) = 0x1.25p-4 (RZ) | ||
| {0x2c94U, 0x2c94U, 1U, 0U, 1U}, | ||
| // x = 0x1.f5p-4, sinhf16(x) = 0x1.f64p-4 (RZ) | ||
| {0x2fd4U, 0x2fd9U, 1U, 0U, 0U}, | ||
| // x = 0x1.b1cp-3, sinhf16(x) = 0x1.b4cp-3 (RZ) | ||
| {0x32c7U, 0x32d3U, 1U, 0U, 1U}, | ||
| // x = 0x1.6e8p-2, sinhf16(x) = 0x1.764p-2 (RZ) | ||
| {0x35baU, 0x35d9U, 1U, 0U, 1U}, | ||
| // x = 0x1.6b4p-1, sinhf16(x) = 0x1.8a4p-1 (RZ) | ||
| {0x39adU, 0x3a29U, 1U, 0U, 1U}, | ||
| // x = 0x1.a58p-1, sinhf16(x) = 0x1.d68p-1 (RZ) | ||
| {0x3a96U, 0x3b5aU, 1U, 0U, 1U}, | ||
| // x = 0x1.574p+0, sinhf16(x) = 0x1.c78p+0 (RZ) | ||
| {0x3d5dU, 0x3f1eU, 1U, 0U, 1U}, | ||
| // x = 0x1.648p+1, sinhf16(x) = 0x1.024p+3 (RZ) | ||
| {0x4192U, 0x4809U, 1U, 0U, 0U}, | ||
| // x = 0x1.cdcp+1, sinhf16(x) = 0x1.26cp+4 (RZ) | ||
| {0x4337U, 0x4c9bU, 1U, 0U, 0U}, | ||
| // x = 0x1.d0cp+1, sinhf16(x) = 0x1.2d8p+4 (RZ) | ||
| {0x4343U, 0x4cb6U, 1U, 0U, 1U}, | ||
| // x = 0x1.018p+2, sinhf16(x) = 0x1.bfp+4 (RZ) | ||
| {0x4406U, 0x4efcU, 1U, 0U, 0U}, | ||
| // x = 0x1.2fcp+2, sinhf16(x) = 0x1.cc4p+5 (RZ) | ||
| {0x44bfU, 0x5331U, 1U, 0U, 1U}, | ||
| // x = 0x1.4ecp+2, sinhf16(x) = 0x1.75cp+6 (RZ) | ||
| {0x453bU, 0x55d7U, 1U, 0U, 0U}, | ||
| // x = 0x1.8a4p+2, sinhf16(x) = 0x1.d94p+7 (RZ) | ||
| {0x4629U, 0x5b65U, 1U, 0U, 1U}, | ||
| // x = 0x1.5fp+3, sinhf16(x) = 0x1.c54p+14 (RZ) | ||
| {0x497cU, 0x7715U, 1U, 0U, 1U}, | ||
| }}; | ||
|
|
||
| static constexpr fputil::ExceptValues<float16, 12> SINHF16_EXCEPTS_NEG = {{ | ||
| // x = -0x1.714p-5, sinhf16(x) = -0x1.714p-5 (RZ) | ||
| {0xa9c5U, 0xa9c5U, 0U, 1U, 1U}, | ||
| // x = -0x1.25p-4, sinhf16(x) = -0x1.25p-4 (RZ) | ||
| {0xac94U, 0xac94U, 0U, 1U, 1U}, | ||
| // x = -0x1.f5p-4, sinhf16(x) = -0x1.f64p-4 (RZ) | ||
| {0xafd4U, 0xafd9U, 0U, 1U, 0U}, | ||
| // x = -0x1.6e8p-2, sinhf16(x) = -0x1.764p-2 (RZ) | ||
| {0xb5baU, 0xb5d9U, 0U, 1U, 1U}, | ||
| // x = -0x1.a58p-1, sinhf16(x) = -0x1.d68p-1 (RZ) | ||
| {0xba96U, 0xbb5aU, 0U, 1U, 1U}, | ||
| // x = -0x1.cdcp+1, sinhf16(x) = -0x1.26cp+4 (RZ) | ||
| {0xc337U, 0xcc9bU, 0U, 1U, 0U}, | ||
| // x = -0x1.d0cp+1, sinhf16(x) = -0x1.2d8p+4 (RZ) | ||
| {0xc343U, 0xccb6U, 0U, 1U, 1U}, | ||
| // x = -0x1.018p+2, sinhf16(x) = -0x1.bfp+4 (RZ) | ||
| {0xc406U, 0xcefcU, 0U, 1U, 0U}, | ||
| // x = -0x1.2fcp+2, sinhf16(x) = -0x1.cc4p+5 (RZ) | ||
| {0xc4bfU, 0xd331U, 0U, 1U, 1U}, | ||
| // x = -0x1.4ecp+2, sinhf16(x) = -0x1.75cp+6 (RZ) | ||
| {0xc53bU, 0xd5d7U, 0U, 1U, 0U}, | ||
| // x = -0x1.8a4p+2, sinhf16(x) = -0x1.d94p+7 (RZ) | ||
| {0xc629U, 0xdb65U, 0U, 1U, 1U}, | ||
| // x = -0x1.5fp+3, sinhf16(x) = -0x1.c54p+14 (RZ) | ||
| {0xc97cU, 0xf715U, 0U, 1U, 1U}, | ||
| }}; | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, sinhf16, (float16 x)) { | ||
| using FPBits = fputil::FPBits<float16>; | ||
| FPBits x_bits(x); | ||
|
|
||
| uint16_t x_u = x_bits.uintval(); | ||
| uint16_t x_abs = x_u & 0x7fffU; | ||
|
|
||
| // When |x| = 0, or -2^(-14) <= x <= -2^(-9), or |x| >= asinh(2^16), or x is | ||
| // NaN. | ||
| if (LIBC_UNLIKELY(x_abs == 0U || (x_u >= 0x8400U && x_u <= 0xa400U) || | ||
| x_abs >= 0x49e5U)) { | ||
| // sinh(NaN) = NaN | ||
| if (x_bits.is_nan()) { | ||
| if (x_bits.is_signaling_nan()) { | ||
| fputil::raise_except_if_required(FE_INVALID); | ||
| return FPBits::quiet_nan().get_val(); | ||
| } | ||
|
|
||
| return x; | ||
| } | ||
|
|
||
| // sinh(+/-0) = sinh(+/-0) | ||
| if (x_abs == 0U) | ||
| return FPBits::zero(x_bits.sign()).get_val(); | ||
|
|
||
| // When |x| >= asinh(2^16). | ||
| if (x_abs >= 0x49e5U) { | ||
| // sinh(+/-inf) = +/-inf | ||
| if (x_bits.is_inf()) | ||
| return FPBits::inf(x_bits.sign()).get_val(); | ||
|
|
||
| int rounding_mode = fputil::quick_get_round(); | ||
| if (rounding_mode == FE_TONEAREST || | ||
| (x_bits.is_pos() && rounding_mode == FE_UPWARD) || | ||
| (x_bits.is_neg() && rounding_mode == FE_DOWNWARD)) { | ||
| fputil::set_errno_if_required(ERANGE); | ||
| fputil::raise_except_if_required(FE_OVERFLOW | FE_INEXACT); | ||
| return FPBits::inf(x_bits.sign()).get_val(); | ||
| } | ||
| return FPBits::max_normal(x_bits.sign()).get_val(); | ||
| } | ||
|
|
||
| // When -2^(-14) <= x <= -2^(-9). | ||
| if (fputil::fenv_is_round_down()) | ||
| return FPBits(static_cast<uint16_t>(x_u + 1)).get_val(); | ||
| return FPBits(static_cast<uint16_t>(x_u)).get_val(); | ||
| } | ||
|
|
||
| if (x_bits.is_pos()) { | ||
| if (auto r = SINHF16_EXCEPTS_POS.lookup(x_u); LIBC_UNLIKELY(r.has_value())) | ||
| return r.value(); | ||
| } else { | ||
| if (auto r = SINHF16_EXCEPTS_NEG.lookup(x_u); LIBC_UNLIKELY(r.has_value())) | ||
| return r.value(); | ||
| } | ||
|
|
||
| return eval_sinh_or_cosh</*IsSinh=*/true>(x); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for sinhf16 -----------------------*- C++ -*-===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_SINHF16_H | ||
| #define LLVM_LIBC_SRC_MATH_SINHF16_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| float16 sinhf16(float16 x); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_SINHF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| //===-- Exhaustive test for coshf16 ---------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/coshf16.h" | ||
| #include "test/UnitTest/FPMatcher.h" | ||
| #include "test/UnitTest/Test.h" | ||
| #include "utils/MPFRWrapper/MPFRUtils.h" | ||
|
|
||
| using LlvmLibcCoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>; | ||
|
|
||
| namespace mpfr = LIBC_NAMESPACE::testing::mpfr; | ||
|
|
||
| // Range: [0, Inf]; | ||
| static constexpr uint16_t POS_START = 0x0000U; | ||
| static constexpr uint16_t POS_STOP = 0x7c00U; | ||
|
|
||
| // Range: [-Inf, 0]; | ||
| static constexpr uint16_t NEG_START = 0x8000U; | ||
| static constexpr uint16_t NEG_STOP = 0xfc00U; | ||
|
|
||
| TEST_F(LlvmLibcCoshf16Test, PositiveRange) { | ||
| for (uint16_t v = POS_START; v <= POS_STOP; ++v) { | ||
| float16 x = FPBits(v).get_val(); | ||
| EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cosh, x, | ||
| LIBC_NAMESPACE::coshf16(x), 0.5); | ||
| } | ||
| } | ||
|
|
||
| TEST_F(LlvmLibcCoshf16Test, NegativeRange) { | ||
| for (uint16_t v = NEG_START; v <= NEG_STOP; ++v) { | ||
| float16 x = FPBits(v).get_val(); | ||
| EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cosh, x, | ||
| LIBC_NAMESPACE::coshf16(x), 0.5); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| //===-- Exhaustive test for sinhf16 ---------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/sinhf16.h" | ||
| #include "test/UnitTest/FPMatcher.h" | ||
| #include "test/UnitTest/Test.h" | ||
| #include "utils/MPFRWrapper/MPFRUtils.h" | ||
|
|
||
| using LlvmLibcSinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>; | ||
|
|
||
| namespace mpfr = LIBC_NAMESPACE::testing::mpfr; | ||
|
|
||
| // Range: [0, Inf]; | ||
| static constexpr uint16_t POS_START = 0x0000U; | ||
| static constexpr uint16_t POS_STOP = 0x7c00U; | ||
|
|
||
| // Range: [-Inf, 0]; | ||
| static constexpr uint16_t NEG_START = 0x8000U; | ||
| static constexpr uint16_t NEG_STOP = 0xfc00U; | ||
|
|
||
| TEST_F(LlvmLibcSinhf16Test, PositiveRange) { | ||
| for (uint16_t v = POS_START; v <= POS_STOP; ++v) { | ||
| float16 x = FPBits(v).get_val(); | ||
| EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, | ||
| LIBC_NAMESPACE::sinhf16(x), 0.5); | ||
| } | ||
| } | ||
|
|
||
| TEST_F(LlvmLibcSinhf16Test, NegativeRange) { | ||
| for (uint16_t v = NEG_START; v <= NEG_STOP; ++v) { | ||
| float16 x = FPBits(v).get_val(); | ||
| EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, | ||
| LIBC_NAMESPACE::sinhf16(x), 0.5); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| //===-- Unittests for coshf16 ---------------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "hdr/fenv_macros.h" | ||
| #include "src/__support/FPUtil/cast.h" | ||
| #include "src/errno/libc_errno.h" | ||
| #include "src/math/coshf16.h" | ||
| #include "test/UnitTest/FPMatcher.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| using LlvmLibcCoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>; | ||
|
|
||
| TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) { | ||
| LIBC_NAMESPACE::libc_errno = 0; | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf16(aNaN)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::coshf16(sNaN), FE_INVALID); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf16(inf)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf16(neg_inf)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(LIBC_NAMESPACE::fputil::cast<float16>(1.0), | ||
| LIBC_NAMESPACE::coshf16(zero)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(LIBC_NAMESPACE::fputil::cast<float16>(1.0), | ||
| LIBC_NAMESPACE::coshf16(neg_zero)); | ||
| EXPECT_MATH_ERRNO(0); | ||
| } | ||
|
|
||
| TEST_F(LlvmLibcCoshf16Test, Overflow) { | ||
| LIBC_NAMESPACE::libc_errno = 0; | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(max_normal), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(neg_max_normal), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| // round(acosh(2^16), HP, RU); | ||
| float16 x = LIBC_NAMESPACE::fputil::cast<float16>(0x1.794p+3); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST(inf, LIBC_NAMESPACE::coshf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_UPWARD(inf, LIBC_NAMESPACE::coshf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_DOWNWARD( | ||
| max_normal, LIBC_NAMESPACE::coshf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_TOWARD_ZERO( | ||
| max_normal, LIBC_NAMESPACE::coshf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| // round(-acosh(2^16), HP, RD); | ||
| x = LIBC_NAMESPACE::fputil::cast<float16>(-0x1.794p+3); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST(inf, LIBC_NAMESPACE::coshf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_UPWARD(inf, LIBC_NAMESPACE::coshf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_DOWNWARD( | ||
| max_normal, LIBC_NAMESPACE::coshf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_TOWARD_ZERO( | ||
| max_normal, LIBC_NAMESPACE::coshf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| //===-- Unittests for sinhf16 ---------------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "hdr/fenv_macros.h" | ||
| #include "src/__support/FPUtil/cast.h" | ||
| #include "src/errno/libc_errno.h" | ||
| #include "src/math/sinhf16.h" | ||
| #include "test/UnitTest/FPMatcher.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| using LlvmLibcSinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>; | ||
|
|
||
| TEST_F(LlvmLibcSinhf16Test, SpecialNumbers) { | ||
| LIBC_NAMESPACE::libc_errno = 0; | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::sinhf16(aNaN)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinhf16(sNaN), FE_INVALID); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::sinhf16(inf)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::sinhf16(neg_inf)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::sinhf16(zero)); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::sinhf16(neg_zero)); | ||
| EXPECT_MATH_ERRNO(0); | ||
| } | ||
|
|
||
| TEST_F(LlvmLibcSinhf16Test, Overflow) { | ||
| LIBC_NAMESPACE::libc_errno = 0; | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::sinhf16(max_normal), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::sinhf16(neg_max_normal), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| // round(asinh(2^16), HP, RU); | ||
| float16 x = LIBC_NAMESPACE::fputil::cast<float16>(0x1.794p+3); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST(inf, LIBC_NAMESPACE::sinhf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_UPWARD(inf, LIBC_NAMESPACE::sinhf16(x), | ||
| FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_DOWNWARD( | ||
| max_normal, LIBC_NAMESPACE::sinhf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_TOWARD_ZERO( | ||
| max_normal, LIBC_NAMESPACE::sinhf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| // round(asinh(-2^16), HP, RD); | ||
| x = LIBC_NAMESPACE::fputil::cast<float16>(-0x1.794p+3); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_NEAREST( | ||
| neg_inf, LIBC_NAMESPACE::sinhf16(x), FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_UPWARD( | ||
| neg_max_normal, LIBC_NAMESPACE::sinhf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_DOWNWARD( | ||
| neg_inf, LIBC_NAMESPACE::sinhf16(x), FE_OVERFLOW | FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(ERANGE); | ||
|
|
||
| EXPECT_FP_EQ_WITH_EXCEPTION_ROUNDING_TOWARD_ZERO( | ||
| neg_max_normal, LIBC_NAMESPACE::sinhf16(x), FE_INEXACT); | ||
| EXPECT_MATH_ERRNO(0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,222 @@ | ||
| ; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-library %s | FileCheck %s | ||
| ; RUN: llc %s --filetype=asm -o - | FileCheck %s | ||
|
|
||
| target triple = "dxilv1.5-pc-shadermodel6.5-compute" | ||
|
|
||
| ; Confirm that DXILFinalizeLinkage will remove functions that have compatible | ||
| ; linkage and are not called from anywhere. This should be any function that | ||
| ; is not explicitly marked export and is not an entry point. | ||
|
|
||
| ; Has no specified inlining/linking behavior and is uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNothingUncalled | ||
| define void @"?doNothingUncalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline and uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineUncalled | ||
| define void @"?doAlwaysInlineUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline and uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineUncalled | ||
| define void @"?doNoinlineUncalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doInternalUncalled | ||
| define internal void @"?doInternalUncalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineInternalUncalled | ||
| define internal void @"?doAlwaysInlineInternalUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineInternalUncalled | ||
| define internal void @"?doNoinlineInternalUncalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Marked external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doExternalUncalled | ||
| define external void @"?doExternalUncalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineExternalUncalled | ||
| define external void @"?doAlwaysInlineExternalUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineExternalUncalled | ||
| define external void @"?doNoinlineExternalUncalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute and called, this should stay. | ||
| ; CHECK: define {{.*}}doNothingCalled | ||
| define void @"?doNothingCalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline and called, this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineCalled | ||
| define void @"?doAlwaysInlineCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline and called, this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineCalled | ||
| define void @"?doNoinlineCalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doInternalCalled | ||
| define internal void @"?doInternalCalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineInternalCalled | ||
| define internal void @"?doAlwaysInlineInternalCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineInternalCalled | ||
| define internal void @"?doNoinlineInternalCalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Marked external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doExternalCalled | ||
| define external void @"?doExternalCalled@@YAXXZ"() #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Always inlined, external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineExternalCalled | ||
| define external void @"?doAlwaysInlineExternalCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doNoinlineExternalCalled | ||
| define external void @"?doNoinlineExternalCalled@@YAXXZ"() #4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute and exported, this should stay. | ||
| ; CHECK: define {{.*}}doNothingExported | ||
| define void @"?doNothingExported@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline and exported, this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineExported | ||
| define void @"?doAlwaysInlineExported@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline attribute and exported, this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineExported | ||
| define void @"?doNoinlineExported@@YAXXZ"() #5 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute, internal, and exported; this should stay. | ||
| ; CHECK: define {{.*}}doInternalExported | ||
| define internal void @"?doInternalExported@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, internal, and exported; this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineInternalExported | ||
| define internal void @"?doAlwaysInlineInternalExported@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, internal, and exported; this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineInternalExported | ||
| define internal void @"?doNoinlineInternalExported@@YAXXZ"() #5 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Marked external and exported, this should stay. | ||
| ; CHECK: define {{.*}}doExternalExported | ||
| define external void @"?doExternalExported@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, external and exported, this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineExternalExported | ||
| define external void @"?doAlwaysInlineExternalExported@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, external and exported, this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineExternalExported | ||
| define external void @"?doNoinlineExternalExported@@YAXXZ"() #5 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Entry point function, this should stay. | ||
| ; CHECK: define void @main() | ||
| define void @main() #6 { | ||
| entry: | ||
| call void @"?doNothingCalled@@YAXXZ"() #7 | ||
| call void @"?doAlwaysInlineCalled@@YAXXZ"() #7 | ||
| call void @"?doNoinlineCalled@@YAXXZ"() #7 | ||
| call void @"?doInternalCalled@@YAXXZ"() #7 | ||
| call void @"?doAlwaysInlineInternalCalled@@YAXXZ"() #7 | ||
| call void @"?doNoinlineInternalCalled@@YAXXZ"() #7 | ||
| call void @"?doExternalCalled@@YAXXZ"() #7 | ||
| call void @"?doAlwaysInlineExternalCalled@@YAXXZ"() #7 | ||
| call void @"?doNoinlineExternalCalled@@YAXXZ"() #7 | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { alwaysinline convergent norecurse nounwind } | ||
| attributes #1 = { alwaysinline convergent norecurse nounwind "hlsl.export"} | ||
| attributes #2 = { convergent norecurse nounwind } | ||
| attributes #3 = { convergent norecurse nounwind "hlsl.export"} | ||
| attributes #4 = { convergent noinline norecurse nounwind } | ||
| attributes #5 = { convergent noinline norecurse nounwind "hlsl.export"} | ||
| attributes #6 = { convergent noinline norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" } | ||
| attributes #7 = { convergent } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| ; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s | ||
| ; RUN: llc %s --filetype=asm -o - | FileCheck %s | ||
|
|
||
| target triple = "dxilv1.5-pc-shadermodel6.5-compute" | ||
|
|
||
| ; Confirm that DXILFinalizeLinkage will remove functions that have compatible | ||
| ; linkage and are not called from anywhere. This should be any function that | ||
| ; is not an entry point. | ||
|
|
||
| ; Has no specified inlining/linking behavior and is uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNothingUncalled | ||
| define void @"?doNothingUncalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline and uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineUncalled | ||
| define void @"?doAlwaysInlineUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline and uncalled, this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineUncalled | ||
| define void @"?doNoinlineUncalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doInternalUncalled | ||
| define internal void @"?doInternalUncalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineInternalUncalled | ||
| define internal void @"?doAlwaysInlineInternalUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, internal, and uncalled; this should be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineInternalUncalled | ||
| define internal void @"?doNoinlineInternalUncalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Marked external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doExternalUncalled | ||
| define external void @"?doExternalUncalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doAlwaysInlineExternalUncalled | ||
| define external void @"?doAlwaysInlineExternalUncalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, external and uncalled, this should become internal and be removed. | ||
| ; CHECK-NOT: define {{.*}}doNoinlineExternalUncalled | ||
| define external void @"?doNoinlineExternalUncalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute and called, this should stay. | ||
| ; CHECK: define {{.*}}doNothingCalled | ||
| define void @"?doNothingCalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline and called, this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineCalled | ||
| define void @"?doAlwaysInlineCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline and called, this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineCalled | ||
| define void @"?doNoinlineCalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; No inlining attribute, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doInternalCalled | ||
| define internal void @"?doInternalCalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Alwaysinline, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineInternalCalled | ||
| define internal void @"?doAlwaysInlineInternalCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, internal, and called; this should stay. | ||
| ; CHECK: define {{.*}}doNoinlineInternalCalled | ||
| define internal void @"?doNoinlineInternalCalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Marked external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doExternalCalled | ||
| define external void @"?doExternalCalled@@YAXXZ"() #1 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Always inlined, external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doAlwaysInlineExternalCalled | ||
| define external void @"?doAlwaysInlineExternalCalled@@YAXXZ"() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Noinline, external and called, this should become internal and stay. | ||
| ; CHECK: define {{.*}}doNoinlineExternalCalled | ||
| define external void @"?doNoinlineExternalCalled@@YAXXZ"() #3 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Entry point function, this should stay. | ||
| ; CHECK: define void @main() | ||
| define void @main() #4 { | ||
| entry: | ||
| call void @"?doNothingCalled@@YAXXZ"() #5 | ||
| call void @"?doAlwaysInlineCalled@@YAXXZ"() #5 | ||
| call void @"?doNoinlineCalled@@YAXXZ"() #5 | ||
| call void @"?doInternalCalled@@YAXXZ"() #5 | ||
| call void @"?doAlwaysInlineInternalCalled@@YAXXZ"() #5 | ||
| call void @"?doNoinlineInternalCalled@@YAXXZ"() #5 | ||
| call void @"?doExternalCalled@@YAXXZ"() #5 | ||
| call void @"?doAlwaysInlineExternalCalled@@YAXXZ"() #5 | ||
| call void @"?doNoinlineExternalCalled@@YAXXZ"() #5 | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { alwaysinline convergent norecurse nounwind } | ||
| attributes #1 = { convergent norecurse nounwind } | ||
| attributes #3 = { convergent noinline norecurse nounwind } | ||
| attributes #4 = { convergent noinline norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" } | ||
| attributes #5 = { convergent } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| ; RUN: llc %s --filetype=asm -o - | FileCheck %s | ||
| target triple = "dxil-unknown-shadermodel6.7-library" | ||
|
|
||
| define float @negateF(float %0) #0 { | ||
| ; CHECK: %2 = fsub float -0.000000e+00, %0 | ||
| %2 = fneg float %0 | ||
| ret float %2 | ||
| } | ||
|
|
||
| define double @negateD(double %0) #0 { | ||
| ; CHECK: %2 = fsub double -0.000000e+00, %0 | ||
| %2 = fneg double %0 | ||
| ret double %2 | ||
| } | ||
|
|
||
| attributes #0 = { convergent norecurse nounwind "hlsl.export"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,34 @@ | ||
| ; RUN: llc --filetype=asm %s -o - | FileCheck %s | ||
| target triple = "dxil-unknown-shadermodel6.7-library" | ||
|
|
||
| define i64 @test(ptr %p) #0 { | ||
| %v = load i64, ptr %p | ||
| ret i64 %v | ||
| } | ||
|
|
||
| ; CHECK: define i64 @test(ptr %p) #0 { | ||
| ; CHECK-NEXT: %v = load i64, ptr %p, align 8 | ||
| ; CHECK-NEXT: ret i64 %v | ||
|
|
||
| define i64 @test2(ptr %p) #0 { | ||
| store i64 0, ptr %p | ||
| %v = load i64, ptr %p | ||
| ret i64 %v | ||
| } | ||
|
|
||
| ; CHECK: define i64 @test2(ptr %p) #0 { | ||
| ; CHECK-NEXT: store i64 0, ptr %p | ||
| ; CHECK-NEXT: %v = load i64, ptr %p, align 8 | ||
| ; CHECK-NEXT: ret i64 %v | ||
|
|
||
| define i32 @test3(ptr %0) #0 { | ||
| %2 = getelementptr i32, ptr %0, i32 4 | ||
| %3 = load i32, ptr %2 | ||
| ret i32 %3 | ||
| } | ||
|
|
||
| attributes #0 = { convergent norecurse nounwind "hlsl.export"} | ||
|
|
||
| ; CHECK: define i32 @test3(ptr %0) #0 { | ||
| ; CHECK-NEXT: %2 = getelementptr i32, ptr %0, i32 4 | ||
| ; CHECK-NEXT: %3 = load i32, ptr %2 |