diff --git a/base/reduce.jl b/base/reduce.jl index a0cf96614fc96..8ccf79b43847a 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -202,7 +202,7 @@ struct SIMDableFunction{f}; end (::SIMDableFunction{f})(args...) where {f} = f(args...) simdable(f::Union{map(typeof, (+, *, &, |, add_sum, mul_prod, -, /, ^, identity))...}) = SIMDableFunction{f}() simdable(f) = f -function _mapreduce_impl_loop(f::SIMDableFunction, op::SIMDableFunction, A::Array, ifirst, ilast) +@inline function _mapreduce_impl_loop(f::SIMDableFunction, op::SIMDableFunction, A::Array, ifirst, ilast) @inbounds a1 = A[ifirst] @inbounds a2 = A[ifirst+1] v = op(f(a1), f(a2)) @@ -212,7 +212,7 @@ function _mapreduce_impl_loop(f::SIMDableFunction, op::SIMDableFunction, A::Arra end return v end -function _mapreduce_impl_loop(f, op, A, ifirst, ilast) +@inline function _mapreduce_impl_loop(f, op, A, ifirst, ilast) @inbounds a1 = A[ifirst] @inbounds a2 = A[ifirst+1] v = op(f(a1), f(a2)) diff --git a/base/reducedim.jl b/base/reducedim.jl index 9051c26f14c11..9eeaa5fcbbec4 100644 --- a/base/reducedim.jl +++ b/base/reducedim.jl @@ -237,7 +237,7 @@ end # The innermost loops are split out to allow for @simd in known safe cases # add a few more simd-safe functions that were not available earlier in bootstrap -simdable(f::Union{map(typeof, (abs, sqrt, log, log10, log2))...}) = SIMDableFunction{f}() +simdable(f::Union{map(typeof, (abs, abs2, sqrt, log, log10, log2))...}) = SIMDableFunction{f}() @inline function _mapreducedim_loop1!(f, op, R, A, IR, IA, i1) @inbounds begin r = R[i1,IR]