From f605d85137ca9a0569d12220d64bb1689c1d7f0c Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Mon, 24 Mar 2025 13:00:39 +0800 Subject: [PATCH 1/6] [ConstantantFolding] Add support for `sinh` and `cosh` intrinsics in constant folding --- llvm/lib/Analysis/ConstantFolding.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index b0ba25c3c16ac..dc905ab03e861 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1651,6 +1651,8 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) { case Intrinsic::sin: case Intrinsic::cos: case Intrinsic::sincos: + case Intrinsic::sinh: + case Intrinsic::cosh: case Intrinsic::pow: case Intrinsic::powi: case Intrinsic::ldexp: @@ -2513,6 +2515,10 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, return ConstantFoldFP(sin, APF, Ty); case Intrinsic::cos: return ConstantFoldFP(cos, APF, Ty); + case Intrinsic::sinh: + return ConstantFoldFP(sinh, APF, Ty); + case Intrinsic::cosh: + return ConstantFoldFP(cosh, APF, Ty); case Intrinsic::sqrt: return ConstantFoldFP(sqrt, APF, Ty); case Intrinsic::amdgcn_cos: From 991700ba0e7c65e9921b049783b14eab8d94e87f Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Tue, 25 Mar 2025 09:38:37 +0800 Subject: [PATCH 2/6] pre-commit test --- .../ConstProp/sinh-cosh-intrinsics.ll | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll new file mode 100644 index 0000000000000..b44470ca6e92e --- /dev/null +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll @@ -0,0 +1,40 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=early-cse < %s | FileCheck %s + +define double @test_sinh() { +; CHECK-LABEL: define double @test_sinh() { +; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.sinh.f64(double 0.000000e+00) +; CHECK-NEXT: ret double [[RESULT]] +; + %result = call double @llvm.sinh.f64(double 0.0) + ret double %result +} + +define <2 x double> @test_sinh_v2() { +; CHECK-LABEL: define <2 x double> @test_sinh_v2() { +; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) +; CHECK-NEXT: ret <2 x double> [[RESULT]] +; + %result = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) + ret <2 x double> %result +} + +define double @test_cosh() { +; CHECK-LABEL: define double @test_cosh() { +; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.cosh.f64(double 0.000000e+00) +; CHECK-NEXT: ret double [[RESULT]] +; + %result = call double @llvm.cosh.f64(double 0.0) + ret double %result +} + +define <2 x double> @test_cosh_v2() { +; CHECK-LABEL: define <2 x double> @test_cosh_v2() { +; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) +; CHECK-NEXT: ret <2 x double> [[RESULT]] +; + %result = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) + ret <2 x double> %result +} + + From 2308ecc10a40852205674696f36afa86393c384e Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Tue, 25 Mar 2025 09:39:25 +0800 Subject: [PATCH 3/6] update test --- .../InstSimplify/ConstProp/sinh-cosh-intrinsics.ll | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll index b44470ca6e92e..a2078cf09ba12 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll @@ -3,8 +3,7 @@ define double @test_sinh() { ; CHECK-LABEL: define double @test_sinh() { -; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.sinh.f64(double 0.000000e+00) -; CHECK-NEXT: ret double [[RESULT]] +; CHECK-NEXT: ret double 0.000000e+00 ; %result = call double @llvm.sinh.f64(double 0.0) ret double %result @@ -12,8 +11,7 @@ define double @test_sinh() { define <2 x double> @test_sinh_v2() { ; CHECK-LABEL: define <2 x double> @test_sinh_v2() { -; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) -; CHECK-NEXT: ret <2 x double> [[RESULT]] +; CHECK-NEXT: ret <2 x double> zeroinitializer ; %result = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result @@ -21,8 +19,7 @@ define <2 x double> @test_sinh_v2() { define double @test_cosh() { ; CHECK-LABEL: define double @test_cosh() { -; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.cosh.f64(double 0.000000e+00) -; CHECK-NEXT: ret double [[RESULT]] +; CHECK-NEXT: ret double 1.000000e+00 ; %result = call double @llvm.cosh.f64(double 0.0) ret double %result @@ -30,8 +27,7 @@ define double @test_cosh() { define <2 x double> @test_cosh_v2() { ; CHECK-LABEL: define <2 x double> @test_cosh_v2() { -; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) -; CHECK-NEXT: ret <2 x double> [[RESULT]] +; CHECK-NEXT: ret <2 x double> splat (double 1.000000e+00) ; %result = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result From 16bbd56427d0344cf233e2baa60d1f13f0373654 Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Tue, 25 Mar 2025 10:47:44 +0800 Subject: [PATCH 4/6] more testcases --- .../ConstProp/sinh-cosh-intrinsics.ll | 182 +++++++++++++++++- 1 file changed, 173 insertions(+), 9 deletions(-) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll index a2078cf09ba12..79f7ad0c8adfa 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll @@ -1,36 +1,200 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 -; RUN: opt -S -passes=early-cse < %s | FileCheck %s +; RUN: opt -S -passes=instsimplify < %s | FileCheck %s -define double @test_sinh() { -; CHECK-LABEL: define double @test_sinh() { -; CHECK-NEXT: ret double 0.000000e+00 +define double @test_sinh_0() { +; CHECK-LABEL: define double @test_sinh_0() { +; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.sinh.f64(double 0.000000e+00) +; CHECK-NEXT: ret double [[RESULT]] ; %result = call double @llvm.sinh.f64(double 0.0) ret double %result } +define double @test_sinh_ln2() { +; CHECK-LABEL: define double @test_sinh_ln2() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x3FE62E42FEFA3BDC) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 0.69314718056) + ret double %res +} + +define double @test_sinh_ln5() { +; CHECK-LABEL: define double @test_sinh_ln5() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x3FF9C041F7ED4511) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 1.60943791243) + ret double %res +} + define <2 x double> @test_sinh_v2() { ; CHECK-LABEL: define <2 x double> @test_sinh_v2() { -; CHECK-NEXT: ret <2 x double> zeroinitializer +; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) +; CHECK-NEXT: ret <2 x double> [[RESULT]] ; %result = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result } -define double @test_cosh() { -; CHECK-LABEL: define double @test_cosh() { -; CHECK-NEXT: ret double 1.000000e+00 +define double @test_sinh_neg0() { +; CHECK-LABEL: define double @test_sinh_neg0() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double -0.000000e+00) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double -0.0) + ret double %res +} + +define double @test_sinh_poison() { +; CHECK-LABEL: define double @test_sinh_poison() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double poison) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double poison) + ret double %res +} + +define double @test_sinh_undef() { +; CHECK-LABEL: define double @test_sinh_undef() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double undef) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double undef) + ret double %res +} + +define double @test_sinh_snan() { +; CHECK-LABEL: define double @test_sinh_snan() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x7FF0000000000001) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 0x7ff0000000000001) + ret double %res +} + +define double @test_sinh_qnan() { +; CHECK-LABEL: define double @test_sinh_qnan() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x7FF8000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 0x7ff8000000000000) + ret double %res +} + +define double @test_sinh_pos_inf() { +; CHECK-LABEL: define double @test_sinh_pos_inf() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x7FF0000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 0x7ff0000000000000) + ret double %res +} + +define double @test_sinh_neg_inf() { +; CHECK-LABEL: define double @test_sinh_neg_inf() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0xFFF0000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.sinh.f64(double 0xfff0000000000000) + ret double %res +} + +define double @test_cosh_0() { +; CHECK-LABEL: define double @test_cosh_0() { +; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.cosh.f64(double 0.000000e+00) +; CHECK-NEXT: ret double [[RESULT]] ; %result = call double @llvm.cosh.f64(double 0.0) ret double %result } +define double @test_cosh_ln2() { +; CHECK-LABEL: define double @test_cosh_ln2() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x3FE62E42FEFA3BDC) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 0.69314718056) + ret double %res +} + +define double @test_cosh_ln5() { +; CHECK-LABEL: define double @test_cosh_ln5() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x3FF9C041F7ED4511) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 1.60943791243) + ret double %res +} + define <2 x double> @test_cosh_v2() { ; CHECK-LABEL: define <2 x double> @test_cosh_v2() { -; CHECK-NEXT: ret <2 x double> splat (double 1.000000e+00) +; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) +; CHECK-NEXT: ret <2 x double> [[RESULT]] ; %result = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result } +define double @test_cosh_neg0() { +; CHECK-LABEL: define double @test_cosh_neg0() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double -0.000000e+00) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double -0.0) + ret double %res +} + +define double @test_cosh_poison() { +; CHECK-LABEL: define double @test_cosh_poison() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double poison) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double poison) + ret double %res +} + +define double @test_cosh_undef() { +; CHECK-LABEL: define double @test_cosh_undef() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double undef) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double undef) + ret double %res +} +define double @test_cosh_snan() { +; CHECK-LABEL: define double @test_cosh_snan() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x7FF0000000000001) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 0x7ff0000000000001) + ret double %res +} + +define double @test_cosh_qnan() { +; CHECK-LABEL: define double @test_cosh_qnan() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x7FF8000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 0x7ff8000000000000) + ret double %res +} + +define double @test_cosh_pos_inf() { +; CHECK-LABEL: define double @test_cosh_pos_inf() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x7FF0000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 0x7ff0000000000000) + ret double %res +} + +define double @test_cosh_neg_inf() { +; CHECK-LABEL: define double @test_cosh_neg_inf() { +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0xFFF0000000000000) +; CHECK-NEXT: ret double [[RES]] +; + %res = call double @llvm.cosh.f64(double 0xfff0000000000000) + ret double %res +} From 67752c49d28d9bb0704cc970ff62df9c531b2260 Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Tue, 25 Mar 2025 10:48:07 +0800 Subject: [PATCH 5/6] post commit --- .../ConstProp/sinh-cosh-intrinsics.ll | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll index 79f7ad0c8adfa..0ddbfdd7ff851 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll @@ -3,8 +3,7 @@ define double @test_sinh_0() { ; CHECK-LABEL: define double @test_sinh_0() { -; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.sinh.f64(double 0.000000e+00) -; CHECK-NEXT: ret double [[RESULT]] +; CHECK-NEXT: ret double 0.000000e+00 ; %result = call double @llvm.sinh.f64(double 0.0) ret double %result @@ -12,8 +11,7 @@ define double @test_sinh_0() { define double @test_sinh_ln2() { ; CHECK-LABEL: define double @test_sinh_ln2() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x3FE62E42FEFA3BDC) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double 0x3FE8000000000268 ; %res = call double @llvm.sinh.f64(double 0.69314718056) ret double %res @@ -21,8 +19,7 @@ define double @test_sinh_ln2() { define double @test_sinh_ln5() { ; CHECK-LABEL: define double @test_sinh_ln5() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double 0x3FF9C041F7ED4511) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double 0x400333333332D56D ; %res = call double @llvm.sinh.f64(double 1.60943791243) ret double %res @@ -30,8 +27,7 @@ define double @test_sinh_ln5() { define <2 x double> @test_sinh_v2() { ; CHECK-LABEL: define <2 x double> @test_sinh_v2() { -; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) -; CHECK-NEXT: ret <2 x double> [[RESULT]] +; CHECK-NEXT: ret <2 x double> zeroinitializer ; %result = call <2 x double> @llvm.sinh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result @@ -39,8 +35,7 @@ define <2 x double> @test_sinh_v2() { define double @test_sinh_neg0() { ; CHECK-LABEL: define double @test_sinh_neg0() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sinh.f64(double -0.000000e+00) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double -0.000000e+00 ; %res = call double @llvm.sinh.f64(double -0.0) ret double %res @@ -102,8 +97,7 @@ define double @test_sinh_neg_inf() { define double @test_cosh_0() { ; CHECK-LABEL: define double @test_cosh_0() { -; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.cosh.f64(double 0.000000e+00) -; CHECK-NEXT: ret double [[RESULT]] +; CHECK-NEXT: ret double 1.000000e+00 ; %result = call double @llvm.cosh.f64(double 0.0) ret double %result @@ -111,8 +105,7 @@ define double @test_cosh_0() { define double @test_cosh_ln2() { ; CHECK-LABEL: define double @test_cosh_ln2() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x3FE62E42FEFA3BDC) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double 0x3FF40000000000B8 ; %res = call double @llvm.cosh.f64(double 0.69314718056) ret double %res @@ -120,8 +113,7 @@ define double @test_cosh_ln2() { define double @test_cosh_ln5() { ; CHECK-LABEL: define double @test_cosh_ln5() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double 0x3FF9C041F7ED4511) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double 0x4004CCCCCCCC763D ; %res = call double @llvm.cosh.f64(double 1.60943791243) ret double %res @@ -129,8 +121,7 @@ define double @test_cosh_ln5() { define <2 x double> @test_cosh_v2() { ; CHECK-LABEL: define <2 x double> @test_cosh_v2() { -; CHECK-NEXT: [[RESULT:%.*]] = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) -; CHECK-NEXT: ret <2 x double> [[RESULT]] +; CHECK-NEXT: ret <2 x double> splat (double 1.000000e+00) ; %result = call <2 x double> @llvm.cosh.v2f64(<2 x double> zeroinitializer) ret <2 x double> %result @@ -138,8 +129,7 @@ define <2 x double> @test_cosh_v2() { define double @test_cosh_neg0() { ; CHECK-LABEL: define double @test_cosh_neg0() { -; CHECK-NEXT: [[RES:%.*]] = call double @llvm.cosh.f64(double -0.000000e+00) -; CHECK-NEXT: ret double [[RES]] +; CHECK-NEXT: ret double 1.000000e+00 ; %res = call double @llvm.cosh.f64(double -0.0) ret double %res From be4d06cb5a8b728346c176515325f266cbba2277 Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Tue, 25 Mar 2025 14:05:25 +0800 Subject: [PATCH 6/6] precision issue --- .../ConstProp/sinh-cosh-intrinsics.ll | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll index 0ddbfdd7ff851..a4f318bbc834c 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll @@ -11,17 +11,9 @@ define double @test_sinh_0() { define double @test_sinh_ln2() { ; CHECK-LABEL: define double @test_sinh_ln2() { -; CHECK-NEXT: ret double 0x3FE8000000000268 +; CHECK-NEXT: ret double 7.500000e-01 ; - %res = call double @llvm.sinh.f64(double 0.69314718056) - ret double %res -} - -define double @test_sinh_ln5() { -; CHECK-LABEL: define double @test_sinh_ln5() { -; CHECK-NEXT: ret double 0x400333333332D56D -; - %res = call double @llvm.sinh.f64(double 1.60943791243) + %res = call double @llvm.sinh.f64(double 0x3fe62e42fefa39ef) ret double %res } @@ -105,17 +97,9 @@ define double @test_cosh_0() { define double @test_cosh_ln2() { ; CHECK-LABEL: define double @test_cosh_ln2() { -; CHECK-NEXT: ret double 0x3FF40000000000B8 -; - %res = call double @llvm.cosh.f64(double 0.69314718056) - ret double %res -} - -define double @test_cosh_ln5() { -; CHECK-LABEL: define double @test_cosh_ln5() { -; CHECK-NEXT: ret double 0x4004CCCCCCCC763D +; CHECK-NEXT: ret double 1.250000e+00 ; - %res = call double @llvm.cosh.f64(double 1.60943791243) + %res = call double @llvm.cosh.f64(double 0x3fe62e42fefa39ef) ret double %res }