From 980f20df9a41deccb6c7fb4805cc36449a243ea2 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 2 Apr 2022 17:54:21 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9D=95=A8/=F0=9D=95=A9:=20move=20tail=20skip?= =?UTF-8?q?ping=20to=20BMI-less=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sfns.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 13774b93..5da6202c 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -531,15 +531,14 @@ B slash_c2(B t, B w, B x) { usz ri = 0; if (TI(w,elType)==el_bit) { - u64* wp = bitarr_ptr(w); - while (wia>0 && !bitp_get(wp,wia-1)) wia--; - usz wsum = bit_sum(wp, wia); - if (wsum==0) { dec(w); dec(x); return q_N(xf)? emptyHVec() : isF64(xf)? emptyIVec() : isC32(xf)? emptyCVec() : m_emptyFVec(xf); } B r; - switch(TI(x,elType)) { default: UD; - - #ifdef __BMI2__ - case el_bit: { u64* xp = bitarr_ptr(x); u64* rp; r = m_bitarrv(&rp,wsum+128); a(r)->ia = wsum; + u64* wp = bitarr_ptr(w); + u8 xe = TI(x,elType); + #ifdef __BMI2__ + usz wsum = bit_sum(wp, wia); + switch(xe) { + case el_bit: { + u64* xp = bitarr_ptr(x); u64* rp; r = m_bitarrv(&rp,wsum+128); a(r)->ia = wsum; u64 cw = 0; // current word u64 ro = 0; // offset in word where next bit should be written; never 64 for (usz i=0; iia-= 8; bmipopc_2slash8 (wp, xp, rp, wia); goto bit_ret; } + case el_i16: { i16* xp = i16any_ptr(x); i16* rp; r = m_i16arrv(&rp, wsum+16); a(r)->ia-= 16; bmipopc_2slash16(wp, xp, rp, wia); goto bit_ret; } #endif + } + #endif + + while (wia>0 && !bitp_get(wp,wia-1)) wia--; + #ifndef __BMI2__ + usz wsum = bit_sum(wp, wia); + #endif + if (wsum==0) { dec(w); dec(x); return q_N(xf)? emptyHVec() : isF64(xf)? emptyIVec() : isC32(xf)? emptyCVec() : m_emptyFVec(xf); } + switch(xe) { default: UD; - #if SINGELI && defined(__BMI2__) - case el_i8: { i8* xp = i8any_ptr (x); i8* rp; r = m_i8arrv (&rp, wsum+8); a(r)->ia-= 8; bmipopc_2slash8 (wp, xp, rp, wia); break; } - case el_i16: { i16* xp = i16any_ptr(x); i16* rp; r = m_i16arrv(&rp, wsum+16); a(r)->ia-= 16; bmipopc_2slash16(wp, xp, rp, wia); break; } - #else + #if !SINGELI case el_i8: { i8* xp = i8any_ptr (x); i8* rp; r = m_i8arrv (&rp,wsum); for (usz i=0; i