x86: Fix VPBROADCASTQ optimization in assembler
The assembler incorrectly optimizes `vpbroadcastq` with a YMM destination; this patch fixes it by checking for an XMM destination.
H.J. Lu provides a patch that fixes an incorrect optimization in the x86 assembler. The original optimization of vpbroadcastq %xmmN, %xmmM to vpunpcklqdq %xmmN, %xmmN, %xmmM didn’t check if the destination was an XMM register, leading to incorrect code generation when the destination was a YMM register. The patch adds this check.
In Details
This patch addresses an issue in the x86 assembler's instruction optimization logic. The assembler attempts to replace vpbroadcastq with vpunpcklqdq for 128-bit operations. The bug occurs because the code doesn't validate the destination register size, leading to AVX instruction corruption when a YMM register is used as the destination.
For Context
The assembler is a tool that translates assembly language (human-readable instructions) into machine code. This patch fixes an error in the assembler that caused it to generate incorrect machine code for a specific x86 instruction (vpbroadcastq) when used with certain types of registers (YMM).