Skip to content

Commit cbf6789

Browse files
committed
vconvert methods
1 parent be50c94 commit cbf6789

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/llvm_intrin/conversion.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ end
229229
### `vconvert(::Type{<:NativeTypes}, x)` methods. These forward to `vconvert(::Type{Vec{W,T}}, x)`
230230
@inline vconvert(::Type{T}, s::T) where {T<:NativeTypes} = s
231231
@inline vconvert(::Type{T}, s::T) where {T<:IntegerTypesHW} = s
232-
@inline vconvert(::Type{T}, s::NativeTypes) where {T<:NativeTypes} = s
232+
@inline vconvert(::Type{T}, s::Union{Float16,Float32,Float64}) where {T<:IntegerTypesHW} = Base.fptosi(T, Base.trunc_llvm(s))
233+
@inline vconvert(::Type{T}, s::IntegerTypesHW) where {T<:Union{Float16,Float32,Float64}} = convert(T, s)::T
234+
@inline vconvert(::Type{T}, s::Union{Float16,Float32,Float64}) where {T<:Union{Float16,Float32,Float64}} = convert(T, s)::T
233235
@inline vconvert(::Type{T}, s::IntegerTypesHW) where {T<:IntegerTypesHW} = s % T
234236
@inline vconvert(::Type{T}, v::AbstractSIMD{W,T}) where {T<:NativeTypes,W} = v
235237
@inline vconvert(::Type{T}, v::AbstractSIMD{W,S}) where {T<:NativeTypes,S,W} =

0 commit comments

Comments
 (0)