summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-01-08 17:38:09 +0000
committerSanjay Patel <spatel@rotateright.com>2018-01-08 17:38:09 +0000
commit52149f03053a1590b9cb1f620311fb800624d189 (patch)
treee71852609ac3eee8acd9d9af2962b964c24c9f18 /llvm/test/Transforms
parent342fa0534360601ae39263f7d959b0f32a3ef79f (diff)
downloadbcm5719-llvm-52149f03053a1590b9cb1f620311fb800624d189.tar.gz
bcm5719-llvm-52149f03053a1590b9cb1f620311fb800624d189.zip
[TargetLibraryInfo] fix finite mathlib function availability
This patch was part of: https://reviews.llvm.org/D41338 ...but we can expose the bug in IR via constant propagation as shown in the test. Unless the triple includes 'linux', we should not fold these because the functions don't exist on other platforms (yet?). llvm-svn: 322010
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/ConstProp/calls-math-finite.ll55
1 files changed, 39 insertions, 16 deletions
diff --git a/llvm/test/Transforms/ConstProp/calls-math-finite.ll b/llvm/test/Transforms/ConstProp/calls-math-finite.ll
index 00041f3e4a4..27130455833 100644
--- a/llvm/test/Transforms/ConstProp/calls-math-finite.ll
+++ b/llvm/test/Transforms/ConstProp/calls-math-finite.ll
@@ -1,10 +1,12 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -constprop -S | FileCheck %s
-; Test to verify constant folding can occur when math
-; routines are mapped to the __<func>_finite versions
-; of functions due to __FINITE_MATH_ONLY__ being
-; enabled on headers. All calls should constant
-; fold away in this test.
+; Test to verify constant folding can occur when math routines are mapped
+; to the __<func>_finite versions of functions due to __FINITE_MATH_ONLY__
+; being enabled on headers on Linux. All calls should constant fold away
+; in this test.
+
+target triple = "unknown-unknown-linux-gnu"
declare double @__acos_finite(double) #0
declare float @__acosf_finite(float) #0
@@ -31,19 +33,39 @@ attributes #0 = { nounwind readnone }
define void @T() {
; CHECK-LABEL: @T(
-
-; CHECK-NOT: call
-; CHECK: ret
-
+; CHECK-NEXT: [[SLOT:%.*]] = alloca double
+; CHECK-NEXT: [[SLOTF:%.*]] = alloca float
+; CHECK-NEXT: store double 0.000000e+00, double* [[SLOT]]
+; CHECK-NEXT: store double 0x3FF921FB54442D18, double* [[SLOT]]
+; CHECK-NEXT: store double 0x3FE4978FA3269EE1, double* [[SLOT]]
+; CHECK-NEXT: store double 0x402422A497D6185E, double* [[SLOT]]
+; CHECK-NEXT: store double 0x403415E5BF6FB106, double* [[SLOT]]
+; CHECK-NEXT: store double 8.000000e+00, double* [[SLOT]]
+; CHECK-NEXT: store double 0x3FF193EA7AAD030B, double* [[SLOT]]
+; CHECK-NEXT: store double 0x3FDE8927964FD5FD, double* [[SLOT]]
+; CHECK-NEXT: store double 1.000000e+00, double* [[SLOT]]
+; CHECK-NEXT: store double 0x40240926E70949AE, double* [[SLOT]]
+; CHECK-NEXT: store float 0.000000e+00, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x3FF921FB60000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x3FE4978FA0000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x402422A4A0000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x403415E5C0000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 8.000000e+00, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x3FF193EA80000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x3FDE8927A0000000, float* [[SLOTF]]
+; CHECK-NEXT: store float 8.100000e+01, float* [[SLOTF]]
+; CHECK-NEXT: store float 0x40240926E0000000, float* [[SLOTF]]
+; CHECK-NEXT: ret void
+;
%slot = alloca double
%slotf = alloca float
-
+
%ACOS = call fast double @__acos_finite(double 1.000000e+00)
store double %ACOS, double* %slot
%ASIN = call fast double @__asin_finite(double 1.000000e+00)
store double %ASIN, double* %slot
%ATAN2 = call fast double @__atan2_finite(double 3.000000e+00, double 4.000000e+00)
- store double %ATAN2, double* %slot
+ store double %ATAN2, double* %slot
%COSH = call fast double @__cosh_finite(double 3.000000e+00)
store double %COSH, double* %slot
%EXP = call fast double @__exp_finite(double 3.000000e+00)
@@ -53,18 +75,18 @@ define void @T() {
%LOG = call fast double @__log_finite(double 3.000000e+00)
store double %LOG, double* %slot
%LOG10 = call fast double @__log10_finite(double 3.000000e+00)
- store double %LOG10, double* %slot
+ store double %LOG10, double* %slot
%POW = call fast double @__pow_finite(double 1.000000e+00, double 4.000000e+00)
store double %POW, double* %slot
%SINH = call fast double @__sinh_finite(double 3.000000e+00)
- store double %SINH, double* %slot
-
+ store double %SINH, double* %slot
+
%ACOSF = call fast float @__acosf_finite(float 1.000000e+00)
store float %ACOSF, float* %slotf
%ASINF = call fast float @__asinf_finite(float 1.000000e+00)
store float %ASINF, float* %slotf
%ATAN2F = call fast float @__atan2f_finite(float 3.000000e+00, float 4.000000e+00)
- store float %ATAN2F, float* %slotf
+ store float %ATAN2F, float* %slotf
%COSHF = call fast float @__coshf_finite(float 3.000000e+00)
store float %COSHF, float* %slotf
%EXPF = call fast float @__expf_finite(float 3.000000e+00)
@@ -74,10 +96,11 @@ define void @T() {
%LOGF = call fast float @__logf_finite(float 3.000000e+00)
store float %LOGF, float* %slotf
%LOG10F = call fast float @__log10f_finite(float 3.000000e+00)
- store float %LOG10F, float* %slotf
+ store float %LOG10F, float* %slotf
%POWF = call fast float @__powf_finite(float 3.000000e+00, float 4.000000e+00)
store float %POWF, float* %slotf
%SINHF = call fast float @__sinhf_finite(float 3.000000e+00)
store float %SINHF, float* %slotf
ret void
}
+
OpenPOWER on IntegriCloud