AVX-512 ternary functions

boolean function:

  • up to three variables are allowed
  • allowed operators: not, and, or, xor, alternatively ~, &, |, ^
  • for one- or two-variable functions values marked with ? are ignored

How to use ternarylogic in code?

C/C++: _mm512_ternarylogic_epi32(a, b, var_c, 0x??)
GNU as: vpternlogd $0x??, a, b, c
GO asm: VPTERNLOGD $0x??, a, b, c
a b c
000
001
010
011
100
101
110
111
hex

GitHub, last update: 2025-01-03