diff --git a/src/builtins/scan.c b/src/builtins/scan.c index 90371f60..e6e6953c 100644 --- a/src/builtins/scan.c +++ b/src/builtins/scan.c @@ -230,8 +230,8 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f; if (xe==el_bit) { if (!q_i64(w)) goto base; - i64 wv = o2i64(w); - if (wv>=(1ULL<<53) || wv+(i64)ia >= (1ULL<<53)) goto base; + i64 wv = o2i64G(w); + if (wv<=(-(1LL<<53)) || wv>=(1LL<<53) || wv+(i64)ia >= (1LL<<53)) goto base; B t = scan_add_bool(x, ia); return wv==0? t : C2(add, w, t); } diff --git a/src/singeli/src/neon.singeli b/src/singeli/src/neon.singeli index a0b84018..8e4e7804 100644 --- a/src/singeli/src/neon.singeli +++ b/src/singeli/src/neon.singeli @@ -99,6 +99,12 @@ def undefPromote{T, x:X & w64{X} & w128{T} & eltype{T}==eltype{X}} = emit{T, nty def half{x:T, n==0 & w128{T}} = emit{v_half{T}, ntyp0{'vget_low', T}, x} def half{x:T, n==1 & w128{T}} = emit{v_half{T}, ntyp0{'vget_high', T}, x} def extract{x:T,n & nvec{T} & knum{n}} = emit{eltype{T}, ntyp{'vget', '_lane', T}, x, n} +def copyLane{dst:D, di, src:S, si & w64{D} & nvec{S} & eltype{D}==eltype{S}} = emit{D, ntyp{'vcopy_lane', S}, dst, di, src, si} +def copyLane{dst:D, di, src:S, si & w128{D} & nvec{S} & eltype{D}==eltype{S}} = emit{D, ntyp{'vcopyq_lane', S}, dst, di, src, si} +def vshl{a:T, b:T, n & knum{n}} = emit{T, ntyp{'vext', T}, a, b, n} + +def zip1{a:T, b:T & nvec{T}} = emit{T, ntyp{'vzip1', T}, a, b} +def zip2{a:T, b:T & nvec{T}} = emit{T, ntyp{'vzip2', T}, a, b} def packLo{x:T, y:T & nvec{T}} = { def H=ty_half{T}; emit{H, ntyp{'vuzp1', H}, H~~x, H~~y} } def packHi{x:T, y:T & nvec{T}} = { def H=ty_half{T}; emit{H, ntyp{'vuzp2', H}, H~~x, H~~y} } @@ -150,6 +156,7 @@ def make{T, ...xs & nvec{T} & tuplen{xs}==vcount{T}} = { load{*T ~~ *TE ~~ each{{c}=>promote{eltype{T},c}, xs}, 0} } def make{T, x & nvec{T} & istup{x}} = make{T, ...x} +def iota{T & nvec{T}} = make{T, ...iota{vcount{T}}} def homMask{x:T & nvecu{T} & elwidth{T}>=vcount{T}} = { diff --git a/src/singeli/src/sse.singeli b/src/singeli/src/sse.singeli index fc40c888..b48ee71a 100644 --- a/src/singeli/src/sse.singeli +++ b/src/singeli/src/sse.singeli @@ -2,7 +2,7 @@ include './sse2' ### SSSE3 ### def sel{L, x:T, i:I & lvec{L,16,8} & w128{T} & w128i{I, 8}} = T ~~ emit{[16]u8, '_mm_shuffle_epi8', v2i{x}, i} - +def vshl{a:T, b:T, n} = T~~emit{[16]u8, '_mm_alignr_epi8', v2i{b}, v2i{a}, n*(elwidth{T}/8)} ### SSE4.1 ###