@@ -24,7 +24,7 @@ using Base: sign_mask, exponent_mask, exponent_one, exponent_bias,
24
24
exponent_half, exponent_max, exponent_raw_max, fpinttype,
25
25
significand_mask, significand_bits, exponent_bits
26
26
27
- using Core. Intrinsics: sqrt_llvm, powi_llvm
27
+ using Core. Intrinsics: sqrt_llvm
28
28
29
29
const IEEEFloat = Union{Float16,Float32,Float64}
30
30
# non-type specific math functions
@@ -286,6 +286,8 @@ exp10(x::Float32) = 10.0f0^x
286
286
exp10 (x:: Integer ) = exp10 (float (x))
287
287
288
288
# utility for converting NaN return to DomainError
289
+ # the branch in nan_dom_err prevents its callers from inlining, so be sure to force it
290
+ # until the heuristics can be improved
289
291
@inline nan_dom_err (f, x) = isnan (f) & ! isnan (x) ? throw (DomainError ()) : f
290
292
291
293
# functions that return NaN on non-NaN argument for domain error
@@ -403,9 +405,9 @@ log1p(x)
403
405
for f in (:sin , :cos , :tan , :asin , :acos , :acosh , :atanh , :log , :log2 , :log10 ,
404
406
:lgamma , :log1p )
405
407
@eval begin
406
- ($ f)(x:: Float64 ) = nan_dom_err (ccall (($ (string (f)),libm), Float64, (Float64,), x), x)
407
- ($ f)(x:: Float32 ) = nan_dom_err (ccall (($ (string (f," f" )),libm), Float32, (Float32,), x), x)
408
- ($ f)(x:: Real ) = ($ f)(float (x))
408
+ @inline ($ f)(x:: Float64 ) = nan_dom_err (ccall (($ (string (f)), libm), Float64, (Float64,), x), x)
409
+ @inline ($ f)(x:: Float32 ) = nan_dom_err (ccall (($ (string (f, " f" )), libm), Float32, (Float32,), x), x)
410
+ @inline ($ f)(x:: Real ) = ($ f)(float (x))
409
411
end
410
412
end
411
413
@@ -683,14 +685,11 @@ function modf(x::Float64)
683
685
f, _modf_temp[]
684
686
end
685
687
686
- ^ (x:: Float64 , y:: Float64 ) = nan_dom_err (ccall ((:pow ,libm), Float64, (Float64,Float64), x, y), x+ y)
687
- ^ (x:: Float32 , y:: Float32 ) = nan_dom_err (ccall ((:powf ,libm), Float32, (Float32,Float32), x, y), x+ y)
688
-
689
- ^ (x:: Float64 , y:: Integer ) = x^ Int32 (y)
690
- ^ (x:: Float64 , y:: Int32 ) = powi_llvm (x, y)
691
- ^ (x:: Float32 , y:: Integer ) = x^ Int32 (y)
692
- ^ (x:: Float32 , y:: Int32 ) = powi_llvm (x, y)
693
- ^ (x:: Float16 , y:: Integer ) = Float16 (Float32 (x)^ y)
688
+ @inline ^ (x:: Float64 , y:: Float64 ) = nan_dom_err (ccall (" llvm.pow.f64" , llvmcall, Float64, (Float64, Float64), x, y), x + y)
689
+ @inline ^ (x:: Float32 , y:: Float32 ) = nan_dom_err (ccall (" llvm.pow.f32" , llvmcall, Float32, (Float32, Float32), x, y), x + y)
690
+ @inline ^ (x:: Float64 , y:: Integer ) = x ^ Float64 (y)
691
+ @inline ^ (x:: Float32 , y:: Integer ) = x ^ Float32 (y)
692
+ @inline ^ (x:: Float16 , y:: Integer ) = Float16 (Float32 (x) ^ Float32 (y))
694
693
^ {p}(x:: Float16 , :: Type{Val{p}} ) = Float16 (Float32 (x)^ Val{p})
695
694
696
695
function angle_restrict_symm (theta)
0 commit comments