diff --git a/src/builtins/compare.c b/src/builtins/compare.c index 297d9a90..e7629153 100644 --- a/src/builtins/compare.c +++ b/src/builtins/compare.c @@ -126,7 +126,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by; #include "../utils/includeSingeli.h" #else #define F(X) equal_##X - bool F(1_1)(void* w, void* x, ux l, u64 d) { + bool F(1_1)(void* w, void* x, u64 l, u64 d) { assert(l>0); u64* wp = w; u64* xp = x; usz q = l/64; @@ -134,7 +134,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by; usz r = (-l)%64; return r==0 || (wp[q]^xp[q])<0); \ + bool F(1_##N)(void* w, void* x, u64 l, u64 d) { assert(l>0); \ if (d!=0) { void* t=w; w=x; x=t; } \ u64* wp = w; T* xp = x; \ for (usz i=0; i0); INIT \ S* wp = w; T* xp = x; \ for (ux i=0; i0); return false; } +static NOINLINE bool notEq(void* a, void* b, u64 l, u64 data) { assert(l>0); return false; } +static NOINLINE bool eequalFloat(void* wp, void* xp, u64 l, u64 data) { + bool r = true; + for (ux i = 0; i < l; i++) { + f64 w = ((f64*)wp)[i]; + f64 x = ((f64*)xp)[i]; + r&= (w==x) | (w!=w & x!=x); + } + return r; +} #define MAKE_TABLE(NAME, F64_F64) \ INIT_GLOBAL MatchFn NAME[] = { \ diff --git a/src/singeli/src/equal.singeli b/src/singeli/src/equal.singeli index 7694cd9a..b3969e2d 100644 --- a/src/singeli/src/equal.singeli +++ b/src/singeli/src/equal.singeli @@ -11,7 +11,7 @@ def swap{w,x} = { } # width{W} ≤ width{X} -fn equal{W, X}(w:*void, x:*void, l:ux, d:u64) : u1 = { +fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = { def vw = arch_defvw{} def bulk = vw / width{X} if (W!=X) if (d!=0) swap{w,x} @@ -80,7 +80,7 @@ def any_ne_reflexive_qnan{M, a:V=[k](f64), b:V} = { # (a==b) | (isQNaN{a} & isQN ~andn_bit_none{M, t2, t1} } -fn equal_reflexive{}(w:*void, x:*void, l:ux, d:u64) : u1 = { +fn equal_reflexive{}(w:*void, x:*void, l:u64, d:u64) : u1 = { def w = *f64~~w def x = *f64~~x def bulk = arch_defvw{} / width{f64} diff --git a/src/utils/calls.h b/src/utils/calls.h index a92c5f5f..b605d3cd 100644 --- a/src/utils/calls.h +++ b/src/utils/calls.h @@ -26,7 +26,7 @@ CMP_DEF(le, AS); #define CMP_AA_IMM(FN, ELT, WHERE, WP, XP, LEN) CMP_AA_CALL(CMP_AA_FN(FN, ELT), WHERE, WP, XP, LEN) #define CMP_AS_IMM(FN, ELT, WHERE, WP, X, LEN) CMP_AS_CALL(CMP_AS_FN(FN, ELT), WHERE, WP, X, LEN) -typedef bool (*MatchFn)(void* a, void* b, ux l, u64 data); +typedef bool (*MatchFn)(void* a, void* b, u64 l, u64 data); extern INIT_GLOBAL MatchFn matchFns[]; extern INIT_GLOBAL MatchFn matchFnsR[]; extern u8 const matchFnData[];