binutils Newspaper
JULY 29, 2026
x86 Proposed

x86: Simplify VPBROADCASTQ -> VUNPCKLQDQ optimization.

Fixes an overzealous check in the x86 assembler's VPBROADCASTQ optimization.

This patch corrects an optimization in the x86 assembler related to the VPBROADCASTQ instruction. It removes an unnecessary check for the xmmword property on the source operand, which was overly strict and incorrectly disabled valid transformations. The fix ensures that the optimization correctly identifies when VPBROADCASTQ can be transformed into VUNPCKLQDQ.

In Details

Refines the x86 assembler's optimization for transforming VPBROADCASTQ to VUNPCKLQDQ. A previous commit incorrectly added a check for the xmmword property on the first operand (i.op[0]). This patch removes that redundant check, as it was only necessary to ensure the second operand is an xmmword, thereby allowing more correct transformations.

For Context
VPBROADCASTQ
An x86 AVX instruction that broadcasts a 64-bit integer value to all elements of a 128-bit XMM register.
VUNPCKLQDQ
An x86 AVX instruction that unpacks packed low quadwords from two XMM registers.
optimization
The process of modifying code to improve its efficiency, such as speed or size.
x86 assembler
The part of binutils that processes x86 assembly language code, translating it into machine code.
Filed Under: x86assemblerAVXoptimizationinstruction selection