[llvm] r184207 - Add support for encoding the HLE XACQUIRE and XRELEASE prefixes.

Stefanus Du Toit stefanus.du.toit at intel.com
Tue Jun 18 10:08:10 PDT 2013


Author: sdt
Date: Tue Jun 18 12:08:10 2013
New Revision: 184207

URL: http://llvm.org/viewvc/llvm-project?rev=184207&view=rev
Log:
Add support for encoding the HLE XACQUIRE and XRELEASE prefixes.

For decoding, keep the current behavior of always decoding these as their REP
versions. In the future, this could be improved to recognize the cases where
these behave as XACQUIRE and XRELEASE and decode them as such.


Added:
    llvm/trunk/test/MC/X86/x86_64-hle-encoding.s
Modified:
    llvm/trunk/lib/Target/X86/X86InstrTSX.td
    llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp

Modified: llvm/trunk/lib/Target/X86/X86InstrTSX.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrTSX.td?rev=184207&r1=184206&r2=184207&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrTSX.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrTSX.td Tue Jun 18 12:08:10 2013
@@ -37,3 +37,10 @@ def XTEST : I<0x01, MRM_D6, (outs), (ins
 def XABORT : Ii8<0xc6, MRM_F8, (outs), (ins i8imm:$imm),
                  "xabort\t$imm",
                  [(int_x86_xabort imm:$imm)]>, Requires<[HasRTM]>;
+
+// HLE prefixes
+
+def XACQUIRE_PREFIX : I<0xF2, RawFrm, (outs), (ins), "xacquire", []>, Requires<[HasHLE]>;
+
+def XRELEASE_PREFIX : I<0xF3, RawFrm, (outs), (ins), "xrelease", []>, Requires<[HasHLE]>;
+

Added: llvm/trunk/test/MC/X86/x86_64-hle-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86_64-hle-encoding.s?rev=184207&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/x86_64-hle-encoding.s (added)
+++ llvm/trunk/test/MC/X86/x86_64-hle-encoding.s Tue Jun 18 12:08:10 2013
@@ -0,0 +1,9 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s
+
+// CHECK: xacquire
+// CHECK: [0xf2]
+    xacquire
+
+// CHECK: xrelease
+// CHECK: [0xf3]
+    xrelease

Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=184207&r1=184206&r2=184207&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original)
+++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Tue Jun 18 12:08:10 2013
@@ -461,6 +461,12 @@ RecognizableInstr::filter_ret Recognizab
       Name == "VMOVQs64rr")
     return FILTER_WEAK;
 
+  // XACQUIRE and XRELEASE reuse REPNE and REP respectively.
+  // For now, just prefer the REP versions.
+  if (Name == "XACQUIRE_PREFIX" ||
+      Name == "XRELEASE_PREFIX")
+    return FILTER_WEAK;
+
   if (HasFROperands && Name.find("MOV") != Name.npos &&
      ((Name.find("2") != Name.npos && Name.find("32") == Name.npos) ||
       (Name.find("to") != Name.npos)))





More information about the llvm-commits mailing list