diff --git a/src/singeli/src/base.singeli b/src/singeli/src/base.singeli index c9d66bc8..cd37d90e 100644 --- a/src/singeli/src/base.singeli +++ b/src/singeli/src/base.singeli @@ -13,16 +13,11 @@ oper ~~ reinterpret infix right 55 oper ** broadcast infix right 55 def extend_each{G, ...args}{...fs} = each{{f, ...args} => (if (length{args}>0) G{...args} else G){f}, fs, ...args} -def isreg = kreg -def isconst = kcon -def istype = ktyp -def istup = ktup - def isunsigned{T} = isint{T} and not issigned{T} -def isvec {T} = istype{T} and same{typekind{T}, 'vector'} # TODO rename these to better reflect that they apply to types -def isprim{T} = istype{T} and same{typekind{T}, 'primitive'} -def isptr {T} = istype{T} and same{typekind{T}, 'pointer'} +def isvec {T} = ktyp{T} and same{typekind{T}, 'vector'} # TODO rename these to better reflect that they apply to types +def isprim{T} = ktyp{T} and same{typekind{T}, 'primitive'} +def isptr {T} = ktyp{T} and same{typekind{T}, 'pointer'} def any_num = match { {x:T}=>isprim{T}; {x} => knum{x} } def any_int = match { {x:T}=>isint{T}; {x} => knum{x} and (x>>0) == x } def int_idx{_, _} = 0 @@ -52,8 +47,8 @@ def tree_fold{F, x} = { def tree_fold{F, {x}} = x def eachx{F, ...args} = { - def l = tree_fold{__max, each{{x} => if(istup{x}) length{x} else 0, args}} - each{F, ...each{{x} => if (istup{x}) x else l**x, args}} + def l = tree_fold{__max, each{{x} => if(ktup{x}) length{x} else 0, args}} + each{F, ...each{{x} => if (ktup{x}) x else l**x, args}} } @@ -431,7 +426,7 @@ def make_branch{Ts, F} = { } def make_opt_branch{enable, Ts, F} = if (enable) make_branch{Ts, F} else 'not defined' -def undef{T, n if istype{T}} = @collect(n) undef{T} -def undef{Ts if istup{Ts}} = each{undef, Ts} +def undef{T, n if ktyp{T}} = @collect(n) undef{T} +def undef{Ts if ktup{Ts}} = each{undef, Ts} def undef{x:T} = undef{T} -def undef{T if istype{T}} = { reg:=undefined{T} } +def undef{T if ktyp{T}} = { reg:=undefined{T} } diff --git a/src/singeli/src/bitalign.singeli b/src/singeli/src/bitalign.singeli index 22d90fa8..8f9efcdd 100644 --- a/src/singeli/src/bitalign.singeli +++ b/src/singeli/src/bitalign.singeli @@ -18,11 +18,11 @@ def new_shuf{...vs0 if isvec{try_same_type{vs0,'!'}}, {...is}} = { # : [length{i assert{all{(is >= -2) & (is < vn*vcount{S})}, 'bad shuffle indices', ...vs, is} def widen_inds{sc, is} = flat_table{+, sc*is, range{sc}} def data0{(E)} = tup{...vs, is} - def data0{N if istype{N} and isunsigned{N} and NE} = { + def data0{W if ktyp{W} and isunsigned{W} and W>E} = { def sc = width{W} / width{E} if (ni%sc == 0) { def is2 = (select{is, sc*range{ni/sc}} / sc) >> 0 @@ -39,7 +39,7 @@ def new_shuf{...vs0 if isvec{try_same_type{vs0,'!'}}, {...is}} = { # : [length{i re_el{E, shuf_impl{width{E}*ni, ...vn**width{S}, data}} } -def new_shuf{w if istype{w} or knum{w}, ...vs if isvec{try_same_type{vs,'!'}} and (not isvec{w} or width{w} == width{type0{vs}}), {...is}} = { +def new_shuf{w if ktyp{w} or knum{w}, ...vs if isvec{try_same_type{vs,'!'}} and (not isvec{w} or width{w} == width{type0{vs}}), {...is}} = { def S = type0{vs} def D = if (isvec{w}) w else re_el{if (isprim{w}) w else ty_u{w}, S} S~~new_shuf{...each{~~{D,.}, vs}, is} diff --git a/src/singeli/src/scan_common.singeli b/src/singeli/src/scan_common.singeli index 3962f482..2d1b9dc2 100644 --- a/src/singeli/src/scan_common.singeli +++ b/src/singeli/src/scan_common.singeli @@ -2,7 +2,7 @@ def has_sel8 = hasarch{'SSSE3'} or hasarch{'AARCH64'} def sel8{v:V, t} = sel{[16]u8, v, make{re_el{i8,V}, t}} -def sel8{v:V, t if w256{V} and istup{t} and length{t}==16} = sel8{v, merge{t,t}} +def sel8{v:V, t if w256{V} and ktup{t} and length{t}==16} = sel8{v, merge{t,t}} local def rev{t} = { def l=length{t}; def j=l-1; select{j-t, j-range{l}} } local def rev{up,t} = if (up) t else rev{t} diff --git a/src/singeli/src/slash.singeli b/src/singeli/src/slash.singeli index cc1a532f..c855be5c 100644 --- a/src/singeli/src/slash.singeli +++ b/src/singeli/src/slash.singeli @@ -39,7 +39,7 @@ def arg{c,T} = if (c) *T else if (T==i32) T else tup{} # type of x # Modifies the input variable r # Assumes iter{} will increment r, by at most write_len def for_special_buffered{r:*T, write_len}{vars,begin,sum,iter} = { - assert{isreg{r}}; assert{begin==0} + assert{kreg{r}}; assert{begin==0} def tw = width{T} def ov = write_len-1 def bufn = 2*(ov+1) @@ -90,7 +90,7 @@ def getter{c, V=[k]T, x} = { {} => { v:=load{*V~~x, i}; ++i; v } } else { i := iota{V} - if (isreg{x}) i += V**cast_i{T,x} + if (kreg{x}) i += V**cast_i{T,x} ii := V**k {} => { v:=i; i+=ii; v } } @@ -373,7 +373,7 @@ fn compress_bool(w:*u64, x:*u64, r:*u64, n:u64) : void = { } ro = ro2%64 } - def extract{t, i if istup{t}} = select{t,i} + def extract{t, i if ktup{t}} = select{t,i} def v = pext_width{} if (v > 1) { def V = [v]u64