From d7a06befb5913aff7521a8ff0e5073ad8c1324f0 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 30 Nov 2022 16:15:50 -0500 Subject: [PATCH] Select implementation comments --- src/builtins/select.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/builtins/select.c b/src/builtins/select.c index 30bd3694..637401f9 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -1,3 +1,34 @@ +// First Cell and Select (⊏) + +// First Cell is just a slice + +// Complications in Select mostly come from range checks and negative 𝕨 +// Atom 𝕨 and any rank 𝕩: slice +// Rank-1 𝕩: +// Empty 𝕨: no selection +// Small 𝕩 with Singeli: use shuffles +// Boolean 𝕨: use bit_sel for blend or similar +// Boolean 𝕩 and larger 𝕨: convert to i8, select, convert back +// Boolean 𝕩 otherwise: select/shift bytes, reversed for fast writing +// TRIED pext, doesn't seem faster (mask built with shifts anyway) +// SHOULD squeeze 𝕨 if not ≀i32 to get to optimized cases +// Integer 𝕨 with Singeli: fused wrap, range-check, and gather +// COULD try selecting from boolean with gather +// COULD detect