Bug 18723 - gas will not assemble EVEX coded instructions without zmm registers
Summary: gas will not assemble EVEX coded instructions without zmm registers
Status: RESOLVED WORKSFORME
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-27 02:04 UTC by Michael Rolle
Modified: 2019-03-16 22:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rolle 2015-07-27 02:04:53 UTC
gas complains about "invalid register operand" for an instruction using ymm16 .. ymm31, or same for xmm.  Likewise if it uses ymm0 -- ymm15 and an EVEX decorator.

I believe the source of this problem is that the templates file, opcodes/i386-opc.tbl, only has templates for ZMM operands.  At least in some cases, so I presume this applies across the board.  For example, vaddps has these entries in the EVEX section:

vaddps, 3, 0x58, None, 1, CpuAVX512F, Modrm|EVex=1|Masking=3|VexOpcode=0|VexVVVV=1|VexW=1|Broadcast=1|Disp8MemShift=6|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { RegZMM|Dword|ZMMword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S|Vec_Disp8, RegZMM, RegZMM }
vaddps, 4, 0x58, None, 1, CpuAVX512F, Modrm|EVex=1|Masking=3|VexOpcode=0|VexVVVV=1|VexW=1|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|StaticRounding|SAE, { Imm8, RegZMM, RegZMM, RegZMM }

I may have an out-of-date source, since I got it from the Cygwin package manager.  I know some files are out of date because they have bugs which have since been fixed and are fixed in the binutils binary package from Cygwin.  The `as` binary does, in fact, make these complaints, and it is version 2.24:

GNU assembler version 2.24.51 (x86_64-pc-cygwin) using BFD version (GNU Binutils) 2.24.51.20140703

I don't consider this a critical bug because it does not produce incorrect code.  However, by not accepting all of these valid instructions, it can be unusable for some programs.

By the way, objdump disassembly also gets things wrong with instructions that I have to assemble with .byte.  It gives me the right operand types, but if I have a broadcast decorator, it shows {1to8} or {1to16} as though the destination is 512 bits, regardless of the actual.  I'll file a separate bug for this.
Comment 1 H.J. Lu 2015-07-27 12:00:52 UTC
Please try binutils 2.25.  If it doesn't work, please provide a testcase.
Comment 2 H.J. Lu 2019-03-16 22:12:07 UTC
Closed.