From 4c03520a07a8500cb56e725fa6f1a1ff569e076f Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 21 Apr 2022 18:33:36 +0300 Subject: [PATCH] use maskedLoop in dyarith --- src/singeli/src/dyarith.singeli | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/singeli/src/dyarith.singeli b/src/singeli/src/dyarith.singeli index e4d55c24..374aad78 100644 --- a/src/singeli/src/dyarith.singeli +++ b/src/singeli/src/dyarith.singeli @@ -79,17 +79,11 @@ def arithChk3{F, M, w:T, x:T, i} = { def arithChk3{F, M, w:T, x:T, i & f64==rootty{T}} = F{w,x} def arithAny{VT, F, W, X, r, len} = { - def bam = vcount{VT} - def vv = len/bam - @forv{VT} (r over i from 0 to vv) r = arithChk3{F, {x}=>x, W{i}, X{i}, i*bam} - left:= len&(bam-1) - if (left!=0) { - m:= maskOf{VT, left} - def mask{x:X} = x&cast_v{X,m} - def mask{x==0} = 1 - rv:= arithChk3{F, maskAfter{left}, W{vv}, X{vv}, vv*bam} - maskstoreF{cast_p{VT,r}, m, vv, rv} - } + def bulk = vcount{VT} + maskedLoop{bulk, len, {i, M} => { + rv:= arithChk3{F, M, W{i}, X{i}, i*bulk} + storeBatch{r, i, rv, M} + }} len }