add argument passing to makeOptBranch

This commit is contained in:
dzaima 2023-04-06 22:39:52 +03:00
parent 897c46df76
commit b0d8bcb428
3 changed files with 11 additions and 9 deletions

View File

@ -239,5 +239,7 @@ def eachx{F, ...args} = {
each{F, ...each{{x} => {if (istup{x}) x; else l**x}, args}}
}
def makeregs{v, n} = @collect(n) { reg:=v }
def makeregs{T, n & istype{T}} = @collect(n) { reg:=undefined{T} }
def undef{T, n & istype{T}} = @collect(n) undef{T}
def undef{Ts & istup{Ts}} = each{undef, Ts}
def undef{x:T} = undef{T}
def undef{T & istype{T}} = { reg:=undefined{T} }

View File

@ -12,7 +12,7 @@ include './mask'
def findFirst{C, M, F, ...v1} = {
def exit = makelabel{}
def args = each{{c:T}=>{ a:=undefined{T} }, M{...each{{c}=>tupsel{0,c}, v1}}}
def args = undef{M{...each{{c}=>tupsel{0,c}, v1}}}
def am = tuplen{tupsel{0,v1}}
each{{last, ...v2} => {
if (last or C{...v2}) {

View File

@ -43,13 +43,14 @@ def anyNonChar{M, x:T & isvec{T} & hasarch{'X86_64'}} = {
def makeOptBranch{enable, F} = {
def makeOptBranch{enable, Ts, F} = {
if (enable) {
def args = undef{Ts}
def skip = makelabel{}; goto{skip}
def start = setlabel{}
F{}
F{...args}
setlabel{skip}
start
{...vs} => { each{=, args, vs}; goto{start} }
} else {
'not defined'
}
@ -105,8 +106,7 @@ fn squeeze{vw, X, CHR, B}(x0:*void, len:Size) : u32 = {
}}
0
} else { # i16, i32, f64
iCont:Size = 0
def case_B = makeOptBranch{B, {} => {
def case_B = makeOptBranch{B, tup{Size}, {iCont} => {
maskedLoop{bulk, iCont, len, {i, M} => {
def XU = [bulk]u64
v:= XU ~~ loadBatch{xp, i, XV}
@ -160,7 +160,7 @@ fn squeeze{vw, X, CHR, B}(x0:*void, len:Size) : u32 = {
else ~homAll{tree_fold{&, each{==, as, bs}}}
}
if (cond) { # is any not an integer
if (B) { iCont=tupsel{0, is}; goto{case_B} } # if B, need to give an even more special result
if (B) case_B{tupsel{0, is}} # if B, need to give an even more special result
else return{0xffff_ffff} # else, not integer => float
}
int