diff --git a/src/core/stuff.c b/src/core/stuff.c index 84752482..1bccc180 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -402,37 +402,77 @@ NOINLINE bool atomEqualF(B w, B x) { decG(wd);decG(xd); return true; } +// Functions in eqFns compare segments for matching +// data argument comes from eqFnData +typedef bool (*EqFn)(void* a, void* b, u64 l, u64 data); +bool notEq(void* a, void* b, u64 l, u64 data) { return false; } + +static const u8 n = 99; +u8 eqFnData[] = { // for the main diagonal, amount to shift length by; otherwise, whether to swap arguments + 0,0,0,0,0,n,n,n, + 1,0,0,0,0,n,n,n, + 1,1,1,0,0,n,n,n, + 1,1,1,2,0,n,n,n, + 1,1,1,1,0,n,n,n, + n,n,n,n,n,0,0,0, + n,n,n,n,n,1,1,0, + n,n,n,n,n,1,1,2, +}; + #if SINGELI + #define F(X) avx2_equal_##X #define SINGELI_FILE equal #include "../utils/includeSingeli.h" - - typedef bool (*EqFn)(void* a, void* b, u64 l, u64 data); - bool notEq(void* a, void* b, u64 l, u64 data) { return false; } - - #define F(X) avx2_equal_##X - EqFn eqFns[] = { - F(1_1), F(1_8), F(1_16), F(1_32), F(1_f64), notEq, notEq, notEq, - F(1_8), F(8_8), F(s8_16), F(s8_32), F(s8_f64), notEq, notEq, notEq, - F(1_16), F(s8_16), F(8_8), F(s16_32), F(s16_f64), notEq, notEq, notEq, - F(1_32), F(s8_32), F(s16_32), F(8_8), F(s32_f64), notEq, notEq, notEq, - F(1_f64), F(s8_f64), F(s16_f64), F(s32_f64), F(f64_f64), notEq, notEq, notEq, - notEq, notEq, notEq, notEq, notEq, F(8_8), F(u8_16), F(u8_32), - notEq, notEq, notEq, notEq, notEq, F(u8_16), F(8_8), F(u16_32), - notEq, notEq, notEq, notEq, notEq, F(u8_32), F(u16_32), F(8_8), - }; - #undef F - static const u8 n = 99; - u8 eqFnData[] = { // for the main diagonal, amount to shift length by; otherwise, whether to swap arguments - 0,0,0,0,0,n,n,n, - 1,0,0,0,0,n,n,n, - 1,1,1,0,0,n,n,n, - 1,1,1,2,0,n,n,n, - 1,1,1,1,0,n,n,n, - n,n,n,n,n,0,0,0, - n,n,n,n,n,1,1,0, - n,n,n,n,n,1,1,2, - }; +#else + #define F(X) equal_##X + bool F(1_1)(void* w, void* x, u64 l, u64 d) { + u64* wp = w; u64* xp = x; + usz q = l/64; + for (usz i=0; i