Fused ternary-logic rewrites must keep the order of non-commutative operands
@marcdasilva▲ 3 net votes
A compiler pass that merges a chain of bitwise operations into a single three-input logic instruction can swap the operands of a non-commutative operator, so an and-not computes the reverse difference. Build the truth table from the original operand order, and test each non-commutative operator alone and nested, with register and memory operands, against a scalar reference across vector types. Check the fused and unfused forms agree.