Skip to content

Commit 16fae56

Browse files
Restore behavior (by declaring safe) of these two-arg functions (#440)
Without these dispatches, `can_turbo` will return false for the two-arg versions of `trunc`, `unsafe_trunc`, `round`, `ceil`, and `floor`, which follow the form `f(::Type{T}, ::Union{Base.IEEEFloat, Base.BitInteger64}) where T<:{Union{Base.IEEEFloat, Base.BitInteger64}` These are well-supported in `VectorizationBase`; moreover, the 1-arg versions register as safe despite the recent changes. I have included `convert` and `reinterpret` in this list, as they happen to follow the same form, and are also well-supported.
1 parent 5f8ab91 commit 16fae56

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/LoopVectorization.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ using Base.Meta: isexpr
114114
using DocStringExtensions
115115
import LinearAlgebra # for check_args
116116

117+
using Base:
118+
unsafe_trunc
119+
117120
using Base.FastMath:
118121
add_fast,
119122
sub_fast,

src/condense_loopset.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,10 @@ can_turbo(::typeof(^), ::Val{2}) = true
922922
can_turbo(::typeof(Base.literal_pow), ::Val{3}) = true
923923
can_turbo(::typeof(Base.FastMath.pow_fast), ::Val{2}) = true
924924

925+
for f (convert, reinterpret, trunc, unsafe_trunc, round, ceil, floor)
926+
@eval can_turbo(::typeof($f), ::Val{2}) = true
927+
end
928+
925929
"""
926930
check_turbo_safe(ls::LoopSet)
927931

0 commit comments

Comments
 (0)