[PATCH] [1/2] Adding a feature flag for TBM instruction set

Yunzhong Gao Yunzhong_Gao at playstation.sony.com
Tue Sep 17 11:25:25 PDT 2013


ygao added you to the CC list for the revision "[1/2] Adding a feature flag for TBM instruction set".

Hi,
This patch adds a feature flag to the llvm backend for x86 TBM instruction set (to be added later). Could someone take a look whether this is good to go in?
Many thanks,
- Gao.

http://llvm-reviews.chandlerc.com/D1692

Files:
  lib/Target/X86/X86Subtarget.h
  lib/Target/X86/X86Subtarget.cpp
  lib/Target/X86/X86.td

Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -97,6 +97,9 @@
   /// HasXOP - Target has XOP instructions
   bool HasXOP;
 
+  /// HasTBM - Target has TBM instructions.
+  bool HasTBM;
+
   /// HasMOVBE - True if the processor has the MOVBE instruction.
   bool HasMOVBE;
 
@@ -271,6 +274,7 @@
   // FIXME: Favor FMA when both are enabled. Is this the right thing to do?
   bool hasFMA4() const { return HasFMA4 && !HasFMA; }
   bool hasXOP() const { return HasXOP; }
+  bool hasTBM() const { return HasTBM; }
   bool hasMOVBE() const { return HasMOVBE; }
   bool hasRDRAND() const { return HasRDRAND; }
   bool hasF16C() const { return HasF16C; }
Index: lib/Target/X86/X86Subtarget.cpp
===================================================================
--- lib/Target/X86/X86Subtarget.cpp
+++ lib/Target/X86/X86Subtarget.cpp
@@ -376,6 +376,10 @@
         ToggleFeature(X86::FeatureCDI);
       }
     }
+    if (IsAMD && ((ECX >> 21) & 0x1)) {
+      HasTBM = true;
+      ToggleFeature(X86::FeatureTBM);
+    }
   }
 }
 
@@ -484,6 +488,7 @@
   HasFMA = false;
   HasFMA4 = false;
   HasXOP = false;
+  HasTBM = false;
   HasMOVBE = false;
   HasRDRAND = false;
   HasF16C = false;
Index: lib/Target/X86/X86.td
===================================================================
--- lib/Target/X86/X86.td
+++ lib/Target/X86/X86.td
@@ -117,6 +117,8 @@
 def FeatureAES     : SubtargetFeature<"aes", "HasAES", "true",
                                       "Enable AES instructions",
                                       [FeatureSSE2]>;
+def FeatureTBM     : SubtargetFeature<"tbm", "HasTBM", "true",
+                                      "Enable TBM instructions">;
 def FeatureMOVBE   : SubtargetFeature<"movbe", "HasMOVBE", "true",
                                       "Support MOVBE instruction">;
 def FeatureRDRAND  : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1692.1.patch
Type: text/x-patch
Size: 2004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130917/a0602ff7/attachment.bin>


More information about the llvm-commits mailing list