From 563c30c5961872350a6c7dde1b79142fece63e16 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 16 Jun 2024 13:58:40 +0300 Subject: [PATCH] allSame Singeli helper, make NEON homMask accept signed types --- src/singeli/src/base.singeli | 3 +++ src/singeli/src/neon.singeli | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/singeli/src/base.singeli b/src/singeli/src/base.singeli index 820dc66f..e63ad62c 100644 --- a/src/singeli/src/base.singeli +++ b/src/singeli/src/base.singeli @@ -61,6 +61,9 @@ def oneVal{{h, ...t}} = { } def oneVal{{}} = {} def oneType{x} = oneVal{each{type, x}} +def allSame{{h, ...t}} = tree_fold{&, each{is{h,.}, t}} +def allSame{{_}} = 1 +def allSame{{}} = 1 def anyNum = match { {x:T}=>isprim{T}; {x} => knum{x} } def anyInt = match { {x:T}=>isint{T} ; {x} => knum{x} and (x>>0) == x } diff --git a/src/singeli/src/neon.singeli b/src/singeli/src/neon.singeli index 9f1bc2b6..63f99a5b 100644 --- a/src/singeli/src/neon.singeli +++ b/src/singeli/src/neon.singeli @@ -120,18 +120,18 @@ def homAll{x:T if nvec{T}} = bitAll{x} def homMask{x:T=[k]E if nvecu{T} and width{E}>=k} = { truncBits{k, fold_add{x & make{T, 1<