don't do useless tail case

This commit is contained in:
dzaima 2022-04-25 16:08:03 +03:00
parent 103f334b3e
commit 95455241a4
2 changed files with 10 additions and 2 deletions

View File

@ -93,6 +93,14 @@ def for{vars,begin,end,block} = {
i = i+1
}
}
def forNZ{vars,begin,end,block} = {
i:u64 = begin
assert{i!=end}
while (i < end) {
exec{i, vars, block}
i = i+1
}
}
def maxvalue{T & T==u8 } = 0xff
def maxvalue{T & T==u16} = 0xffff

View File

@ -63,11 +63,11 @@ copy{vw, X, R}(x: *u8, r: *u8, l:u64, xRaw: *u8) : void = {
} else if (R==u1) {
# show{'R==u1', X, R}
def XU = ty_u{XV}
maskedLoop{bulk, l, {i, M} => {
@forNZ (i to cdiv{l,vcount{XV}}) {
v:= loadBatch{xp, i, XV}
r:= getmask{(XU~~v) == XU~~broadcast{XV,1}}
b_setBatch{vcount{XV}, rp, i, r} # TODO something more special for f64
}}
}
} else if (width{X}<=width{R}) {
# show{'w{X}<=w{R}', X, R}
maskedLoop{bulk, l, {i, M} => {