@@ -32,7 +32,7 @@ using Base: sign_mask, exponent_mask, exponent_one, exponent_bias,
32
32
exponent_half, exponent_max, exponent_raw_max, fpinttype,
33
33
significand_mask, significand_bits, exponent_bits
34
34
35
- using Core. Intrinsics: sqrt_llvm, powi_llvm
35
+ using Core. Intrinsics: sqrt_llvm
36
36
37
37
# non-type specific math functions
38
38
@@ -308,6 +308,8 @@ exp10(x::Float32) = 10.0f0^x
308
308
exp10 (x:: Integer ) = exp10 (float (x))
309
309
310
310
# utility for converting NaN return to DomainError
311
+ # the branch in nan_dom_err prevents its callers from inlining, so be sure to force it
312
+ # until the heuristics can be improved
311
313
@inline nan_dom_err (f, x) = isnan (f) & ! isnan (x) ? throw (DomainError ()) : f
312
314
313
315
# functions that return NaN on non-NaN argument for domain error
@@ -414,9 +416,9 @@ log1p(x)
414
416
for f in (:sin , :cos , :tan , :asin , :acos , :acosh , :atanh , :log , :log2 , :log10 ,
415
417
:lgamma , :log1p )
416
418
@eval begin
417
- ($ f)(x:: Float64 ) = nan_dom_err (ccall (($ (string (f)),libm), Float64, (Float64,), x), x)
418
- ($ f)(x:: Float32 ) = nan_dom_err (ccall (($ (string (f," f" )),libm), Float32, (Float32,), x), x)
419
- ($ f)(x:: Real ) = ($ f)(float (x))
419
+ @inline ($ f)(x:: Float64 ) = nan_dom_err (ccall (($ (string (f)),libm), Float64, (Float64,), x), x)
420
+ @inline ($ f)(x:: Float32 ) = nan_dom_err (ccall (($ (string (f, " f" )), libm), Float32, (Float32,), x), x)
421
+ @inline ($ f)(x:: Real ) = ($ f)(float (x))
420
422
end
421
423
end
422
424
@@ -677,14 +679,11 @@ function modf(x::Float64)
677
679
f, _modf_temp[]
678
680
end
679
681
680
- ^ (x:: Float64 , y:: Float64 ) = nan_dom_err (ccall ((:pow ,libm), Float64, (Float64,Float64), x, y), x+ y)
681
- ^ (x:: Float32 , y:: Float32 ) = nan_dom_err (ccall ((:powf ,libm), Float32, (Float32,Float32), x, y), x+ y)
682
-
683
- ^ (x:: Float64 , y:: Integer ) = x^ Int32 (y)
684
- ^ (x:: Float64 , y:: Int32 ) = powi_llvm (x, y)
685
- ^ (x:: Float32 , y:: Integer ) = x^ Int32 (y)
686
- ^ (x:: Float32 , y:: Int32 ) = powi_llvm (x, y)
687
- ^ (x:: Float16 , y:: Integer ) = Float16 (Float32 (x)^ y)
682
+ @inline ^ (x:: Float64 , y:: Float64 ) = nan_dom_err (ccall (" llvm.pow.f64" , llvmcall, Float64, (Float64, Float64), x, y), x + y)
683
+ @inline ^ (x:: Float32 , y:: Float32 ) = nan_dom_err (ccall (" llvm.pow.f32" , llvmcall, Float32, (Float32, Float32), x, y), x + y)
684
+ @inline ^ (x:: Float64 , y:: Integer ) = x ^ Float64 (y)
685
+ @inline ^ (x:: Float32 , y:: Integer ) = x ^ Float32 (y)
686
+ @inline ^ (x:: Float16 , y:: Integer ) = Float16 (Float32 (x) ^ Float32 (y))
688
687
689
688
function angle_restrict_symm (theta)
690
689
const P1 = 4 * 7.8539812564849853515625e-01
0 commit comments