add unrolling to aarch64 cmp.singeli

This commit is contained in:
dzaima 2022-12-18 22:30:31 +02:00
parent f9c919d5ce
commit 30a6de0a31
3 changed files with 15 additions and 3 deletions

View File

@ -94,8 +94,10 @@ def lvec{T, n, w & isvec{T} & vcount{T}==n & elwidth{T}==w} = 1
def widen{T, x:X & T==X} = x
def narrow{T, x:X & T==eltype{X}} = x
def undefPromote{T, x:X & T==X} = T~~x
def andnz{x, y} = assert{'andnz not supported', show{x, y}}
def topBlend{f,t,m} = assert{'topBlend not supported', show{f,t,m}}
def andnz{...x} = assert{'andnz not supported', show{...x}}
def topBlend{...x} = assert{'topBlend not supported', show{...x}}
def topMask{...x} = assert{'topBlend not supported', show{...x}}
def pack{...x} = assert{'pack not supported', show{...x}}
def unroll{vars,begin,end,block & knum{begin} & knum{end}} = {

View File

@ -71,7 +71,13 @@ def any2bit{VT, unr, op, wS, wV, xS, xV, dst:*u64, len:(Size)} = {
assert{am>0}
while (ri < am) {
r:u64 = 0
@unroll (j to unr) r|= promote{u64, homMask{op{wV{xi+j}, xV{xi+j}}}} << (j*vcount{VT})
if (hasarch{'AARCH64'}) {
def step{j, n & n==1} = op{wV{xi+j}, xV{xi+j}}
def step{j, n & n>=2} = pack{step{j, n/2}, step{j+n/2, n/2}}
r = promote{u64, homMask{step{0, unr}}}
} else {
@unroll (j to unr) r|= promote{u64, homMask{op{wV{xi+j}, xV{xi+j}}}} << (j*vcount{VT})
}
b_setBatch{bulk, dst, ri, r}
xi+= unr
ri+= 1

View File

@ -101,6 +101,10 @@ def shr{S==[16]u8, x:T, n & w128{T}} = T ~~ emit{T, '_mm_bsrli_si128', x, n}
def min{a:T,b:T & T==[ 8]i16} = emit{T, '_mm_min_epi16', a, b}; def max{a:T,b:T & T==[ 8]i16} = emit{T, '_mm_max_epi16', a, b}
def min{a:T,b:T & T==[16]u8 } = emit{T, '_mm_min_epu8', a, b}; def max{a:T,b:T & T==[16]u8 } = emit{T, '_mm_max_epu8', a, b}
def packs{a:T,b:T & T==[8]i16} = emit{[16]i8, '_mm_packs_epi16', a, b}
def packs{a:T,b:T & T==[4]i32} = emit{[ 8]i16, '_mm_packs_epi32', a, b}
def packs{a:T,b:T & T==[8]u16} = emit{[16]u8, '_mm_packus_epi16', a, b}
def packs{a:T,b:T & T==[4]u32} = emit{[ 8]u16, '_mm_packus_epi32', a, b}
# shuffle stuff
def shuf{L, x:T, n & lvec{L,4,32} & w128{T} & knum{n}} = T ~~ emit{[4]i32, '_mm_shuffle_epi32', v2i{x}, n}