Instruction Fusion: How CPUs Combine Two Instructions Into One

2026-05-13

Compilers emit instructions one at a time, but modern CPUs are smarter than that. Instruction fusion is the hardware trick where the front-end detects pairs of adjacent instructions that always travel together and merges them into a single micro-op (µop) that flows through the pipeline as one entity. Fewer µops means less pressure on the reorder buffer, fewer scheduler entries consumed, and one retirement slot instead of two.

There are two flavors, and they happen at different stages:

Concrete example. Consider a tight loop counter:

loop:
  dec rcx
  jnz loop

Without fusion, that's 2 µops per iteration. With macro-op fusion (which works for dec/jcc, sub/jcc, and/jcc, test/jcc, cmp/jcc), it becomes 1 fused µop. On a 4-wide retire CPU, this doubles your effective loop throughput from 2 iterations/cycle to 4 iterations/cycle — assuming the branch predictor cooperates.

Rule of thumb. If your hot loop's IPC seems suspiciously high (say, 5 IPC on a 4-wide machine), fusion is the explanation. Measure UOPS_RETIRED.MACRO_FUSED via perf: perf stat -e uops_retired.macro_fused ./your_program. Ratio of fused to total retired µops above ~10% is common in branch-heavy code.

Constraints that bite.

This is why hand-rolled assembly that schedules cmp far from its jcc "for ILP" is usually slower than the naive adjacent form — you've forfeited a free µop.

See it in action: Check out HDPE Pipe joint video. by Bbc Majumder Vlog to see this theory applied.
Key Takeaway: Fusion lets the CPU treat common instruction pairs as one µop, so keep cmp/test/dec/sub immediately adjacent to their conditional branches — separating them costs throughput.

All newsletters