This commit is contained in:
dzaima 2025-05-01 19:36:13 +03:00
parent 6f03371e3b
commit 94cdc28ea9
2 changed files with 4 additions and 1 deletions

View File

@ -294,6 +294,9 @@ def broadcast{V=[_]T, v} = vec_broadcast{V, if (knum{v}) v else promote{T,v}}
def make{V=[_]_, ...xs} = vec_make{V, ...xs} def make{V=[_]_, ...xs} = vec_make{V, ...xs}
def iota{V=[k]_} = make{V, ...range{k}} def iota{V=[k]_} = make{V, ...range{k}}
def absu{a:[_]_} = ty_u{__abs{a}} def absu{a:[_]_} = ty_u{__abs{a}}
def hom_ones{[k]E} = [k]E ** hom_ones{E}
def hom_ones{E if issigned{E}} = E ~~ -1
def hom_ones{E if isunsigned{E}} = E ~~ maxvalue{E}
def shuf = vec_shuffle def shuf = vec_shuffle

View File

@ -341,7 +341,7 @@ def pext_popc{x0:V, m0:V if hasarch{'PCLMUL'} and V==[2]u64} = {
m := m0 m := m0
x := x0 & m x := x0 & m
d := ~m << 1 # One bit of the position difference at x d := ~m << 1 # One bit of the position difference at x
c := V**tail{64} c := hom_ones{V}
@unroll (i to lb{scalwidth{V}}) { @unroll (i to lb{scalwidth{V}}) {
def sh = 1 << i def sh = 1 << i
def shift_at{v, s} = { v = (v&~s) | (v&s)>>sh } def shift_at{v, s} = { v = (v&~s) | (v&s)>>sh }