diff --git a/src/singeli/src/base.singeli b/src/singeli/src/base.singeli index d36b5f43..fd656f9a 100644 --- a/src/singeli/src/base.singeli +++ b/src/singeli/src/base.singeli @@ -167,6 +167,8 @@ def widen{...x} = assert{'widen not supported', show{...x}} def narrow{...x} = assert{'narrow not supported', show{...x}} def unord{...x} = assert{'unord not supported', show{...x}} +def andnot{a, b & anyNum{a} & anyNum{b}} = a & ~b +oper &~ andnot infix none 35 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 diff --git a/src/singeli/src/cmp.singeli b/src/singeli/src/cmp.singeli index dad85fb9..4e829c7c 100644 --- a/src/singeli/src/cmp.singeli +++ b/src/singeli/src/cmp.singeli @@ -20,7 +20,7 @@ def cmp_err{x} = { emit{void, 'cmp_err'}; return{}; } fn cmpIX(dst:*u64, len:Size, x:u64, v:u1) : void = { nan:u1 = q_f64{x} if (~(nan | q_chr{x})) cmp_err{x} - fillbits{dst, len, v & ~nan, x} + fillbits{dst, len, v&~nan, x} } def eqne{op} = match{op,__eq}|match{op,__ne} diff --git a/src/singeli/src/select.singeli b/src/singeli/src/select.singeli index e8e4edf8..c38fba1e 100644 --- a/src/singeli/src/select.singeli +++ b/src/singeli/src/select.singeli @@ -7,8 +7,6 @@ include './mask' include './bitops' include 'util/tup' -oper &~ andnot infix none 35 - # def:T - masked original content # b:B - pointer to data to index; if width{B} { cw:= wrapChk{load{w, i}, VI,xlf, M} - byte:= sel{[16]i8, x, VI~~(([8]u32~~andnot{cw, low})>>3)} + byte:= sel{[16]i8, x, VI~~(([8]u32~~(cw&~low))>>3)} mask:= sel{[16]i8, b, cw & low} store{r, i, homMask{(mask & byte) == mask}} }} diff --git a/src/singeli/src/sse2.singeli b/src/singeli/src/sse2.singeli index d18b32ba..d3e7d5c1 100644 --- a/src/singeli/src/sse2.singeli +++ b/src/singeli/src/sse2.singeli @@ -201,7 +201,7 @@ def shuf{L, x:T, n & w128{T} & lvec{L,4,32} & knum{n}} = T ~~ emit{[4]i32, '_mm_ def shuf16Lo{x:T, n} = T~~emit{[8]i16, '_mm_shufflelo_epi16', x, n} def shuf16Hi{x:T, n} = T~~emit{[8]i16, '_mm_shufflehi_epi16', x, n} -def homBlend{f:T, t:T, m:M & w128{T} & w128i{M,elwidth{T}}} = T ~~ ((M~~t & m) | (M~~f & ~m)) +def homBlend{f:T, t:T, m:M & w128{T} & w128i{M,elwidth{T}}} = T ~~ ((M~~t & m) | (M~~f &~ m)) def homMaskStoreF{p:P, m:M, v:T & w128i{M} & w128{T,elwidth{M}} & eltype{P}==T} = store{p, 0, homBlend{load{p}, v, m}} def widen{T, x:X & w128i{T} & w128i{X} & w128s{T}==w128s{X} & elwidth{T}>elwidth{X}} = {