1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO 2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO 3 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU 4 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID 5 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN 6 7 // Test attributes and codegen of math builtins. 8 9 void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { 10 f = __builtin_fmod(f,f); f = __builtin_fmodf(f,f); f = __builtin_fmodl(f,f); 11 12 // NO__ERRNO: frem double 13 // NO__ERRNO: frem float 14 // NO__ERRNO: frem x86_fp80 15 // HAS_ERRNO: declare double @fmod(double, double) [[NOT_READNONE:#[0-9]+]] 16 // HAS_ERRNO: declare float @fmodf(float, float) [[NOT_READNONE]] 17 // HAS_ERRNO: declare x86_fp80 @fmodl(x86_fp80, x86_fp80) [[NOT_READNONE]] 18 19 __builtin_atan2(f,f); __builtin_atan2f(f,f) ; __builtin_atan2l(f, f); 20 21 // NO__ERRNO: declare double @atan2(double, double) [[READNONE:#[0-9]+]] 22 // NO__ERRNO: declare float @atan2f(float, float) [[READNONE]] 23 // NO__ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[READNONE]] 24 // HAS_ERRNO: declare double @atan2(double, double) [[NOT_READNONE]] 25 // HAS_ERRNO: declare float @atan2f(float, float) [[NOT_READNONE]] 26 // HAS_ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NOT_READNONE]] 27 28 __builtin_copysign(f,f); __builtin_copysignf(f,f); __builtin_copysignl(f,f); __builtin_copysignf128(f,f); 29 30 // NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]] 31 // NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]] 32 // NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 33 // NO__ERRNO: declare fp128 @llvm.copysign.f128(fp128, fp128) [[READNONE_INTRINSIC]] 34 // HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]] 35 // HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]] 36 // HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 37 // HAS_ERRNO: declare fp128 @llvm.copysign.f128(fp128, fp128) [[READNONE_INTRINSIC]] 38 39 __builtin_fabs(f); __builtin_fabsf(f); __builtin_fabsl(f); __builtin_fabsf128(f); 40 41 // NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]] 42 // NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]] 43 // NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]] 44 // NO__ERRNO: declare fp128 @llvm.fabs.f128(fp128) [[READNONE_INTRINSIC]] 45 // HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]] 46 // HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]] 47 // HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]] 48 // HAS_ERRNO: declare fp128 @llvm.fabs.f128(fp128) [[READNONE_INTRINSIC]] 49 50 __builtin_frexp(f,i); __builtin_frexpf(f,i); __builtin_frexpl(f,i); 51 52 // NO__ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE:#[0-9]+]] 53 // NO__ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]] 54 // NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]] 55 // HAS_ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE]] 56 // HAS_ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]] 57 // HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]] 58 59 __builtin_huge_val(); __builtin_huge_valf(); __builtin_huge_vall(); __builtin_huge_valf128(); 60 61 // NO__ERRNO-NOT: .huge 62 // NO__ERRNO-NOT: @huge 63 // HAS_ERRNO-NOT: .huge 64 // HAS_ERRNO-NOT: @huge 65 66 __builtin_inf(); __builtin_inff(); __builtin_infl(); __builtin_inff128(); 67 68 // NO__ERRNO-NOT: .inf 69 // NO__ERRNO-NOT: @inf 70 // HAS_ERRNO-NOT: .inf 71 // HAS_ERRNO-NOT: @inf 72 73 __builtin_ldexp(f,f); __builtin_ldexpf(f,f); __builtin_ldexpl(f,f); 74 75 // NO__ERRNO: declare double @ldexp(double, i32) [[READNONE]] 76 // NO__ERRNO: declare float @ldexpf(float, i32) [[READNONE]] 77 // NO__ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[READNONE]] 78 // HAS_ERRNO: declare double @ldexp(double, i32) [[NOT_READNONE]] 79 // HAS_ERRNO: declare float @ldexpf(float, i32) [[NOT_READNONE]] 80 // HAS_ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[NOT_READNONE]] 81 82 __builtin_modf(f,d); __builtin_modff(f,fp); __builtin_modfl(f,l); 83 84 // NO__ERRNO: declare double @modf(double, double*) [[NOT_READNONE]] 85 // NO__ERRNO: declare float @modff(float, float*) [[NOT_READNONE]] 86 // NO__ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]] 87 // HAS_ERRNO: declare double @modf(double, double*) [[NOT_READNONE]] 88 // HAS_ERRNO: declare float @modff(float, float*) [[NOT_READNONE]] 89 // HAS_ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]] 90 91 __builtin_nan(c); __builtin_nanf(c); __builtin_nanl(c); __builtin_nanf128(c); 92 93 // NO__ERRNO: declare double @nan(i8*) [[PURE:#[0-9]+]] 94 // NO__ERRNO: declare float @nanf(i8*) [[PURE]] 95 // NO__ERRNO: declare x86_fp80 @nanl(i8*) [[PURE]] 96 // NO__ERRNO: declare fp128 @nanf128(i8*) [[PURE]] 97 // HAS_ERRNO: declare double @nan(i8*) [[PURE:#[0-9]+]] 98 // HAS_ERRNO: declare float @nanf(i8*) [[PURE]] 99 // HAS_ERRNO: declare x86_fp80 @nanl(i8*) [[PURE]] 100 // HAS_ERRNO: declare fp128 @nanf128(i8*) [[PURE]] 101 102 __builtin_nans(c); __builtin_nansf(c); __builtin_nansl(c); __builtin_nansf128(c); 103 104 // NO__ERRNO: declare double @nans(i8*) [[PURE]] 105 // NO__ERRNO: declare float @nansf(i8*) [[PURE]] 106 // NO__ERRNO: declare x86_fp80 @nansl(i8*) [[PURE]] 107 // NO__ERRNO: declare fp128 @nansf128(i8*) [[PURE]] 108 // HAS_ERRNO: declare double @nans(i8*) [[PURE]] 109 // HAS_ERRNO: declare float @nansf(i8*) [[PURE]] 110 // HAS_ERRNO: declare x86_fp80 @nansl(i8*) [[PURE]] 111 // HAS_ERRNO: declare fp128 @nansf128(i8*) [[PURE]] 112 113 __builtin_pow(f,f); __builtin_powf(f,f); __builtin_powl(f,f); 114 115 // NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]] 116 // NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]] 117 // NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 118 // HAS_ERRNO: declare double @pow(double, double) [[NOT_READNONE]] 119 // HAS_ERRNO: declare float @powf(float, float) [[NOT_READNONE]] 120 // HAS_ERRNO: declare x86_fp80 @powl(x86_fp80, x86_fp80) [[NOT_READNONE]] 121 122 __builtin_powi(f,f); __builtin_powif(f,f); __builtin_powil(f,f); 123 124 // NO__ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]] 125 // NO__ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]] 126 // NO__ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]] 127 // HAS_ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]] 128 // HAS_ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]] 129 // HAS_ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]] 130 131 /* math */ 132 __builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f); 133 134 // NO__ERRNO: declare double @acos(double) [[READNONE]] 135 // NO__ERRNO: declare float @acosf(float) [[READNONE]] 136 // NO__ERRNO: declare x86_fp80 @acosl(x86_fp80) [[READNONE]] 137 // HAS_ERRNO: declare double @acos(double) [[NOT_READNONE]] 138 // HAS_ERRNO: declare float @acosf(float) [[NOT_READNONE]] 139 // HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80) [[NOT_READNONE]] 140 141 __builtin_acosh(f); __builtin_acoshf(f); __builtin_acoshl(f); 142 143 // NO__ERRNO: declare double @acosh(double) [[READNONE]] 144 // NO__ERRNO: declare float @acoshf(float) [[READNONE]] 145 // NO__ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[READNONE]] 146 // HAS_ERRNO: declare double @acosh(double) [[NOT_READNONE]] 147 // HAS_ERRNO: declare float @acoshf(float) [[NOT_READNONE]] 148 // HAS_ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[NOT_READNONE]] 149 150 __builtin_asin(f); __builtin_asinf(f); __builtin_asinl(f); 151 152 // NO__ERRNO: declare double @asin(double) [[READNONE]] 153 // NO__ERRNO: declare float @asinf(float) [[READNONE]] 154 // NO__ERRNO: declare x86_fp80 @asinl(x86_fp80) [[READNONE]] 155 // HAS_ERRNO: declare double @asin(double) [[NOT_READNONE]] 156 // HAS_ERRNO: declare float @asinf(float) [[NOT_READNONE]] 157 // HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80) [[NOT_READNONE]] 158 159 __builtin_asinh(f); __builtin_asinhf(f); __builtin_asinhl(f); 160 161 // NO__ERRNO: declare double @asinh(double) [[READNONE]] 162 // NO__ERRNO: declare float @asinhf(float) [[READNONE]] 163 // NO__ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[READNONE]] 164 // HAS_ERRNO: declare double @asinh(double) [[NOT_READNONE]] 165 // HAS_ERRNO: declare float @asinhf(float) [[NOT_READNONE]] 166 // HAS_ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[NOT_READNONE]] 167 168 __builtin_atan(f); __builtin_atanf(f); __builtin_atanl(f); 169 170 // NO__ERRNO: declare double @atan(double) [[READNONE]] 171 // NO__ERRNO: declare float @atanf(float) [[READNONE]] 172 // NO__ERRNO: declare x86_fp80 @atanl(x86_fp80) [[READNONE]] 173 // HAS_ERRNO: declare double @atan(double) [[NOT_READNONE]] 174 // HAS_ERRNO: declare float @atanf(float) [[NOT_READNONE]] 175 // HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80) [[NOT_READNONE]] 176 177 __builtin_atanh(f); __builtin_atanhf(f); __builtin_atanhl(f); 178 179 // NO__ERRNO: declare double @atanh(double) [[READNONE]] 180 // NO__ERRNO: declare float @atanhf(float) [[READNONE]] 181 // NO__ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[READNONE]] 182 // HAS_ERRNO: declare double @atanh(double) [[NOT_READNONE]] 183 // HAS_ERRNO: declare float @atanhf(float) [[NOT_READNONE]] 184 // HAS_ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[NOT_READNONE]] 185 186 __builtin_cbrt(f); __builtin_cbrtf(f); __builtin_cbrtl(f); 187 188 // NO__ERRNO: declare double @cbrt(double) [[READNONE]] 189 // NO__ERRNO: declare float @cbrtf(float) [[READNONE]] 190 // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] 191 // HAS_ERRNO: declare double @cbrt(double) [[READNONE:#[0-9]+]] 192 // HAS_ERRNO: declare float @cbrtf(float) [[READNONE]] 193 // HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] 194 195 __builtin_ceil(f); __builtin_ceilf(f); __builtin_ceill(f); 196 197 // NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]] 198 // NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]] 199 // NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]] 200 // HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]] 201 // HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]] 202 // HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]] 203 204 __builtin_cos(f); __builtin_cosf(f); __builtin_cosl(f); 205 206 // NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]] 207 // NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]] 208 // NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]] 209 // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]] 210 // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]] 211 // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]] 212 213 __builtin_cosh(f); __builtin_coshf(f); __builtin_coshl(f); 214 215 // NO__ERRNO: declare double @cosh(double) [[READNONE]] 216 // NO__ERRNO: declare float @coshf(float) [[READNONE]] 217 // NO__ERRNO: declare x86_fp80 @coshl(x86_fp80) [[READNONE]] 218 // HAS_ERRNO: declare double @cosh(double) [[NOT_READNONE]] 219 // HAS_ERRNO: declare float @coshf(float) [[NOT_READNONE]] 220 // HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80) [[NOT_READNONE]] 221 222 __builtin_erf(f); __builtin_erff(f); __builtin_erfl(f); 223 224 // NO__ERRNO: declare double @erf(double) [[READNONE]] 225 // NO__ERRNO: declare float @erff(float) [[READNONE]] 226 // NO__ERRNO: declare x86_fp80 @erfl(x86_fp80) [[READNONE]] 227 // HAS_ERRNO: declare double @erf(double) [[NOT_READNONE]] 228 // HAS_ERRNO: declare float @erff(float) [[NOT_READNONE]] 229 // HAS_ERRNO: declare x86_fp80 @erfl(x86_fp80) [[NOT_READNONE]] 230 231 __builtin_erfc(f); __builtin_erfcf(f); __builtin_erfcl(f); 232 233 // NO__ERRNO: declare double @erfc(double) [[READNONE]] 234 // NO__ERRNO: declare float @erfcf(float) [[READNONE]] 235 // NO__ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[READNONE]] 236 // HAS_ERRNO: declare double @erfc(double) [[NOT_READNONE]] 237 // HAS_ERRNO: declare float @erfcf(float) [[NOT_READNONE]] 238 // HAS_ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[NOT_READNONE]] 239 240 __builtin_exp(f); __builtin_expf(f); __builtin_expl(f); 241 242 // NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]] 243 // NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]] 244 // NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]] 245 // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]] 246 // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]] 247 // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]] 248 249 __builtin_exp2(f); __builtin_exp2f(f); __builtin_exp2l(f); 250 251 // NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]] 252 // NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]] 253 // NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]] 254 // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]] 255 // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]] 256 // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]] 257 258 __builtin_expm1(f); __builtin_expm1f(f); __builtin_expm1l(f); 259 260 // NO__ERRNO: declare double @expm1(double) [[READNONE]] 261 // NO__ERRNO: declare float @expm1f(float) [[READNONE]] 262 // NO__ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[READNONE]] 263 // HAS_ERRNO: declare double @expm1(double) [[NOT_READNONE]] 264 // HAS_ERRNO: declare float @expm1f(float) [[NOT_READNONE]] 265 // HAS_ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[NOT_READNONE]] 266 267 __builtin_fdim(f,f); __builtin_fdimf(f,f); __builtin_fdiml(f,f); 268 269 // NO__ERRNO: declare double @fdim(double, double) [[READNONE]] 270 // NO__ERRNO: declare float @fdimf(float, float) [[READNONE]] 271 // NO__ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[READNONE]] 272 // HAS_ERRNO: declare double @fdim(double, double) [[NOT_READNONE]] 273 // HAS_ERRNO: declare float @fdimf(float, float) [[NOT_READNONE]] 274 // HAS_ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[NOT_READNONE]] 275 276 __builtin_floor(f); __builtin_floorf(f); __builtin_floorl(f); 277 278 // NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]] 279 // NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]] 280 // NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]] 281 // HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]] 282 // HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]] 283 // HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]] 284 285 __builtin_fma(f,f,f); __builtin_fmaf(f,f,f); __builtin_fmal(f,f,f); 286 287 // NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]] 288 // NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] 289 // NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 290 // HAS_ERRNO: declare double @fma(double, double, double) [[NOT_READNONE]] 291 // HAS_ERRNO: declare float @fmaf(float, float, float) [[NOT_READNONE]] 292 // HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80) [[NOT_READNONE]] 293 294 // On GNU or Win, fma never sets errno, so we can convert to the intrinsic. 295 296 // HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] 297 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] 298 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 299 300 // HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] 301 // HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] 302 // HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 303 304 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] 305 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] 306 // Long double is just double on win, so no f80 use/declaration. 307 // HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 308 309 __builtin_fmax(f,f); __builtin_fmaxf(f,f); __builtin_fmaxl(f,f); 310 311 // NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]] 312 // NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]] 313 // NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 314 // HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]] 315 // HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]] 316 // HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 317 318 __builtin_fmin(f,f); __builtin_fminf(f,f); __builtin_fminl(f,f); 319 320 // NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]] 321 // NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]] 322 // NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 323 // HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]] 324 // HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]] 325 // HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] 326 327 __builtin_hypot(f,f); __builtin_hypotf(f,f); __builtin_hypotl(f,f); 328 329 // NO__ERRNO: declare double @hypot(double, double) [[READNONE]] 330 // NO__ERRNO: declare float @hypotf(float, float) [[READNONE]] 331 // NO__ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[READNONE]] 332 // HAS_ERRNO: declare double @hypot(double, double) [[NOT_READNONE]] 333 // HAS_ERRNO: declare float @hypotf(float, float) [[NOT_READNONE]] 334 // HAS_ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[NOT_READNONE]] 335 336 __builtin_ilogb(f); __builtin_ilogbf(f); __builtin_ilogbl(f); 337 338 // NO__ERRNO: declare i32 @ilogb(double) [[READNONE]] 339 // NO__ERRNO: declare i32 @ilogbf(float) [[READNONE]] 340 // NO__ERRNO: declare i32 @ilogbl(x86_fp80) [[READNONE]] 341 // HAS_ERRNO: declare i32 @ilogb(double) [[NOT_READNONE]] 342 // HAS_ERRNO: declare i32 @ilogbf(float) [[NOT_READNONE]] 343 // HAS_ERRNO: declare i32 @ilogbl(x86_fp80) [[NOT_READNONE]] 344 345 __builtin_lgamma(f); __builtin_lgammaf(f); __builtin_lgammal(f); 346 347 // NO__ERRNO: declare double @lgamma(double) [[NOT_READNONE]] 348 // NO__ERRNO: declare float @lgammaf(float) [[NOT_READNONE]] 349 // NO__ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]] 350 // HAS_ERRNO: declare double @lgamma(double) [[NOT_READNONE]] 351 // HAS_ERRNO: declare float @lgammaf(float) [[NOT_READNONE]] 352 // HAS_ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]] 353 354 __builtin_llrint(f); __builtin_llrintf(f); __builtin_llrintl(f); 355 356 // NO__ERRNO: declare i64 @llrint(double) [[READNONE]] 357 // NO__ERRNO: declare i64 @llrintf(float) [[READNONE]] 358 // NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]] 359 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]] 360 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]] 361 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]] 362 363 __builtin_llround(f); __builtin_llroundf(f); __builtin_llroundl(f); 364 365 // NO__ERRNO: declare i64 @llround(double) [[READNONE]] 366 // NO__ERRNO: declare i64 @llroundf(float) [[READNONE]] 367 // NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]] 368 // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]] 369 // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]] 370 // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]] 371 372 __builtin_log(f); __builtin_logf(f); __builtin_logl(f); 373 374 // NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]] 375 // NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]] 376 // NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]] 377 // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]] 378 // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]] 379 // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]] 380 381 __builtin_log10(f); __builtin_log10f(f); __builtin_log10l(f); 382 383 // NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]] 384 // NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]] 385 // NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]] 386 // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]] 387 // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]] 388 // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]] 389 390 __builtin_log1p(f); __builtin_log1pf(f); __builtin_log1pl(f); 391 392 // NO__ERRNO: declare double @log1p(double) [[READNONE]] 393 // NO__ERRNO: declare float @log1pf(float) [[READNONE]] 394 // NO__ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[READNONE]] 395 // HAS_ERRNO: declare double @log1p(double) [[NOT_READNONE]] 396 // HAS_ERRNO: declare float @log1pf(float) [[NOT_READNONE]] 397 // HAS_ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[NOT_READNONE]] 398 399 __builtin_log2(f); __builtin_log2f(f); __builtin_log2l(f); 400 401 // NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]] 402 // NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]] 403 // NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]] 404 // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]] 405 // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]] 406 // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]] 407 408 __builtin_logb(f); __builtin_logbf(f); __builtin_logbl(f); 409 410 // NO__ERRNO: declare double @logb(double) [[READNONE]] 411 // NO__ERRNO: declare float @logbf(float) [[READNONE]] 412 // NO__ERRNO: declare x86_fp80 @logbl(x86_fp80) [[READNONE]] 413 // HAS_ERRNO: declare double @logb(double) [[NOT_READNONE]] 414 // HAS_ERRNO: declare float @logbf(float) [[NOT_READNONE]] 415 // HAS_ERRNO: declare x86_fp80 @logbl(x86_fp80) [[NOT_READNONE]] 416 417 __builtin_lrint(f); __builtin_lrintf(f); __builtin_lrintl(f); 418 419 // NO__ERRNO: declare i64 @lrint(double) [[READNONE]] 420 // NO__ERRNO: declare i64 @lrintf(float) [[READNONE]] 421 // NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]] 422 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]] 423 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]] 424 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]] 425 426 __builtin_lround(f); __builtin_lroundf(f); __builtin_lroundl(f); 427 428 // NO__ERRNO: declare i64 @lround(double) [[READNONE]] 429 // NO__ERRNO: declare i64 @lroundf(float) [[READNONE]] 430 // NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]] 431 // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]] 432 // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]] 433 // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]] 434 435 __builtin_nearbyint(f); __builtin_nearbyintf(f); __builtin_nearbyintl(f); 436 437 // NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]] 438 // NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]] 439 // NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]] 440 // HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]] 441 // HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]] 442 // HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]] 443 444 __builtin_nextafter(f,f); __builtin_nextafterf(f,f); __builtin_nextafterl(f,f); 445 446 // NO__ERRNO: declare double @nextafter(double, double) [[READNONE]] 447 // NO__ERRNO: declare float @nextafterf(float, float) [[READNONE]] 448 // NO__ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[READNONE]] 449 // HAS_ERRNO: declare double @nextafter(double, double) [[NOT_READNONE]] 450 // HAS_ERRNO: declare float @nextafterf(float, float) [[NOT_READNONE]] 451 // HAS_ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[NOT_READNONE]] 452 453 __builtin_nexttoward(f,f); __builtin_nexttowardf(f,f);__builtin_nexttowardl(f,f); 454 455 // NO__ERRNO: declare double @nexttoward(double, x86_fp80) [[READNONE]] 456 // NO__ERRNO: declare float @nexttowardf(float, x86_fp80) [[READNONE]] 457 // NO__ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[READNONE]] 458 // HAS_ERRNO: declare double @nexttoward(double, x86_fp80) [[NOT_READNONE]] 459 // HAS_ERRNO: declare float @nexttowardf(float, x86_fp80) [[NOT_READNONE]] 460 // HAS_ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[NOT_READNONE]] 461 462 __builtin_remainder(f,f); __builtin_remainderf(f,f); __builtin_remainderl(f,f); 463 464 // NO__ERRNO: declare double @remainder(double, double) [[READNONE]] 465 // NO__ERRNO: declare float @remainderf(float, float) [[READNONE]] 466 // NO__ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[READNONE]] 467 // HAS_ERRNO: declare double @remainder(double, double) [[NOT_READNONE]] 468 // HAS_ERRNO: declare float @remainderf(float, float) [[NOT_READNONE]] 469 // HAS_ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[NOT_READNONE]] 470 471 __builtin_remquo(f,f,i); __builtin_remquof(f,f,i); __builtin_remquol(f,f,i); 472 473 // NO__ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]] 474 // NO__ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]] 475 // NO__ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]] 476 // HAS_ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]] 477 // HAS_ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]] 478 // HAS_ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]] 479 480 __builtin_rint(f); __builtin_rintf(f); __builtin_rintl(f); 481 482 // NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]] 483 // NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]] 484 // NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]] 485 // HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]] 486 // HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]] 487 // HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]] 488 489 __builtin_round(f); __builtin_roundf(f); __builtin_roundl(f); 490 491 // NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]] 492 // NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]] 493 // NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]] 494 // HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]] 495 // HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]] 496 // HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]] 497 498 __builtin_scalbln(f,f); __builtin_scalblnf(f,f); __builtin_scalblnl(f,f); 499 500 // NO__ERRNO: declare double @scalbln(double, i64) [[READNONE]] 501 // NO__ERRNO: declare float @scalblnf(float, i64) [[READNONE]] 502 // NO__ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[READNONE]] 503 // HAS_ERRNO: declare double @scalbln(double, i64) [[NOT_READNONE]] 504 // HAS_ERRNO: declare float @scalblnf(float, i64) [[NOT_READNONE]] 505 // HAS_ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[NOT_READNONE]] 506 507 __builtin_scalbn(f,f); __builtin_scalbnf(f,f); __builtin_scalbnl(f,f); 508 509 // NO__ERRNO: declare double @scalbn(double, i32) [[READNONE]] 510 // NO__ERRNO: declare float @scalbnf(float, i32) [[READNONE]] 511 // NO__ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[READNONE]] 512 // HAS_ERRNO: declare double @scalbn(double, i32) [[NOT_READNONE]] 513 // HAS_ERRNO: declare float @scalbnf(float, i32) [[NOT_READNONE]] 514 // HAS_ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[NOT_READNONE]] 515 516 __builtin_sin(f); __builtin_sinf(f); __builtin_sinl(f); 517 518 // NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]] 519 // NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]] 520 // NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]] 521 // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]] 522 // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]] 523 // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]] 524 525 __builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); 526 527 // NO__ERRNO: declare double @sinh(double) [[READNONE]] 528 // NO__ERRNO: declare float @sinhf(float) [[READNONE]] 529 // NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[READNONE]] 530 // HAS_ERRNO: declare double @sinh(double) [[NOT_READNONE]] 531 // HAS_ERRNO: declare float @sinhf(float) [[NOT_READNONE]] 532 // HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[NOT_READNONE]] 533 534 __builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f); 535 536 // NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]] 537 // NO__ERRNO: declare float @llvm.sqrt.f32(float) [[READNONE_INTRINSIC]] 538 // NO__ERRNO: declare x86_fp80 @llvm.sqrt.f80(x86_fp80) [[READNONE_INTRINSIC]] 539 // HAS_ERRNO: declare double @sqrt(double) [[NOT_READNONE]] 540 // HAS_ERRNO: declare float @sqrtf(float) [[NOT_READNONE]] 541 // HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NOT_READNONE]] 542 543 __builtin_tan(f); __builtin_tanf(f); __builtin_tanl(f); 544 545 // NO__ERRNO: declare double @tan(double) [[READNONE]] 546 // NO__ERRNO: declare float @tanf(float) [[READNONE]] 547 // NO__ERRNO: declare x86_fp80 @tanl(x86_fp80) [[READNONE]] 548 // HAS_ERRNO: declare double @tan(double) [[NOT_READNONE]] 549 // HAS_ERRNO: declare float @tanf(float) [[NOT_READNONE]] 550 // HAS_ERRNO: declare x86_fp80 @tanl(x86_fp80) [[NOT_READNONE]] 551 552 __builtin_tanh(f); __builtin_tanhf(f); __builtin_tanhl(f); 553 554 // NO__ERRNO: declare double @tanh(double) [[READNONE]] 555 // NO__ERRNO: declare float @tanhf(float) [[READNONE]] 556 // NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[READNONE]] 557 // HAS_ERRNO: declare double @tanh(double) [[NOT_READNONE]] 558 // HAS_ERRNO: declare float @tanhf(float) [[NOT_READNONE]] 559 // HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[NOT_READNONE]] 560 561 __builtin_tgamma(f); __builtin_tgammaf(f); __builtin_tgammal(f); 562 563 // NO__ERRNO: declare double @tgamma(double) [[READNONE]] 564 // NO__ERRNO: declare float @tgammaf(float) [[READNONE]] 565 // NO__ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[READNONE]] 566 // HAS_ERRNO: declare double @tgamma(double) [[NOT_READNONE]] 567 // HAS_ERRNO: declare float @tgammaf(float) [[NOT_READNONE]] 568 // HAS_ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[NOT_READNONE]] 569 570 __builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); 571 572 // NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]] 573 // NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]] 574 // NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]] 575 // HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]] 576 // HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]] 577 // HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]] 578 }; 579 580 581 // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } 582 // NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } 583 // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } 584 // NO__ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} } 585 586 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } 587 // HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } 588 // HAS_ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} } 589 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } 590 591 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } 592 // HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } 593 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } 594 595