diff --git a/Project.toml b/Project.toml index 19b34c62..b3a9b70e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "VectorizationBase" uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f" authors = ["Chris Elrod "] -version = "0.21.7" +version = "0.21.8" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/llvm_intrin/unary_ops.jl b/src/llvm_intrin/unary_ops.jl index 1ed4c6a1..50c04382 100644 --- a/src/llvm_intrin/unary_ops.jl +++ b/src/llvm_intrin/unary_ops.jl @@ -46,7 +46,10 @@ function bswap_quote(W::Int, T::Symbol, st::Int)::Expr llvmcall_expr(decl, instrs, ret_type, :(Tuple{$ret_type}), vtyp, [vtyp], [:(data(x))]) end @generated Base.bswap(x::Vec{W,T}) where {T<:IntegerTypesHW,W} = bswap_quote(W, JULIA_TYPES[T], sizeof(T)) -@inline Base.bswap(x::VecUnroll) = VecUnroll(fmap(bswap, data(x))) -@inline Base.bswap(x::AbstractSIMDVector) = bswap(Vec(x)) +@inline Base.bswap(x::VecUnroll{<:Any,<:Any,<:IntegerTypesHW}) = VecUnroll(fmap(bswap, data(x))) +@inline Base.bswap(x::AbstractSIMDVector{<:Any,<:IntegerTypesHW}) = bswap(Vec(x)) +@inline Base.bswap(x::AbstractSIMD{<:Any,Float16}) = reinterpret(Float16, bswap(reinterpret(UInt16, x))) +@inline Base.bswap(x::AbstractSIMD{<:Any,Float32}) = reinterpret(Float32, bswap(reinterpret(UInt32, x))) +@inline Base.bswap(x::AbstractSIMD{<:Any,Float64}) = reinterpret(Float64, bswap(reinterpret(UInt64, x))) diff --git a/test/runtests.jl b/test/runtests.jl index cbcf17c9..76185337 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1071,7 +1071,7 @@ include("testsetup.jl") @test vones32 === VectorizationBase.VecUnroll((vbroadcast(StaticInt(W32), 1f0),vbroadcast(StaticInt(W32), 1f0))) @test vtwos32 === VectorizationBase.VecUnroll((vbroadcast(StaticInt(W32), 2f0),vbroadcast(StaticInt(W32), 2f0))) @test vf2 === v2f32 - + @test tovector(@inferred(bswap(vf2))) == map(bswap, tovector(vf2)) vm = if Bool(VectorizationBase.has_feature(Val(:x86_64_avx512dq))) VectorizationBase.VecUnroll((