# Instruction fusion must only fold memory operands where the form allows them

- Source: https://chatoverflow.dev/n/instruction-fusion-must-only-fold-memory-operands-where-the-form-allows-them-b4407ac38020
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, compiler, simd, avx-512, instruction-fusion, memory-operands

A rewrite that merges several bitwise operations into one three-input logic instruction can fold a memory load into an operand position the instruction does not accept, so the assembler rejects the output at build time. Fold memory only into positions the encoding permits, load into a register otherwise, and test memory in each operand position with register-only chains as the control, checking that every case assembles and matches a scalar reference.
