From cbf6789a17f3bd26bc555fc03423b877e740dee7 Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Thu, 8 Feb 2024 19:27:45 -0500 Subject: [PATCH] vconvert methods --- src/llvm_intrin/conversion.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/llvm_intrin/conversion.jl b/src/llvm_intrin/conversion.jl index 90144f7..b5824fe 100644 --- a/src/llvm_intrin/conversion.jl +++ b/src/llvm_intrin/conversion.jl @@ -229,7 +229,9 @@ end ### `vconvert(::Type{<:NativeTypes}, x)` methods. These forward to `vconvert(::Type{Vec{W,T}}, x)` @inline vconvert(::Type{T}, s::T) where {T<:NativeTypes} = s @inline vconvert(::Type{T}, s::T) where {T<:IntegerTypesHW} = s -@inline vconvert(::Type{T}, s::NativeTypes) where {T<:NativeTypes} = s +@inline vconvert(::Type{T}, s::Union{Float16,Float32,Float64}) where {T<:IntegerTypesHW} = Base.fptosi(T, Base.trunc_llvm(s)) +@inline vconvert(::Type{T}, s::IntegerTypesHW) where {T<:Union{Float16,Float32,Float64}} = convert(T, s)::T +@inline vconvert(::Type{T}, s::Union{Float16,Float32,Float64}) where {T<:Union{Float16,Float32,Float64}} = convert(T, s)::T @inline vconvert(::Type{T}, s::IntegerTypesHW) where {T<:IntegerTypesHW} = s % T @inline vconvert(::Type{T}, v::AbstractSIMD{W,T}) where {T<:NativeTypes,W} = v @inline vconvert(::Type{T}, v::AbstractSIMD{W,S}) where {T<:NativeTypes,S,W} =