[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-04 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #10 from Sourceware Commits  ---
The master branch has been updated by Haochen Jiang :

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

commit 4c0a6e603743ca0c85f9ceb9913d646f0c961986
Author: H.J. Lu 
Date:   Mon Dec 2 12:58:33 2024 +0800

x86: Eliminate unnecessary {evex} prefixes

For several instructions including vps{l,r}l{d,q,w,dq} and vpsra{d,w},
their VEX part do not have the following version:

vpsrlw $0x1f,(%r15,%rcx,4),%xmm0

Thus, {evex} prefix should not be inserted when their second operand is
memory, while we still need them for register as second operand. Add a
new macro %ME to solve this problem.

For vpsraq, there is no VEX version, so the {evex} prefix should always
be eliminated.

gas/ChangeLog:

PR binutils/32403
* testsuite/gas/i386/i386.exp: Run new test.
* testsuite/gas/i386/x86-64.exp: Ditto.
* testsuite/gas/i386/evex-only.d: New test.
* testsuite/gas/i386/evex-only.s: Ditto.
* testsuite/gas/i386/x86-64-evex-only.d: Ditto.
* testsuite/gas/i386/x86-64-evex-only.s: Ditto.

opcodes/ChangeLog:

PR binutils/32403
* i386-dis-evex-reg.h: Use %ME instead of %XE for vps{l,r}l{w,dq}
and vpsraw. Split table for vpsra{d,q}.
* i386-dis-evex-w.h: Use %ME instead of %XE for vps{l,r}l{d,q}
and vpsrad. Eliminate vpsraq {evex} prefix.
* i386-dis-evex.h: Split table for vpsra{d,q}.
* i386-dis.c: (EVEX_W_0F72_R_4): New.
(EVEX_W_0FE2): Ditto.
(struct dis386): Add comment for %ME.
(putop): Handle %ME.

Co-authored-by: Haochen Jiang 
Signed-off-by: H.J. Lu 

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-04 Thread haochen.jiang at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

Haochen Jiang  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #11 from Haochen Jiang  ---
Fixed on trunk.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-02 Thread haochen.jiang at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #9 from Haochen Jiang  ---
Proposed patch:

https://sourceware.org/pipermail/binutils/2024-December/137954.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

H.J. Lu  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |haochen.jiang at intel 
dot com

--- Comment #8 from H.J. Lu  ---
(In reply to Haochen Jiang from comment #7)
> (In reply to H.J. Lu from comment #5)
> > Created attachment 15811 [details]
> > There are more.
> 
> Thanks!
> 
> I would prefer the name as something like ME not Xe to avoid confusion for
> lower case letters in mnemonics.
> 
> Also oappend are used for new code when appending "{evex}".
> 
> Other LGTM.

Please take it over.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-02 Thread haochen.jiang at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #7 from Haochen Jiang  ---
(In reply to H.J. Lu from comment #5)
> Created attachment 15811 [details]
> There are more.

Thanks!

I would prefer the name as something like ME not Xe to avoid confusion for
lower case letters in mnemonics.

Also oappend are used for new code when appending "{evex}".

Other LGTM.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #6 from H.J. Lu  ---
I got

$ cat x.s
.text
vpsrlw $0x1f,(%r15,%rcx,4),%xmm0
vpsraw $0x1f,(%r15,%rcx,4),%xmm0
vpsllw $0x1f,(%r15,%rcx,4),%xmm0
vpsrad $0x1f,(%r15,%rcx,4),%xmm0
vpsraq $0x1f,(%r15,%rcx,4),%xmm0
vpsrldq $0x1f,(%r15,%rcx,4),%xmm0
vpslldq $0x1f,(%r15,%rcx,4),%xmm0
vpsrld $0x1f,(%r15,%rcx,4),%xmm0
vpslld $0x1f,(%r15,%rcx,4),%xmm0
vpsrlq $0x1f,(%r15,%rcx,4),%xmm0
vpsllq $0x1f,(%r15,%rcx,4),%xmm0
$ make
./as  -o x.o x.s
./objdump -dw x.o

x.o: file format elf64-x86-64


Disassembly of section .text:

 <.text>:
   0:   62 d1 7d 08 71 14 8f 1f vpsrlw $0x1f,(%r15,%rcx,4),%xmm0
   8:   62 d1 7d 08 71 24 8f 1f vpsraw $0x1f,(%r15,%rcx,4),%xmm0
  10:   62 d1 7d 08 71 34 8f 1f vpsllw $0x1f,(%r15,%rcx,4),%xmm0
  18:   62 d1 7d 08 72 24 8f 1f vpsrad $0x1f,(%r15,%rcx,4),%xmm0
  20:   62 d1 fd 08 72 24 8f 1f vpsraq $0x1f,(%r15,%rcx,4),%xmm0
  28:   62 d1 7d 08 73 1c 8f 1f vpsrldq $0x1f,(%r15,%rcx,4),%xmm0
  30:   62 d1 7d 08 73 3c 8f 1f vpslldq $0x1f,(%r15,%rcx,4),%xmm0
  38:   62 d1 7d 08 72 14 8f 1f vpsrld $0x1f,(%r15,%rcx,4),%xmm0
  40:   62 d1 7d 08 72 34 8f 1f vpslld $0x1f,(%r15,%rcx,4),%xmm0
  48:   62 d1 fd 08 73 14 8f 1f vpsrlq $0x1f,(%r15,%rcx,4),%xmm0
  50:   62 d1 fd 08 73 34 8f 1f vpsllq $0x1f,(%r15,%rcx,4),%xmm0
$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

H.J. Lu  changed:

   What|Removed |Added

  Attachment #15809|0   |1
is obsolete||

--- Comment #5 from H.J. Lu  ---
Created attachment 15811
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15811&action=edit
There are more.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-01 Thread haochen.jiang at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #4 from Haochen Jiang  ---
(In reply to Haochen Jiang from comment #3)
> I will have a look into that.
> 
> From my memory in assembler implementation, the {evex} prefix relies on and
> only on the register usage. It won't check memory and will not consider
> whether an instruction with memory and immediate operands are only available
> with EVEX encoding.

Oh sorry, made a typo, I mean disassembler.

I will go through the instructions to see if there are any more.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-01 Thread haochen.jiang at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #3 from Haochen Jiang  ---
I will have a look into that.

>From my memory in assembler implementation, the {evex} prefix relies on and
only on the register usage. It won't check memory and will not consider whether
an instruction with memory and immediate operands are only available with EVEX
encoding.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

--- Comment #2 from H.J. Lu  ---
Created attachment 15809
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15809&action=edit
A patch

Something like this.  Haochen, can you take it over?  Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/32403] objdump -d reports a superfluous "{evex}" string

2024-12-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32403

H.J. Lu  changed:

   What|Removed |Added

 CC||haochen.jiang at intel dot com,
   ||hjl.tools at gmail dot com
   Last reconfirmed||2024-12-01
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
Some instructions, like vpsrld, with memory and immediate operands are only
available with EVEX encoding.

-- 
You are receiving this mail because:
You are on the CC list for the bug.