@@ -31,13 +31,14 @@ function truncate_mask!(instrs, input, W, suffix, reverse_load::Bool = false)
3131 push! (instrs, str)
3232 decl
3333end
34- function zext_mask! (instrs, input, W, suffix)
34+ function zext_mask! (instrs, input, W, suffix, sext :: Bool = false )
3535 mtyp_input = " i$(max (8 ,nextpow2 (W))) "
3636 mtyp_trunc = " i$(W) "
3737 str = if mtyp_input == mtyp_trunc
3838 " %res.$(suffix) = bitcast <$W x i1> %$input to $mtyp_input "
3939 else
40- " %restrunc.$(suffix) = bitcast <$W x i1> %$input to $mtyp_trunc \n %res.$(suffix) = zext $mtyp_trunc %restrunc.$(suffix) to $mtyp_input "
40+ ext = sext ? " sext" : " zext"
41+ " %restrunc.$(suffix) = bitcast <$W x i1> %$input to $mtyp_trunc \n %res.$(suffix) = $ext $mtyp_trunc %restrunc.$(suffix) to $mtyp_input "
4142 end
4243 push! (instrs, str)
4344end
109110@generated function vconvert (
110111 :: Type{Vec{W,I}} ,
111112 m:: AbstractMask{W,U}
112- ) where {W,I<: IntegerTypesHW ,U<: Union{UInt8,UInt16,UInt32,UInt64} }
113+ ) where {W,I<: Union{ IntegerTypesHW,Bool} ,U<: Union{UInt8,UInt16,UInt32,UInt64} }
113114 bits = 8 sizeof (I)
114115 instrs = String[]
115116 truncate_mask! (instrs, ' 0' , W, 0 )
818819
819820@inline vifelse (m:: Vec{W,Bool} , s1:: T , s2:: T ) where {W,T<: NativeTypes } =
820821 vifelse (m, Vec {W,T} (s1), Vec {W,T} (s2))
821- @inline vifelse (m:: AbstractMask{W} , s1:: T , s2:: T ) where {W,T<: NativeTypes } =
822+ @inline function vifelse (
823+ m:: AbstractMask{W} ,
824+ s1:: T ,
825+ s2:: T
826+ ) where {W,T<: NativeTypes }
822827 vifelse (m, Vec {W,T} (s1), Vec {W,T} (s2))
828+ end
823829@inline vifelse (m:: AbstractMask{W,U} , s1, s2) where {W,U} =
824830 ((x1, x2) = promote (s1, s2); vifelse (m, x1, x2))
825831@inline vifelse (
0 commit comments