get rid of most custom sel{…} defs
This commit is contained in:
parent
4e12204c52
commit
6f03371e3b
@ -2,10 +2,6 @@
|
||||
def packQQ{a:T,b:T==[4]i64} = vec_shuffle{[4]i32, a, 0,2,1,1} | vec_shuffle{[4]i32, b, 1,1,0,2}
|
||||
def packQQ{{a, b}} = packQQ{a, b}
|
||||
|
||||
# structural operations
|
||||
def sel{L, x:T, i:I if w256{T} and lvec{L,8,32} and w256{I,32}} = vec_shuffle{L, x, i}
|
||||
def sel{L, x:T, i:I if w256{T} and lvec{L,16,8} and w256{I, 8}} = vec_shuffle{L, x, i}
|
||||
|
||||
# masked store; F variants may not be a single instruction
|
||||
def store_masked_top{p:*E, m:M=[k]_, v:V=[k]E if w256{V, 32} and w256i{M}} = emit{void, '_mm256_maskstore_epi32', *i32~~p, m, [8]i32~~v}
|
||||
def store_masked_top{p:*E, m:M=[k]_, v:V=[k]E if w256{V, 64} and w256i{M}} = emit{void, '_mm256_maskstore_pd', *f64~~p, m, [4]f64~~v}
|
||||
|
||||
@ -167,9 +167,7 @@ def has_sel = hasarch{'AVX2'} or hasarch{'AARCH64'}
|
||||
def fast_BMI2{} = hasarch{'BMI2'} and not SLOW_PDEP
|
||||
def assert_hom{{...vs}} = each{assert_hom, vs}
|
||||
def assert_hom{x:[_]E if quality{E}=='u'} = x
|
||||
|
||||
# test if vector has a specific width & element type
|
||||
def lvec = match { {[n]T, n, (width{T})} => 1; {T, n, w} => 0 }
|
||||
def sel{L=[_]_, v:[_]_, i:[_]_} = vec_shuffle{L, v, i}
|
||||
|
||||
# base cases
|
||||
def {
|
||||
@ -178,7 +176,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,reverse_units,broadcast_sel,absdiff_sum,mul_sum,mul_sum_sat,
|
||||
pair,pdep,pext,bzhi,rbit,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,
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ def unzip{x:T, y:T, 1 if nvec{T}} = emit{T, ntyp{'vuzp2', T}, T~~x, T~~y}
|
||||
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}
|
||||
|
||||
def sel{L, x:T, i:I if lvec{L,16,8} and w128{T} and nvec{I, 8}} = vec_select{eltype{L}, x, i}
|
||||
def lvec = match { {[n]T, n, (width{T})} => 1; {T, n, w} => 0 } # test if vector has a specific width & element type
|
||||
def sel{{...xs}, i:I if length{xs}>=1 and length{xs}<=4 and all_same{each{type,xs}} and lvec{one_type{xs},16,8} and nvec{I, 8}} = vec_select{xs, i}
|
||||
|
||||
|
||||
|
||||
@ -69,9 +69,6 @@ def narrow{T==i32, x:([2]f64)} = emit{[4]i32, '_mm_cvtpd_epi32', x}
|
||||
|
||||
|
||||
|
||||
# SSSE3
|
||||
def sel{L=[_]E, x:T, i:I if hasarch{'SSSE3'} and lvec{L,16,8} and w128{T} and w128i{I, 8}} = vec_select{E, x, i}
|
||||
|
||||
# SSE4.1
|
||||
# conversion
|
||||
def narrow{(i8 ), x:X if hasarch{'SSE4.1'} and w128i{X,32}} = sel{[16]u8, [16]i8~~x, make{[16]i8, 0,4,8,12, 0,0,0,0, 0,0,0,0, 0,0,0,0}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user