Fixes disassembler crashes on 2013 Haswell RTM instructions.
authorKevin Enderby <enderby@apple.com>
Mon, 11 Mar 2013 21:17:13 +0000 (21:17 +0000)
committerKevin Enderby <enderby@apple.com>
Mon, 11 Mar 2013 21:17:13 +0000 (21:17 +0000)
rdar://13318048

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrTSX.td
test/MC/Disassembler/X86/x86-64.txt
utils/TableGen/X86RecognizableInstr.cpp

index ad55058ede6cd02bf74edd837a60967bad008c0c..a37a8cc74417bca7a0bd61b1d86a178436c0df91 100644 (file)
@@ -22,7 +22,7 @@ def XBEGIN : I<0, Pseudo, (outs GR32:$dst), (ins),
 
 let isBranch = 1, isTerminator = 1, Defs = [EAX] in
 def XBEGIN_4 : Ii32PCRel<0xc7, MRM_F8, (outs), (ins brtarget:$dst),
-                         "xbegin\t$dst", []>;
+                         "xbegin\t$dst", []>, Requires<[HasRTM]>;
 
 def XEND : I<0x01, MRM_D5, (outs), (ins),
              "xend", [(int_x86_xend)]>, TB, Requires<[HasRTM]>;
index 134574149b44f98f385432bb0e3372ae4727da17..5de1d5978433ccdb8a1ce3df1d9d75795db60894 100644 (file)
 
 # CHECK: adoxq (%rax), %rax
 0xf3 0x48 0x0f 0x38 0xf6 0x00
+
+# CHECK: xbegin        53
+0xc7 0xf8 0x35 0x00 0x00 0x00
+
+# CHECK: xend
+0x0f 0x01 0xd5
+
+# CHECK: xabort $13
+0xc6 0xf8 0x0d
index b00f7ea2bad43b2885dc0491121a135d53710f91..8471faaaf62e55ea8367db67d5c6b3c30df45d12 100644 (file)
@@ -764,6 +764,17 @@ void RecognizableInstr::emitInstructionSpecifier(DisassemblerTables &tables) {
     HANDLE_OPERAND(immediate)
     HANDLE_OPERAND(immediate)
     break;
+  case X86Local::MRM_F8:
+    if (Opcode == 0xc6) {
+      assert(numPhysicalOperands == 1 &&
+             "Unexpected number of operands for X86Local::MRM_F8");
+      HANDLE_OPERAND(immediate)
+    } else if (Opcode == 0xc7) {
+      assert(numPhysicalOperands == 1 &&
+             "Unexpected number of operands for X86Local::MRM_F8");
+      HANDLE_OPERAND(relocation)
+    }
+    break;
   case X86Local::MRMInitReg:
     // Ignored.
     break;