use singeli for c16lut generation

This commit is contained in:
dzaima 2022-04-02 17:19:20 +03:00
parent 49ff5a04ff
commit 40dc184063
2 changed files with 9 additions and 3 deletions

View File

@ -439,8 +439,6 @@ B select_c2(B t, B w, B x) {
#ifdef __BMI2__
#include <immintrin.h>
u64 c16lut[] = {0x0000000000000000, 0x000000000000ffff, 0x00000000ffff0000, 0x00000000ffffffff, 0x0000ffff00000000, 0x0000ffff0000ffff, 0x0000ffffffff0000, 0x0000ffffffffffff, 0xffff000000000000, 0xffff00000000ffff, 0xffff0000ffff0000, 0xffff0000ffffffff, 0xffffffff00000000, 0xffffffff0000ffff, 0xffffffffffff0000, 0xffffffffffffffff};
#if SINGELI
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"

View File

@ -15,11 +15,19 @@ def comp8{w:*u64, X, r:*i8, l:u64} = {
}
}
def tab{n,l} = {
def m=n-1; def t=tab{m,l}
def k = (1<<l - 1) << (m*l)
merge{t, k+t}
}
def tab{n==0,l} = tup{0}
c16lut:*u64 = tab{4,16}
def comp16{w:*u64, X, r:*i16, l:u64} = {
@for(w in reinterpret{*u8,w} over i to cdiv{l,8}) {
def step{w} = {
pc:= popc{w}
store{reinterpret{*u64,r}, 0, pext{promote{u64,X{}}, load{emit{*u64,'','c16lut'}, w}}}
store{reinterpret{*u64,r}, 0, pext{promote{u64,X{}}, load{c16lut, w}}}
r+= pc
}
step{w&15}