get rid of shuf_ind
This commit is contained in:
parent
b2c89979fe
commit
d1f3efe8db
@ -15,12 +15,6 @@ def widen{T=[k]_, x:X=[l]_ if w256{X} and l>k} = widen{T, half{x,0}}
|
||||
def blend_top{f:T, t:T, m:M if w256i{T,32} and w256i{M,32}} = T ~~ blend_top{v2f{f}, v2f{t}, v2f{m}}
|
||||
def blend_top{f:T, t:T, m:M if w256i{T,64} and w256i{M,64}} = T ~~ blend_top{v2d{f}, v2d{t}, v2d{m}}
|
||||
|
||||
# shuffles
|
||||
def shuf_ind{a:T, b:T=[8]E, {...is} if width{E}==32 and length{is}==8 and ({l,h} => same{l,h-4} and x86_shufps_range{l, 8}){slice{is,0,4}, slice{is,4,8}}} = {
|
||||
vec_shuffle{[4]f32, tup{a, b}, slice{is,0,4} & 3}
|
||||
}
|
||||
def shuf_ind{a:T, b:T=[4]E, {...is} if width{E}==64 and length{is}==4} = T~~shuf_ind{re_el{u32,a}, re_el{u32,b}, merge{...each{{i} => tup{i*2, i*2+1}, is}}}
|
||||
|
||||
# mask stuff
|
||||
def and_bit_none{x:T, y:T if w256i{T}} = emit{u1, '_mm256_testz_si256', x, y}
|
||||
|
||||
|
||||
@ -67,8 +67,8 @@ def unzip128{a:[k]E, b:[k]E, 1 if hasarch{'X86_64'} and isunsigned{E}} = {
|
||||
def ew = width{E}
|
||||
packs128{re_el{ED,a} >> ew, re_el{ED,b} >> ew}
|
||||
}
|
||||
def unzip128{a:T, b:T==[8](u32), k} = shuf_ind{a, b, tup{0,2,8,10, 4,6,12,14}+k}
|
||||
def unzip128{a:T, b:T==[4](u64), k} = shuf_ind{a, b, tup{0,4,2,6}+k}
|
||||
def unzip128{a:V, b:V if vece{V,32}, k if int_idx{k,2}} = vec_shuffle{[4]f32, tup{a,b}, k+tup{0,2,0,2}}
|
||||
def unzip128{a:V, b:V if vece{V,64}, k if int_idx{k,2}} = vec_shuffle{[2]f64, tup{a,b}, k+tup{0,0}}
|
||||
|
||||
def unzip{a:T, b:T, k if w128u{T} and hasarch{'SSE2'}} = unzip128{a, b, k}
|
||||
def unzip{a:T, b:T, k if w256u{T} and hasarch{'AVX2'}} = vec_shuffle{[4]u64, unzip128{a, b, k}, 0,2,1,3}
|
||||
|
||||
@ -178,7 +178,7 @@ def {
|
||||
all_hom,any_hom,blend_hom,hom_to_int,store_masked_hom,store_blended_hom,
|
||||
all_top,any_top,blend_top,top_to_int,store_masked_top,store_blended_top,
|
||||
load_expand_bits,make,mask_to_hom,mulw_split,mulh,narrow,narrow_trunc,narrow_pair,
|
||||
pair,pdep,pext,bzhi,rbit,sel,shuf_ind,reverse_units,broadcast_sel,absdiff_sum,mul_sum,mul_sum_sat,
|
||||
pair,pdep,pext,bzhi,rbit,sel,reverse_units,broadcast_sel,absdiff_sum,mul_sum,mul_sum_sat,
|
||||
unord,unzip,vfold,vec_select,vec_shuffle,widen,widen_upper,multishift,
|
||||
addp,addpw,addpwa,
|
||||
}
|
||||
@ -357,11 +357,6 @@ def in_range_len{x:TU=[_]T, start, count if isunsigned{T}} = { # ∊ [start;star
|
||||
(TS~~(x-TU**(start-h))) < TS**(count-h)
|
||||
}
|
||||
|
||||
# check if all tuple elements are in a given range
|
||||
def in_range{t, min, max} = all{(t>=min) & (t<max)}
|
||||
def in_range{t, s, e, min, max} = in_range{slice{t,s,e}, min, max}
|
||||
|
||||
|
||||
def load{p,i if kgen{p}} = p{i}
|
||||
def store{p,i,x if kgen{p}} = p{i,x}
|
||||
def tptr{l,s} = { # create "pointer" generator with given load & store definitions
|
||||
|
||||
@ -88,8 +88,6 @@ def broadcast_sel{x:T, i if nvec{T}} = emit{T, ntyp{'vdup', tern{w128{T},'_laneq
|
||||
|
||||
def unzip{x:T, y:T, 0 if nvec{T}} = emit{T, ntyp{'vuzp1', T}, T~~x, T~~y}
|
||||
def unzip{x:T, y:T, 1 if nvec{T}} = emit{T, ntyp{'vuzp2', T}, T~~x, T~~y}
|
||||
def shuf_ind{x:T, y:T, {...is} if nvec{T,32} and same{is, 2*range{vcount{T}}}} = T~~unzip{x,y,0}
|
||||
def shuf_ind{x:T, y:T, {...is} if nvec{T,32} and same{is, 1+2*range{vcount{T}}}} = T~~unzip{x,y,1}
|
||||
|
||||
def trn{x:T, y:T, 0 if nvec{T}} = emit{T, ntyp{'vtrn1', T}, x, y}
|
||||
def trn{x:T, y:T, 1 if nvec{T}} = emit{T, ntyp{'vtrn2', T}, x, y}
|
||||
|
||||
@ -22,10 +22,8 @@ def any_nonC32{M, x:T=[_]_ if hasarch{'X86_64'}} = {
|
||||
}
|
||||
def any_nonC32{(mask_none), x:[k](u64), y:[k](u64)} = {
|
||||
def T32 = [k*2]u32
|
||||
def hi = shuf_ind{T32~~x, T32~~y, match(k) {
|
||||
{2} => tup{1,3,5,7}
|
||||
{4} => tup{1,3,9,11,5,7,13,15} # all odd indices, in the order that vshufps can handle
|
||||
}}
|
||||
def hi = if (hasarch{'X86_64'}) T32~~vec_shuffle{[4]f32, tup{x, y}, 1,3,1,3} # gathers all odd-positioned 32-bit elements from both vectors in whatever order that vshufps can handle
|
||||
else pack{x, y, 1}
|
||||
anyne{hi, T32**cast_i{u32, cbqn_c32Tag{}<<16}, mask_none}
|
||||
}
|
||||
|
||||
|
||||
@ -41,9 +41,6 @@ def all_top{x:T=[k]_ if w128i{T}} = top_to_int{x} == (1<<k)-1
|
||||
def any_top{x:T if w128i{T, 16}} = any_hom{[8]i16~~x < [8]i16**0}
|
||||
def all_top{x:T if w128i{T, 16}} = all_hom{[8]i16~~x < [8]i16**0}
|
||||
|
||||
def x86_shufps_range{is, hi} = in_range{is,0,2, 0,4} and in_range{is,2,4, hi,hi+4}
|
||||
def shuf_ind{a:T, b:T=[4]E, {...is} if width{E}==32 and length{is}==4 and x86_shufps_range{is, 4}} = vec_shuffle{[4]f32, tup{a, b}, is&3}
|
||||
|
||||
def store_blended_hom{p:*E, m:M=[k]_, v:V=[k]E if w128i{M,width{E}} and w128{V}} = store{p, blend_hom{load{V, p}, v, m}}
|
||||
|
||||
def widen{T, x:X if w128i{T} and w128i{X} and w128s{T}==w128s{X} and elwidth{T}>elwidth{X}} = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user