[llvm] r258135 - [X86] Add support for "xlat m8"

Marina Yatsina via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 08:35:39 PST 2016


Author: myatsina
Date: Tue Jan 19 10:35:38 2016
New Revision: 258135

URL: http://llvm.org/viewvc/llvm-project?rev=258135&view=rev
Log:
[X86] Add support for "xlat m8"

According to x86 spec "xlat m8" is a legal instruction and it is equivalent to "xlatb".

Differential Revision: http://reviews.llvm.org/D15150


Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/X86/intel-syntax.s

Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=258135&r1=258134&r2=258135&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jan 19 10:35:38 2016
@@ -2475,6 +2475,17 @@ bool X86AsmParser::ParseInstruction(Pars
         }
   }
 
+  // Transforms "xlat mem8" into "xlatb"
+  if ((Name == "xlat" || Name == "xlatb") && Operands.size() == 2) {
+    X86Operand &Op1 = static_cast<X86Operand &>(*Operands[1]);
+    if (Op1.isMem8()) {
+      Warning(Op1.getStartLoc(), "memory operand is only for determining the "
+                                 "size, (R|E)BX will be used for the location");
+      Operands.pop_back();
+      static_cast<X86Operand &>(*Operands[0]).setTokenValue("xlatb");
+    }
+  }
+
   return false;
 }
 

Modified: llvm/trunk/test/MC/X86/intel-syntax.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/intel-syntax.s?rev=258135&r1=258134&r2=258135&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/intel-syntax.s (original)
+++ llvm/trunk/test/MC/X86/intel-syntax.s Tue Jan 19 10:35:38 2016
@@ -775,3 +775,7 @@ movs dword ptr [eax], dword ptr [ebx]
 // CHECK: movsl (%esi), %es:(%edi)
 // CHECK-STDERR: memory operand is only for determining the size, ES:(R|E)DI will be used for the location
 // CHECK-STDERR: memory operand is only for determining the size, ES:(R|E)SI will be used for the location
+
+xlat byte ptr [eax]
+// CHECK: xlatb
+// CHECK-STDERR: memory operand is only for determining the size, (R|E)BX will be used for the location




More information about the llvm-commits mailing list