[PATCH] D38786: Fix for Bug 30718 - Failure to disassemble certain MOV with rex.R

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 01:40:22 PDT 2017


avt77 updated this revision to Diff 119636.
avt77 added a comment.

I did changes accordingly to Craig's requirement: now it works (it seems there were problems with trunk updating).


https://reviews.llvm.org/D38786

Files:
  lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
  test/MC/Disassembler/X86/x86-64.txt


Index: test/MC/Disassembler/X86/x86-64.txt
===================================================================
--- test/MC/Disassembler/X86/x86-64.txt
+++ test/MC/Disassembler/X86/x86-64.txt
@@ -490,6 +490,9 @@
 # CHECK:  xchgw   %di, %ax
 0x66 0x3e 0x97
 
+# CHECK: movq    %rdx, %cs
+0x4c 0x8e 0xca
+
 # CHECK: movw    %bx, %cs:(%rsi,%rbp)
 0x2e 0x66 0x89 0x1c 0x2e
 # CHECK: movl    %ebx, %cs:(%esi,%ebp)
Index: lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
===================================================================
--- lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
+++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
@@ -1470,9 +1470,9 @@
     case TYPE_MM64:                                       \
       return prefix##_MM0 + (index & 0x7);                \
     case TYPE_SEGMENTREG:                                 \
-      if (index > 5)                                      \
+      if ((index & 7) > 5)                                \
         *valid = 0;                                       \
-      return prefix##_ES + index;                         \
+      return prefix##_ES + (index & 7);                   \
     case TYPE_DEBUGREG:                                   \
       return prefix##_DR0 + index;                        \
     case TYPE_CONTROLREG:                                 \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38786.119636.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171020/5cc920fb/attachment.bin>


More information about the llvm-commits mailing list