Skip to content

Commit 149ae18

Browse files
committed
Have _vbroadcast on Bool return Mask
1 parent 2842337 commit 149ae18

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "VectorizationBase"
22
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.21.62"
4+
version = "0.21.63"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/llvm_intrin/masks.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,3 +1124,4 @@ end
11241124
@inline Base.min(x::AbstractMask, y::AbstractMask) = x & y
11251125
@inline Base.FastMath.max_fast(x::AbstractMask, y::AbstractMask) = x | y
11261126
@inline Base.FastMath.min_fast(x::AbstractMask, y::AbstractMask) = x & y
1127+
@inline zero_mask(::Type{T}) where {T} = zero_mask(zero(T))

src/llvm_intrin/vbroadcast.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ end
110110
::StaticInt{RS},
111111
::True
112112
) where {W,RS} = vbroadcast_expr(W, "half", :Float16, 2, RS)
113+
@inline function _vbroadcast(
114+
::StaticInt{W},
115+
s::Bool,
116+
::StaticInt{RS}
117+
) where {W,RS}
118+
t = Mask(max_mask(StaticInt{W}()))
119+
f = Mask(zero_mask(StaticInt{W}()))
120+
Core.ifelse(s, t, f)
121+
end
113122
@generated function _vbroadcast(
114123
::StaticInt{W},
115124
s::_T,

0 commit comments

Comments
 (0)