Bug 23670 - Invalid -mevexlig=256 encoding
Summary: Invalid -mevexlig=256 encoding
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.32
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-16 15:05 UTC by H.J. Lu
Modified: 2018-09-17 16:37 UTC (History)
0 users

See Also:
Host:
Target: i386,x86-64
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2018-09-16 15:05:42 UTC
[hjl@gnu-tools-1 i386]$ cat evex-lig-2.s
# Check EVEX non-LIG instructions with with -mevexlig=256

	.allow_index_reg
	.text
_start:
	{evex} vmovd %xmm4,(%ecx)
	{evex} vmovd %xmm4,%ecx
	{evex} vmovd (%ecx),%xmm4
	{evex} vmovd %ecx,%xmm4

	{evex} vmovq %xmm4,(%ecx)
	{evex} vmovq (%ecx),%xmm4

	{evex} vmovq %xmm4,%xmm6
[hjl@gnu-tools-1 i386]$ as --32 -o /tmp/x.o evex-lig-2.s -mevexlig=256
[hjl@gnu-tools-1 i386]$ objdump -dw /tmp/x.o

/tmp/x.o:     file format elf32-i386


Disassembly of section .text:

00000000 <_start>:
   0:	62 f1 7d 28 7e 21    	vmovd  %xmm4,(%ecx)
   6:	62 f1 7d 28 7e e1    	vmovd  %xmm4,%ecx
   c:	62 f1 7d 28 6e 21    	vmovd  (%ecx),%xmm4
  12:	62 f1 7d 28 6e e1    	vmovd  %ecx,%xmm4
  18:	62 f1 fd 28 d6 21    	vmovq  %xmm4,(%ecx)
  1e:	62 f1 fe 28 7e 21    	vmovq  (%ecx),%xmm4
  24:	62 f1 fe 28 7e f4    	vmovq  %xmm4,%xmm6
[hjl@gnu-tools-1 i386]$ 
[hjl@gnu-tools-1 sde-external-8.16.0-2018-01-30-lin]$ ./xed -d 62 f1 7d 28 7e 21
62F17D287E21
ERROR: GENERAL_ERROR Could not decode at offset: 0x0 PC: 0x0: [62F17D287E21000000000000000000]
[hjl@gnu-tools-1 sde-external-8.16.0-2018-01-30-lin]$ ./xed -d 62 f1 7d 28 6e 21
62F17D286E21
ERROR: GENERAL_ERROR Could not decode at offset: 0x0 PC: 0x0: [62F17D286E21000000000000000000]
[hjl@gnu-tools-1 sde-external-8.16.0-2018-01-30-lin]$ ./xed -d 62 f1 fd 28 d6 21 
62F1FD28D621
ERROR: GENERAL_ERROR Could not decode at offset: 0x0 PC: 0x0: [62F1FD28D621000000000000000000]
[hjl@gnu-tools-1 sde-external-8.16.0-2018-01-30-lin]$ ./xed -d 62 f1 fe 28 7e 21 
62F1FE287E21
ERROR: GENERAL_ERROR Could not decode at offset: 0x0 PC: 0x0: [62F1FE287E21000000000000000000]
[hjl@gnu-tools-1 sde-external-8.16.0-2018-01-30-lin]$
Comment 1 Sourceware Commits 2018-09-17 16:34:28 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=04e2a1829ea137ac23ac96e98fd60f9d720dcdcb

commit 04e2a1829ea137ac23ac96e98fd60f9d720dcdcb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 17 09:33:20 2018 -0700

    x86: Set EVex=2 on EVEX.128 only vmovd and vmovq
    
    EVEX "VMOVD xmm1, r32/m32", "VMOVD r32/m32, xmm2", "VMOVQ xmm1, r64/m64",
    "VMOVD r64/m64, xmm2", "VMOVQ xmm1, xmm2/m64" and "VMOVQ xmm1/m64, xmm2"
    can only be encoded with EVEX.128.  Set EVex=2 on EVEX.128 only vmovd and
    vmovq.
    
    gas/
    
    	PR gas/23670
    	* testsuite/gas/i386/evex-lig-2.d: New file.
    	* testsuite/gas/i386/evex-lig-2.s: Likewise.
    	* testsuite/gas/i386/x86-64-evex-lig-2.d: Likewise.
    	* testsuite/gas/i386/x86-64-evex-lig-2.s: Likewise.
    	* testsuite/gas/i386/i386.exp: Run evex-lig-2 and
    	x86-64-evex-lig-2.
    
    opcodes/
    
    	PR gas/23670
    	* i386-dis-evex.h (evex_table): Use EVEX_LEN_0F6E_P_2,
    	EVEX_LEN_0F7E_P_1, EVEX_LEN_0F7E_P_2 and EVEX_LEN_0FD6_P_2.
    	(EVEX_LEN_0F6E_P_2): New EVEX_LEN_TABLE entry.
    	(EVEX_LEN_0F7E_P_1): Likewise.
    	(EVEX_LEN_0F7E_P_2): Likewise.
    	(EVEX_LEN_0FD6_P_2): Likewise.
    	* i386-dis.c (USE_EVEX_LEN_TABLE): New.
    	(EVEX_LEN_TABLE): Likewise.
    	(EVEX_LEN_0F6E_P_2): New enum.
    	(EVEX_LEN_0F7E_P_1): Likewise.
    	(EVEX_LEN_0F7E_P_2): Likewise.
    	(EVEX_LEN_0FD6_P_2): Likewise.
    	(evex_len_table): New.
    	(get_valid_dis386): Handle USE_EVEX_LEN_TABLE.
    	* i386-opc.tbl: Set EVex=2 on EVEX.128 only vmovd and vmovq.
    	* i386-tbl.h: Regenerated.
Comment 2 H.J. Lu 2018-09-17 16:37:30 UTC
Fixed for 2.32.