From 4a5a1fa35bf13b59eacc7cc7f7d235da612d2815 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 21 Mar 2025 01:04:25 +0200 Subject: [PATCH] a couple more baseline utilities assert_hom to be expanded upon later --- src/singeli/src/base.singeli | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/singeli/src/base.singeli b/src/singeli/src/base.singeli index 48b6db45..3bde5ca6 100644 --- a/src/singeli/src/base.singeli +++ b/src/singeli/src/base.singeli @@ -166,6 +166,8 @@ def arch_defvw = if (hasarch{'AVX2'}) 256 else 128 def has_simd = hasarch{'X86_64'} or hasarch{'AARCH64'} def has_sel = hasarch{'AVX2'} or hasarch{'AARCH64'} def fast_BMI2{} = hasarch{'BMI2'} and not SLOW_PDEP +def assert_hom{{...vs}} = each{assert_hom, vs} +def assert_hom{x:[_]E if quality{E}=='u'} = x # test if vector has a specific width & element type def lvec = match { {[n]T, n, (width{T})} => 1; {T, n, w} => 0 } @@ -218,6 +220,7 @@ def hom_to_int{...vs if length{vs}>1} = { } def hom_to_int{x if ktup{x}} = hom_to_int{...x} def first_hom{x:[_]_} = ctz_ext{hom_to_int_ext{x}} +def popc_hom{v:(u1)} = promote{ux, v} def popc_hom{x:[_]_} = { def {n,m} = hom_to_int_ext{x} popc{m} / n