Author: Kivilinna, Jussi
Date: 2026/11/15
Version: 2026-11-15
Type: Research note
Fulltext (HTML, 140 KiB)
Fulltext (PDF, 1.3 MiB)
AVX-512 vpternlogd computes any 3-input boolean
function in one instruction. I searched, with a SAT solver, for the shortest
straight-line programs of such gates for the Serpent S-boxes and for every
affine equivalence class of 4-bit permutations, and confirmed the gate counts
with an exhaustive search. Every Serpent S-box and its inverse needs 7 or 8
gates, against 9–13 logic instructions that GCC generates from the
classic Osvik sequences. On Zen 5, where chains of these instructions
take 2 cycles per step, the round's critical path matters more than the gate
count, so a second search minimises the critical path across the whole round.
For the 302 affine classes of 4-bit permutations, the cheapest member of every
class needs at most 7 gates, and only two classes need 7; all minimums are
proven and all programs are listed in the appendix.
bit-slicing, S-box, AVX-512, ternary logic, vpternlogd, Serpent, SAT solver, exhaustive search, affine equivalence, circuit minimization