1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2 ; RUN: opt < %s -constprop -S | FileCheck %s 3 4 ; Test to verify constant folding can occur when math routines are mapped 5 ; to the __<func>_finite versions of functions due to __FINITE_MATH_ONLY__ 6 ; being enabled on headers on Linux. All calls should constant fold away 7 ; in this test. 8 9 target triple = "unknown-unknown-linux-gnu" 10 11 declare double @__acos_finite(double) #0 12 declare float @__acosf_finite(float) #0 13 declare double @__asin_finite(double) #0 14 declare float @__asinf_finite(float) #0 15 declare double @__atan2_finite(double, double) #0 16 declare float @__atan2f_finite(float, float) #0 17 declare double @__cosh_finite(double) #0 18 declare float @__coshf_finite(float) #0 19 declare double @__exp2_finite(double) #0 20 declare float @__exp2f_finite(float) #0 21 declare double @__exp_finite(double) #0 22 declare float @__expf_finite(float) #0 23 declare double @__log10_finite(double) #0 24 declare float @__log10f_finite(float) #0 25 declare double @__log_finite(double) #0 26 declare float @__logf_finite(float) #0 27 declare double @__pow_finite(double, double) #0 28 declare float @__powf_finite(float, float) #0 29 declare double @__sinh_finite(double) #0 30 declare float @__sinhf_finite(float) #0 31 32 attributes #0 = { nounwind readnone } 33 34 define void @T() { 35 ; CHECK-LABEL: @T( 36 ; CHECK-NEXT: [[SLOT:%.*]] = alloca double 37 ; CHECK-NEXT: [[SLOTF:%.*]] = alloca float 38 ; CHECK-NEXT: store double 0.000000e+00, double* [[SLOT]] 39 ; CHECK-NEXT: store double 0x3FF921FB54442D18, double* [[SLOT]] 40 ; CHECK-NEXT: store double 0x3FE4978FA3269EE1, double* [[SLOT]] 41 ; CHECK-NEXT: store double 0x402422A497D6185E, double* [[SLOT]] 42 ; CHECK-NEXT: store double 0x403415E5BF6FB106, double* [[SLOT]] 43 ; CHECK-NEXT: store double 8.000000e+00, double* [[SLOT]] 44 ; CHECK-NEXT: store double 0x3FF193EA7AAD030{{[AB]}}, double* [[SLOT]] 45 ; CHECK-NEXT: store double 0x3FDE8927964FD5FD, double* [[SLOT]] 46 ; CHECK-NEXT: store double 1.000000e+00, double* [[SLOT]] 47 ; CHECK-NEXT: store double 0x40240926E70949AE, double* [[SLOT]] 48 ; CHECK-NEXT: store float 0.000000e+00, float* [[SLOTF]] 49 ; CHECK-NEXT: store float 0x3FF921FB60000000, float* [[SLOTF]] 50 ; CHECK-NEXT: store float 0x3FE4978FA0000000, float* [[SLOTF]] 51 ; CHECK-NEXT: store float 0x402422A4A0000000, float* [[SLOTF]] 52 ; CHECK-NEXT: store float 0x403415E5C0000000, float* [[SLOTF]] 53 ; CHECK-NEXT: store float 8.000000e+00, float* [[SLOTF]] 54 ; CHECK-NEXT: store float 0x3FF193EA80000000, float* [[SLOTF]] 55 ; CHECK-NEXT: store float 0x3FDE8927A0000000, float* [[SLOTF]] 56 ; CHECK-NEXT: store float 8.100000e+01, float* [[SLOTF]] 57 ; CHECK-NEXT: store float 0x40240926E0000000, float* [[SLOTF]] 58 ; CHECK-NEXT: ret void 59 ; 60 %slot = alloca double 61 %slotf = alloca float 62 63 %ACOS = call fast double @__acos_finite(double 1.000000e+00) 64 store double %ACOS, double* %slot 65 %ASIN = call fast double @__asin_finite(double 1.000000e+00) 66 store double %ASIN, double* %slot 67 %ATAN2 = call fast double @__atan2_finite(double 3.000000e+00, double 4.000000e+00) 68 store double %ATAN2, double* %slot 69 %COSH = call fast double @__cosh_finite(double 3.000000e+00) 70 store double %COSH, double* %slot 71 %EXP = call fast double @__exp_finite(double 3.000000e+00) 72 store double %EXP, double* %slot 73 %EXP2 = call fast double @__exp2_finite(double 3.000000e+00) 74 store double %EXP2, double* %slot 75 %LOG = call fast double @__log_finite(double 3.000000e+00) 76 store double %LOG, double* %slot 77 %LOG10 = call fast double @__log10_finite(double 3.000000e+00) 78 store double %LOG10, double* %slot 79 %POW = call fast double @__pow_finite(double 1.000000e+00, double 4.000000e+00) 80 store double %POW, double* %slot 81 %SINH = call fast double @__sinh_finite(double 3.000000e+00) 82 store double %SINH, double* %slot 83 84 %ACOSF = call fast float @__acosf_finite(float 1.000000e+00) 85 store float %ACOSF, float* %slotf 86 %ASINF = call fast float @__asinf_finite(float 1.000000e+00) 87 store float %ASINF, float* %slotf 88 %ATAN2F = call fast float @__atan2f_finite(float 3.000000e+00, float 4.000000e+00) 89 store float %ATAN2F, float* %slotf 90 %COSHF = call fast float @__coshf_finite(float 3.000000e+00) 91 store float %COSHF, float* %slotf 92 %EXPF = call fast float @__expf_finite(float 3.000000e+00) 93 store float %EXPF, float* %slotf 94 %EXP2F = call fast float @__exp2f_finite(float 3.000000e+00) 95 store float %EXP2F, float* %slotf 96 %LOGF = call fast float @__logf_finite(float 3.000000e+00) 97 store float %LOGF, float* %slotf 98 %LOG10F = call fast float @__log10f_finite(float 3.000000e+00) 99 store float %LOG10F, float* %slotf 100 %POWF = call fast float @__powf_finite(float 3.000000e+00, float 4.000000e+00) 101 store float %POWF, float* %slotf 102 %SINHF = call fast float @__sinhf_finite(float 3.000000e+00) 103 store float %SINHF, float* %slotf 104 ret void 105 } 106 107