From 53737ab3fbafddafd9fbbc469174d734997be046 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 10 Feb 2023 22:24:46 +0200 Subject: [PATCH] use BMI2 for narrowing <32-bit cells --- src/utils/bits.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/utils/bits.c b/src/utils/bits.c index 80e9af76..83bbb663 100644 --- a/src/utils/bits.c +++ b/src/utils/bits.c @@ -171,6 +171,11 @@ NOINLINE B widenBitArr(B x, ur axis) { return zeroPadToCellBits0(x, axis, shProd(SH(x), 0, axis), pcsz, ncsz); } + +#if defined(__BMI2__) && !SLOW_PDEP + #define FAST_PDEP 1 +#endif + B narrowWidenedBitArr(B x, ur axis, ur cr, usz* csh) { // for now assumes the bits to be dropped are zero, origCellBits is a multiple of 8, and that there's at most 63 padding bits if (TI(x,elType)!=el_bit) return taga(cpyBitArr(x)); @@ -200,12 +205,33 @@ B narrowWidenedBitArr(B x, ur axis, ur cr, usz* csh) { // for now assumes the bi // FILL_TO(rp, el_bit, 0, m_f64(1), PIA(r)); ABState ab = ab_new(rp); if (xcsz<=64 && (xcsz&(xcsz-1)) == 0) { - switch(xcsz) { default: UD; - case 8: for (ux i=0; i>6; // full u64 count per cell in x