Skip to content

Commit

Permalink
float bswap
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Sep 13, 2021
1 parent 5636185 commit c775fe9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VectorizationBase"
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
authors = ["Chris Elrod <elrodc@gmail.com>"]
version = "0.21.7"
version = "0.21.8"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
7 changes: 5 additions & 2 deletions src/llvm_intrin/unary_ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)))


2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down

2 comments on commit c775fe9

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/44885

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.21.8 -m "<description of version>" c775fe9cab29e4dd3fc74d65f97f73e78ed9bd31
git push origin v0.21.8

Please sign in to comment.