by mmozeiko · 2y ago · 0 comments
(NOT A) OR ((NOT B) XOR (C AND A))
then you simply write ~_MM_TERNLOG_A | (~_MM_TERNLOG_B ^ (_MM_TERNLOG_C & _MM_TERNLOG_A))
Literally the expression you want to calculate. It evaluates to immediate from _MM_TERNLOG_A/B/C constants defined in intrinsic headers, at least for gcc & clang: typedef enum {
_MM_TERNLOG_A = 0xF0,
_MM_TERNLOG_B = 0xCC,
_MM_TERNLOG_C = 0xAA
} _MM_TERNLOG_ENUM;
For MSVC you define them yourself. A = 0b11110000
B = 0b11001100
C = 0b10101010That said, the trick for turning four or more argument bitwise operations into a series of vpternlogd operations has yet to be posted
For five or more arguments, this naturally extends into a tree, though it likely isn't the most efficient encoding.