Refactoring and renaming in select.singeli
This commit is contained in:
parent
7cb8cf5772
commit
e09d555eba
@ -6,9 +6,6 @@ include './avx2'
|
||||
include './mask'
|
||||
include 'util/tup'
|
||||
|
||||
def minBulk{w, A, B & width{A}< width{B}} = w/width{B}
|
||||
def minBulk{w, A, B & width{A}>=width{B}} = w/width{A}
|
||||
|
||||
# def:T - masked original content
|
||||
# b:B - pointer to data to index; if width{B}<width{eltype{T}}, padding bytes are garbage read after wanted position
|
||||
# idx - actual (unscaled) index list
|
||||
@ -21,26 +18,25 @@ def gather{def:T, b:B, idx:[4]i32, M & w256{T,64}} = {
|
||||
else T ~~ emit{[4]i64, '_mm256_i32gather_epi64', *i64~~b, idx, width{eltype{B}}/8}
|
||||
}
|
||||
|
||||
|
||||
select{rw, TI, TD}(w0:*void, x0:*void, r0:*void, wl:u64, xl:u64) : u1 = {
|
||||
def TIE = i32
|
||||
def TDE = tern{width{TD}<32, u32, TD}
|
||||
def bulk = minBulk{rw,TIE,TDE}
|
||||
def TIF = [bulk]TIE
|
||||
def TDF = [bulk]TDE
|
||||
def xlf = broadcast{TIF, cast_i{eltype{TIF}, xl}}
|
||||
def bulk = rw / width{TDE}
|
||||
def VI = [bulk]TIE
|
||||
def VD = [bulk]TDE
|
||||
def xlf = broadcast{VI, cast_i{TIE, xl}}
|
||||
|
||||
w:= *TI ~~ w0
|
||||
x:= *TD ~~ x0
|
||||
r:= *TD ~~ r0
|
||||
|
||||
maskedLoop{bulk, wl, {i, M} => {
|
||||
cw0:= loadBatch{w, i, TIF}
|
||||
cw0:= loadBatch{w, i, VI}
|
||||
cw1:= cw0+xlf
|
||||
cw:= blendF{cw0, cw1, cw0<broadcast{TIF, 0}} # TODO this is utilizing clang optimizing out the comparison
|
||||
cw:= blendF{cw0, cw1, cw0<broadcast{VI, 0}} # TODO this is utilizing clang optimizing out the comparison
|
||||
if (any{M{ty_u{cw} >= ty_u{xlf}}}) return{0}
|
||||
got:= gather{broadcast{TDF,0}, x, cw, M}
|
||||
if (TDE!=TD) got&= broadcast{TDF, (1<<width{TD})-1}
|
||||
got:= gather{broadcast{VD,0}, x, cw, M}
|
||||
if (TDE!=TD) got&= broadcast{VD, (1<<width{TD})-1}
|
||||
storeBatch{r, i, got, M}
|
||||
}}
|
||||
1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user