Bug 23028

Summary: inconsistent disassemble of vcvtpd2dq
Product: gdb Reporter: H.J. Lu <hjl.tools>
Component: gdbAssignee: H.J. Lu <hjl.tools>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.1   
Target Milestone: 8.1.1   
See Also: https://sourceware.org/bugzilla/show_bug.cgi?id=23025
Host: Target:
Build: Last reconfirmed:

Description H.J. Lu 2018-04-04 15:05:23 UTC
[hjl@gnu-cfl-1 binutils]$ cat z.s
	.text
foo:
vcvtpd2dqx 0x20(%rax),%xmm0
vcvtpd2dq 0x20(%rax){1to2},%xmm0
vcvtpd2dqx 0x20(%rax),%xmm0
[hjl@gnu-cfl-1 binutils]$ gcc -c z.s
[hjl@gnu-cfl-1 binutils]$ gdb z.o
GNU gdb (GDB) Fedora 8.0.1-36.2.fc27
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from z.o...(no debugging symbols found)...done.
(gdb) disass foo
Dump of assembler code for function foo:
   0x0000000000000000 <+0>:	vcvtpd2dqx 0x20(%rax),%xmm0
   0x0000000000000005 <+5>:	vcvtpd2dq 0x20(%rax){1to2},%xmm0
   0x000000000000000c <+12>:	vcvtpd2dq 0x20(%rax),%xmm0
                                ^^^^^^^^^^ This should be vcvtpd2dqx.
End of assembler dump.
(gdb) 

[hjl@gnu-cfl-1 binutils]$ objdump -dw z.o

z.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
   0:	c5 fb e6 40 20       	vcvtpd2dqx 0x20(%rax),%xmm0
   5:	62 f1 ff 18 e6 40 04 	vcvtpd2dq 0x20(%rax){1to2},%xmm0
   c:	c5 fb e6 40 20       	vcvtpd2dqx 0x20(%rax),%xmm0
[hjl@gnu-cfl-1 binutils]$
Comment 1 cvs-commit@gcc.gnu.org 2018-04-04 15:56:36 UTC
The gdb-8.1-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit f13be04ec6cc83947d8c4997aa48296a915b637f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Apr 4 04:36:44 2018 -0700

    i386: Clear vex instead of vex.evex
    
    "vex" has many fields to control how to decode an instruction.  Clear
    all fields in "vex" before decoding an instruction to avoid using values
    left from the previous instruction.
    
    gas/
    
    	PR gdb/23028
    	PR binutils/23025
    	* testsuite/gas/i386/prefix.s: Add tests for vcvtpd2dq with
    	VEX and EVEX prefixes.
    	* testsuite/gas/i386/prefix.d: Updated.
    
    opcodes/
    
    	PR gdb/23028
    	PR binutils/23025
    	* i386-dis.c (get_valid_dis386): Don't set vex.prefix nor vex.w
    	to 0.
    	(print_insn): Clear vex instead of vex.evex.
    
    (cherry picked from commit caf0678c84b5b55fbc4bcc853954745a4ad8b658)
Comment 2 H.J. Lu 2018-04-04 15:56:52 UTC
Fixed for GDB 8.1.1.