From 056b18edd2e4fcfae434ba70dff3d8072c0e5461 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 4 Aug 2023 21:30:06 -0400 Subject: [PATCH] Move pext-based compress loop from C to Singeli --- src/builtins/slash.c | 27 ++++----------------------- src/singeli/src/slash.singeli | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/builtins/slash.c b/src/builtins/slash.c index d8c828ad..829dafab 100644 --- a/src/builtins/slash.c +++ b/src/builtins/slash.c @@ -439,30 +439,11 @@ static B compress(B w, B x, usz wia, u8 xl, u8 xt) { switch(xl) { default: r = compress_grouped(wp, x, wia, wsum, xt); break; case 0: { - u64* xp = bitarr_ptr(x); u64* rp; - #if defined(__BMI2__) || SINGELI - r = m_bitarrv(&rp,wsum); - u64 cw = 0; // current word - u64 ro = 0; // offset in word where next bit should be written; never 64 - for (usz i=0; i=64) { - *(rp++) = cw; - cw = ro? v>>(64-ro) : 0; - } - ro = ro2&63; - } - if (ro) *rp = cw; + u64* xp = bitarr_ptr(x); + u64* rp; r = m_bitarrv(&rp,wsum); + #if SINGELI + si_compress_bool(wp, xp, rp, wia); #else - r = m_bitarrv(&rp,wsum); for (usz i=0, ri=0; i= 64) { + store{r, 0, cw}; ++r + cw = 0; if (ro>0) cw = v>>(64-ro) + } + ro = ro2%64 + } + if (ro > 0) store{r, 0, cw} +} + +export{'si_compress_bool', compress_bool}