binutils Newspaper
NOVEMBER 30, 2026
x86/apx — Proposed

x86/APX: optimize {nf} forms of IMUL with all-ones immediate

Replaces IMUL instructions with an all-ones immediate with NEG, simplifying the instruction and potentially improving performance.

This patch optimizes specific forms of the x86 IMUL instruction when the immediate value is all ones (-1). It replaces these IMUL operations with the equivalent NEG (negate) instruction, which can lead to simpler instruction sequences and potential performance benefits.

In Details

This change targets gas's x86 instruction selection for APX. It identifies imul instructions where the immediate operand is -1 (all ones) and rewrites them as neg. This is applicable to various operand sizes and forms, including imulzu (unsigned multiply immediate to extended register).

For Context
x86
A family of instruction set architectures (ISAs) for CPUs, commonly used in personal computers and servers.
APX
Advanced Performance Extensions, a set of new instructions and features for x86 processors.
{nf}
Refers to instruction forms that do not utilize fused operations, often implying more explicit or less optimized instruction sequences.
IMUL
Integer Multiply instruction in x86 architecture.
immediate value
A constant value embedded directly within an instruction.
NEG
Negate instruction in x86 architecture, which performs two's complement negation.
Filed Under: binutilsx86optimizationassembly