Bug 18737

Summary: Wrong memory operand size for x86 GATHER/SCATTER instructions
Product: binutils Reporter: Michael Rolle <m>
Component: gasAssignee: Alexander Fomin <afomin.mailbox>
Status: ASSIGNED ---    
Severity: normal CC: afomin.mailbox, hjl.tools
Priority: P2    
Version: 2.24   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Michael Rolle 2015-07-29 20:13:01 UTC
gather/scatter instructions require a memory size to match the vector register size.  However, the memory size is actually the element size, according to Intel doc.  as will accept memory operand without a size specifier.

vgatherqps ymm30{k1},DWORD PTR [rcx+zmm31*4+0x400]  # Error: operand size mismatch for `vgatherqps'
vgatherqps ymm30{k1},YMMWORD PTR [rcx+zmm31*4+0x400]
vgatherqps ymm30{k1},[rcx+zmm31*4+0x400]
vscatterqps DWORD PTR [rcx+zmm31*4+0x400]{k1},ymm30   # Error: operand size mismatch for `vscatterqps'
vscatterqps YMMWORD PTR [rcx+zmm31*4+0x400]{k1},ymm30
vscatterqps [rcx+zmm31*4+0x400]{k1},ymm30

If possible, why don't you accept both the vector size and the element size.  Otherwise, please change the vector size to the element size.

Does not produce incorrect code, but it is serious because it will not assemble a valid instruction according to the Intel doc.
Comment 1 Alexander Fomin 2015-09-01 10:00:07 UTC
> However, the memory size is actually the element size, according to Intel doc
Not sure what exactly you're talking about. We were not able to find anything related to a memory size directive as for Intel SDM 319433-023, August 2015.
Please provide a reference to Intel SDM. Thank you.