WojciechMula / ternary-logic

Support for ternary logic in SSE, XOP, AVX2 and x86 programs
Other
30 stars 9 forks source link

x86-x64 target #3

Closed HJLebbink closed 6 years ago

HJLebbink commented 6 years ago

I'd like to add a x86-x64 target, something like the following:

// code=0x04, function=(B and (A nor C)), lowered=((A or C) notand B), set=intel
template<> inline unsigned int ternary<0x04>(const unsigned int A, const unsigned int B, const unsigned int C) {
    const unsigned int t0 = A | C;
    const unsigned int t1 = ~t0 & B;
    return t1;
}

Simply because searching all truth-tables with 5 variables I only need 5 registers of 32-bits. The python you provided seems to allow such modifications, but I don't know where to start. Can I reuse sse_and_avx2.txt?

Personally I would manually rewrite ternary_sse.cpp with a lot of query-replaces. How would you have added an x86 target?

WojciechMula commented 6 years ago

I've just added these targets, please check the latest commit. Does it fulfill your needs?

HJLebbink commented 6 years ago

Excellent, works like a charm! Thanx