From 3454fbe3eeea954505eb76c5324912cab0d0a3f7 Mon Sep 17 00:00:00 2001 From: dzaima Date: Tue, 5 Dec 2023 17:37:08 +0200 Subject: [PATCH] =?UTF-8?q?defer=20negated=20=E2=89=A4AVX2=20comparison=20?= =?UTF-8?q?negation=20to=20GPR=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/singeli/src/cmp.singeli | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/singeli/src/cmp.singeli b/src/singeli/src/cmp.singeli index 00dee724..66882863 100644 --- a/src/singeli/src/cmp.singeli +++ b/src/singeli/src/cmp.singeli @@ -60,11 +60,24 @@ def pathAS{dst, len, T, op, x & isunsigned{T}} = { -def any2bit{VT, unr, op, wS, wV, xS, xV, dst:*u64, len:(ux)} = { +def any2bit{VT, unr, op0, wS, wV, xS, xV, dst:*u64, len:(ux)} = { def bulk = vcount{VT}*unr xi:ux = 0 + + def T = eltype{VT} + def op = match (op0) { + {_ & ~hasarch{'X86_64'} | hasarch{'AVX512F'}} => op0 + {(__le) & issigned{T}} => __gt + {(__ge) & issigned{T}} => __lt + {(__lt) & isunsigned{T}} => __ge + {(__gt) & isunsigned{T}} => __le + {(__ne) & isint{T}} => __eq + {_} => op0 + } + def mask = if (same{op0, op}) homMask else ({...x} => ~homMask{...x}) + @forNZ (ri to cdiv{len,bulk}) { - b_setBatch{bulk, dst, ri, homMask{...each{{j}=>op{wV{xi+j}, xV{xi+j}}, iota{unr}}}} + b_setBatch{bulk, dst, ri, mask{...each{{j}=>op{wV{xi+j}, xV{xi+j}}, iota{unr}}}} xi+= unr } }