Skip to content

Commit

Permalink
Updates for VectorizatoinBase preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Jan 31, 2021
1 parent 5b618c8 commit a974ff5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SLEEFPirates"
uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa"
authors = ["chriselrod <elrodc@gmail.com>"]
version = "0.6.8"
version = "0.6.9"

[deps]
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
Expand All @@ -10,8 +10,8 @@ VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"

[compat]
IfElse = "0.1"
VectorizationBase = "0.16, 0.17"
julia = "1.5"
VectorizationBase = "0.18"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
23 changes: 7 additions & 16 deletions src/exp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,9 @@ end

const J_TABLE= Float64[2.0^(big(j-1)/256) for j in 1:256];

@generated function targetspecific_truncate(v)
ex = if VectorizationBase.has_feature("x86_64_avx512dq")
:v
else
:(v % UInt32)
end
Expr(:block, Expr(:meta,:inline), ex)
end
@inline target_trunc(v, ::VectorizationBase.True) = v
@inline target_trunc(v, ::VectorizationBase.False) = v % UInt32
@inline target_trunc(v) = target_trunc(v, VectorizationBase.has_feature(Val(:x86_64_avx512dq)))

for (func, base) in (:exp2=>Val(2), :exp=>Val(ℯ), :exp10=>Val(10))
Ndef1 = :(targetspecific_truncate(reinterpret(UInt64, N_float)))
Expand Down Expand Up @@ -179,14 +174,10 @@ end
return exthorner(x, (1.0f0, 0.5f0, hi_order))
end

@generated function inttype(::Type{Float64})
if VectorizationBase.has_feature("x86_64_avx512dq")
:Int64
else
:Int32
end
end
inttype(::Type{Float32}) = Int32
@inline widest_supported_integer(::VectorizationBase.True) = Int64
@inline widest_supported_integer(::VectorizationBase.False) = Int32
@inline inttype(::Type{Float64}) = widest_supported_integer(VectorizationBase.has_feature(Val(:x86_64_avx512dq)))
@inline inttype(::Type{Float32}) = Int32

@inline function expm1_fast(x::FloatType)
T = eltype(x)
Expand Down

0 comments on commit a974ff5

Please sign in to comment.