From 93dd25e0e1dadd7f7c17b62b901212e7b7334512 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 30 Apr 2023 19:00:56 +0300 Subject: [PATCH] =?UTF-8?q?fast=20leading-axis=20for=20<>=E2=89=A4?= =?UTF-8?q?=E2=89=A5=3D=E2=89=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/cmp.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/builtins/cmp.c b/src/builtins/cmp.c index 147446e9..7c1bf65e 100644 --- a/src/builtins/cmp.c +++ b/src/builtins/cmp.c @@ -133,21 +133,29 @@ CMP_REC(ne, ne, swapped=0;) +B leading_axis_arith(FC2 fc2, B w, B x, usz* wsh, usz* xsh, ur mr); #define AL(X) u64* rp; B r = m_bitarrc(&rp, X); usz ria=IA(r) #define CMP_AA_D(CN, CR, NAME, PRE) NOINLINE B NAME##_AA(i32 swapped, B w, B x) { PRE \ - u8 xe = TI(x, elType); if (xe==el_B) goto bad; \ - u8 we = TI(w, elType); if (we==el_B) goto bad; \ - if (RNK(w)==RNK(x)) { if (!eqShape(w, x)) thrF("%U: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", swapped?CR:CN, swapped?x:w, swapped?w:x); \ - if (we!=xe) { B tw=w,tx=x; \ - we = aMakeEq(&tw, &tx, we, xe); \ - if (we==el_MAX) goto bad; \ - w=tw; x=tx; \ - } \ - AL(x); \ - if (ria) cmp_fns_##NAME##AA[we](rp, tyany_ptr(w), tyany_ptr(x), ria); \ - decG(w);decG(x); return r; \ + u8 xe = TI(x,elType); if (xe==el_B) goto base; \ + u8 we = TI(w,elType); if (we==el_B) goto base; \ + ur wr=RNK(w); usz* wsh=SH(w); \ + ur xr=RNK(x); usz* xsh=SH(x); \ + if (wr!=xr) { \ + ur mr = wr", "<", gt, )