| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | FileCheck %s |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 2 | |
| 3 | target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" |
| 4 | target triple = "x86_64-unknown-linux-gnu" |
| 5 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 6 | ; Check for and against shrinkage when using the |
| 7 | ; unsafe-fp-math function attribute on a math lib |
| 8 | ; function. This optimization may be overridden by |
| 9 | ; the -enable-double-float-shrink option. |
| 10 | ; PR17850: http://llvm.org/bugs/show_bug.cgi?id=17850 |
| 11 | |
| 12 | define float @acos_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 13 | %conv = fpext float %f to double |
| 14 | %call = call double @acos(double %conv) |
| 15 | %conv1 = fptrunc double %call to float |
| 16 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 17 | ; CHECK-LABEL: acos_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 18 | ; CHECK: call float @acosf(float %f) |
| 19 | } |
| 20 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 21 | define double @acos_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 22 | %conv = fpext float %f to double |
| 23 | %call = call double @acos(double %conv) |
| 24 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 25 | ; CHECK-LABEL: acos_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 26 | ; CHECK: call double @acos(double %conv) |
| 27 | } |
| 28 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 29 | define float @acosh_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 30 | %conv = fpext float %f to double |
| 31 | %call = call double @acosh(double %conv) |
| 32 | %conv1 = fptrunc double %call to float |
| 33 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 34 | ; CHECK-LABEL: acosh_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 35 | ; CHECK: call float @acoshf(float %f) |
| 36 | } |
| 37 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 38 | define double @acosh_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 39 | %conv = fpext float %f to double |
| 40 | %call = call double @acosh(double %conv) |
| 41 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 42 | ; CHECK-LABEL: acosh_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 43 | ; CHECK: call double @acosh(double %conv) |
| 44 | } |
| 45 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 46 | define float @asin_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 47 | %conv = fpext float %f to double |
| 48 | %call = call double @asin(double %conv) |
| 49 | %conv1 = fptrunc double %call to float |
| 50 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 51 | ; CHECK-LABEL: asin_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 52 | ; CHECK: call float @asinf(float %f) |
| 53 | } |
| 54 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 55 | define double @asin_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 56 | %conv = fpext float %f to double |
| 57 | %call = call double @asin(double %conv) |
| 58 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 59 | ; CHECK-LABEL: asin_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 60 | ; CHECK: call double @asin(double %conv) |
| 61 | } |
| 62 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 63 | define float @asinh_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 64 | %conv = fpext float %f to double |
| 65 | %call = call double @asinh(double %conv) |
| 66 | %conv1 = fptrunc double %call to float |
| 67 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 68 | ; CHECK-LABEL: asinh_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 69 | ; CHECK: call float @asinhf(float %f) |
| 70 | } |
| 71 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 72 | define double @asinh_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 73 | %conv = fpext float %f to double |
| 74 | %call = call double @asinh(double %conv) |
| 75 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 76 | ; CHECK-LABEL: asinh_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 77 | ; CHECK: call double @asinh(double %conv) |
| 78 | } |
| 79 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 80 | define float @atan_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 81 | %conv = fpext float %f to double |
| 82 | %call = call double @atan(double %conv) |
| 83 | %conv1 = fptrunc double %call to float |
| 84 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 85 | ; CHECK-LABEL: atan_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 86 | ; CHECK: call float @atanf(float %f) |
| 87 | } |
| 88 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 89 | define double @atan_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 90 | %conv = fpext float %f to double |
| 91 | %call = call double @atan(double %conv) |
| 92 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 93 | ; CHECK-LABEL: atan_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 94 | ; CHECK: call double @atan(double %conv) |
| 95 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 96 | define float @atanh_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 97 | %conv = fpext float %f to double |
| 98 | %call = call double @atanh(double %conv) |
| 99 | %conv1 = fptrunc double %call to float |
| 100 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 101 | ; CHECK-LABEL: atanh_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 102 | ; CHECK: call float @atanhf(float %f) |
| 103 | } |
| 104 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 105 | define double @atanh_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 106 | %conv = fpext float %f to double |
| 107 | %call = call double @atanh(double %conv) |
| 108 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 109 | ; CHECK-LABEL: atanh_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 110 | ; CHECK: call double @atanh(double %conv) |
| 111 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 112 | define float @cbrt_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 113 | %conv = fpext float %f to double |
| 114 | %call = call double @cbrt(double %conv) |
| 115 | %conv1 = fptrunc double %call to float |
| 116 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 117 | ; CHECK-LABEL: cbrt_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 118 | ; CHECK: call float @cbrtf(float %f) |
| 119 | } |
| 120 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 121 | define double @cbrt_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 122 | %conv = fpext float %f to double |
| 123 | %call = call double @cbrt(double %conv) |
| 124 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 125 | ; CHECK-LABEL: cbrt_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 126 | ; CHECK: call double @cbrt(double %conv) |
| 127 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 128 | define float @exp_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 129 | %conv = fpext float %f to double |
| 130 | %call = call double @exp(double %conv) |
| 131 | %conv1 = fptrunc double %call to float |
| 132 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 133 | ; CHECK-LABEL: exp_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 134 | ; CHECK: call float @expf(float %f) |
| 135 | } |
| 136 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 137 | define double @exp_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 138 | %conv = fpext float %f to double |
| 139 | %call = call double @exp(double %conv) |
| 140 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 141 | ; CHECK-LABEL: exp_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 142 | ; CHECK: call double @exp(double %conv) |
| 143 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 144 | define float @expm1_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 145 | %conv = fpext float %f to double |
| 146 | %call = call double @expm1(double %conv) |
| 147 | %conv1 = fptrunc double %call to float |
| 148 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 149 | ; CHECK-LABEL: expm1_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 150 | ; CHECK: call float @expm1f(float %f) |
| 151 | } |
| 152 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 153 | define double @expm1_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 154 | %conv = fpext float %f to double |
| 155 | %call = call double @expm1(double %conv) |
| 156 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 157 | ; CHECK-LABEL: expm1_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 158 | ; CHECK: call double @expm1(double %conv) |
| 159 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 160 | define float @exp10_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 161 | %conv = fpext float %f to double |
| 162 | %call = call double @exp10(double %conv) |
| 163 | %conv1 = fptrunc double %call to float |
| 164 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 165 | ; CHECK-LABEL: exp10_test |
| Chandler Carruth | f5689f8 | 2013-12-28 02:40:19 +0000 | [diff] [blame] | 166 | ; CHECK: call double @exp10(double %conv) |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 167 | } |
| 168 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 169 | define double @exp10_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 170 | %conv = fpext float %f to double |
| 171 | %call = call double @exp10(double %conv) |
| 172 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 173 | ; CHECK-LABEL: exp10_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 174 | ; CHECK: call double @exp10(double %conv) |
| 175 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 176 | define float @log_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 177 | %conv = fpext float %f to double |
| 178 | %call = call double @log(double %conv) |
| 179 | %conv1 = fptrunc double %call to float |
| 180 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 181 | ; CHECK-LABEL: log_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 182 | ; CHECK: call float @logf(float %f) |
| 183 | } |
| 184 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 185 | define double @log_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 186 | %conv = fpext float %f to double |
| 187 | %call = call double @log(double %conv) |
| 188 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 189 | ; CHECK-LABEL: log_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 190 | ; CHECK: call double @log(double %conv) |
| 191 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 192 | define float @log10_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 193 | %conv = fpext float %f to double |
| 194 | %call = call double @log10(double %conv) |
| 195 | %conv1 = fptrunc double %call to float |
| 196 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 197 | ; CHECK-LABEL: log10_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 198 | ; CHECK: call float @log10f(float %f) |
| 199 | } |
| 200 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 201 | define double @log10_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 202 | %conv = fpext float %f to double |
| 203 | %call = call double @log10(double %conv) |
| 204 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 205 | ; CHECK-LABEL: log10_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 206 | ; CHECK: call double @log10(double %conv) |
| 207 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 208 | define float @log1p_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 209 | %conv = fpext float %f to double |
| 210 | %call = call double @log1p(double %conv) |
| 211 | %conv1 = fptrunc double %call to float |
| 212 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 213 | ; CHECK-LABEL: log1p_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 214 | ; CHECK: call float @log1pf(float %f) |
| 215 | } |
| 216 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 217 | define double @log1p_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 218 | %conv = fpext float %f to double |
| 219 | %call = call double @log1p(double %conv) |
| 220 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 221 | ; CHECK-LABEL: log1p_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 222 | ; CHECK: call double @log1p(double %conv) |
| 223 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 224 | define float @log2_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 225 | %conv = fpext float %f to double |
| 226 | %call = call double @log2(double %conv) |
| 227 | %conv1 = fptrunc double %call to float |
| 228 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 229 | ; CHECK-LABEL: log2_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 230 | ; CHECK: call float @log2f(float %f) |
| 231 | } |
| 232 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 233 | define double @log2_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 234 | %conv = fpext float %f to double |
| 235 | %call = call double @log2(double %conv) |
| 236 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 237 | ; CHECK-LABEL: log2_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 238 | ; CHECK: call double @log2(double %conv) |
| 239 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 240 | define float @logb_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 241 | %conv = fpext float %f to double |
| 242 | %call = call double @logb(double %conv) |
| 243 | %conv1 = fptrunc double %call to float |
| 244 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 245 | ; CHECK-LABEL: logb_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 246 | ; CHECK: call float @logbf(float %f) |
| 247 | } |
| 248 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 249 | define double @logb_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 250 | %conv = fpext float %f to double |
| 251 | %call = call double @logb(double %conv) |
| 252 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 253 | ; CHECK-LABEL: logb_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 254 | ; CHECK: call double @logb(double %conv) |
| 255 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 256 | define float @sin_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 257 | %conv = fpext float %f to double |
| 258 | %call = call double @sin(double %conv) |
| 259 | %conv1 = fptrunc double %call to float |
| 260 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 261 | ; CHECK-LABEL: sin_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 262 | ; CHECK: call float @sinf(float %f) |
| 263 | } |
| 264 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 265 | define double @sin_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 266 | %conv = fpext float %f to double |
| 267 | %call = call double @sin(double %conv) |
| 268 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 269 | ; CHECK-LABEL: sin_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 270 | ; CHECK: call double @sin(double %conv) |
| 271 | } |
| Hal Finkel | 12100bf | 2013-11-16 21:29:08 +0000 | [diff] [blame] | 272 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 273 | define float @sqrt_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 274 | %conv = fpext float %f to double |
| 275 | %call = call double @sqrt(double %conv) |
| 276 | %conv1 = fptrunc double %call to float |
| 277 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 278 | ; CHECK-LABEL: sqrt_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 279 | ; CHECK: call float @sqrtf(float %f) |
| 280 | } |
| 281 | |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 282 | define double @sqrt_test2(float %f) { |
| 283 | %conv = fpext float %f to double |
| 284 | %call = call double @sqrt(double %conv) |
| 285 | ret double %call |
| 286 | ; CHECK-LABEL: sqrt_test2 |
| 287 | ; CHECK: call double @sqrt(double %conv) |
| 288 | } |
| 289 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 290 | define float @sqrt_int_test(float %f) { |
| Hal Finkel | 12100bf | 2013-11-16 21:29:08 +0000 | [diff] [blame] | 291 | %conv = fpext float %f to double |
| 292 | %call = call double @llvm.sqrt.f64(double %conv) |
| 293 | %conv1 = fptrunc double %call to float |
| 294 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 295 | ; CHECK-LABEL: sqrt_int_test |
| Hal Finkel | 12100bf | 2013-11-16 21:29:08 +0000 | [diff] [blame] | 296 | ; CHECK: call float @llvm.sqrt.f32(float %f) |
| 297 | } |
| 298 | |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 299 | define double @sqrt_int_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 300 | %conv = fpext float %f to double |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 301 | %call = call double @llvm.sqrt.f64(double %conv) |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 302 | ret double %call |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 303 | ; CHECK-LABEL: sqrt_int_test2 |
| 304 | ; CHECK: call double @llvm.sqrt.f64(double %conv) |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 305 | } |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 306 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 307 | define float @tan_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 308 | %conv = fpext float %f to double |
| 309 | %call = call double @tan(double %conv) |
| 310 | %conv1 = fptrunc double %call to float |
| 311 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 312 | ; CHECK-LABEL: tan_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 313 | ; CHECK: call float @tanf(float %f) |
| 314 | } |
| 315 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 316 | define double @tan_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 317 | %conv = fpext float %f to double |
| 318 | %call = call double @tan(double %conv) |
| 319 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 320 | ; CHECK-LABEL: tan_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 321 | ; CHECK: call double @tan(double %conv) |
| 322 | } |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 323 | define float @tanh_test(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 324 | %conv = fpext float %f to double |
| 325 | %call = call double @tanh(double %conv) |
| 326 | %conv1 = fptrunc double %call to float |
| 327 | ret float %conv1 |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 328 | ; CHECK-LABEL: tanh_test |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 329 | ; CHECK: call float @tanhf(float %f) |
| 330 | } |
| 331 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 332 | define double @tanh_test2(float %f) { |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 333 | %conv = fpext float %f to double |
| 334 | %call = call double @tanh(double %conv) |
| 335 | ret double %call |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 336 | ; CHECK-LABEL: tanh_test2 |
| Meador Inge | 193e035 | 2012-11-13 04:16:17 +0000 | [diff] [blame] | 337 | ; CHECK: call double @tanh(double %conv) |
| 338 | } |
| 339 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 340 | declare double @tanh(double) #1 |
| 341 | declare double @tan(double) #1 |
| Sanjay Patel | 848309d | 2014-10-23 21:52:45 +0000 | [diff] [blame] | 342 | |
| 343 | ; sqrt is a special case: the shrinking optimization |
| 344 | ; is valid even without unsafe-fp-math. |
| 345 | declare double @sqrt(double) |
| 346 | declare double @llvm.sqrt.f64(double) |
| 347 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 348 | declare double @sin(double) #1 |
| 349 | declare double @log2(double) #1 |
| 350 | declare double @log1p(double) #1 |
| 351 | declare double @log10(double) #1 |
| 352 | declare double @log(double) #1 |
| 353 | declare double @logb(double) #1 |
| 354 | declare double @exp10(double) #1 |
| 355 | declare double @expm1(double) #1 |
| 356 | declare double @exp(double) #1 |
| 357 | declare double @cbrt(double) #1 |
| 358 | declare double @atanh(double) #1 |
| 359 | declare double @atan(double) #1 |
| 360 | declare double @acos(double) #1 |
| 361 | declare double @acosh(double) #1 |
| 362 | declare double @asin(double) #1 |
| 363 | declare double @asinh(double) #1 |
| Hal Finkel | 12100bf | 2013-11-16 21:29:08 +0000 | [diff] [blame] | 364 | |
| Sanjay Patel | a92fa44 | 2014-10-22 15:29:23 +0000 | [diff] [blame] | 365 | attributes #1 = { "unsafe-fp-math"="true" } |
| Hal Finkel | 12100bf | 2013-11-16 21:29:08 +0000 | [diff] [blame] | 366 | |