[PATCH] D11752: [X86] Pre-define __MOVBE__ when the target supports it.

Erik Verbruggen erik.verbruggen at me.com
Tue Aug 4 05:23:31 PDT 2015


erikjv created this revision.
erikjv added a reviewer: nicholas.
erikjv added a subscriber: cfe-commits.

http://reviews.llvm.org/D11752

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2064,6 +2064,7 @@
       HasAVX512VL;
   bool HasSHA;
   bool HasCX16;
+  bool HasMOVBE;
 
   /// \brief Enumeration of all of the X86 CPUs supported by Clang.
   ///
@@ -2248,7 +2249,8 @@
         HasADX(false), HasTBM(false), HasFMA(false), HasF16C(false),
         HasAVX512CD(false), HasAVX512ER(false), HasAVX512PF(false),
         HasAVX512DQ(false), HasAVX512BW(false), HasAVX512VL(false),
-        HasSHA(false), HasCX16(false), CPU(CK_Generic), FPMath(FP_Default) {
+        HasSHA(false), HasCX16(false), HasMOVBE(false), CPU(CK_Generic),
+        FPMath(FP_Default) {
     BigEndian = false;
     LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
@@ -2563,6 +2565,7 @@
     setFeatureEnabledImpl(Features, "bmi2", true);
     setFeatureEnabledImpl(Features, "rtm", true);
     setFeatureEnabledImpl(Features, "fma", true);
+    setFeatureEnabledImpl(Features, "movbe", true);
     // FALLTHROUGH
   case CK_IvyBridge:
     setFeatureEnabledImpl(Features, "rdrnd", true);
@@ -2599,6 +2602,7 @@
     setFeatureEnabledImpl(Features, "aes", true);
     setFeatureEnabledImpl(Features, "pclmul", true);
     setFeatureEnabledImpl(Features, "cx16", true);
+    setFeatureEnabledImpl(Features, "movbe", true);
     break;
   case CK_K6_2:
   case CK_K6_3:
@@ -2983,6 +2987,11 @@
       continue;
     }
 
+    if (Feature == "movbe") {
+      HasMOVBE = true;
+      continue;
+    }
+
     assert(Features[i][0] == '+' && "Invalid target feature!");
     X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
       .Case("avx512f", AVX512F)
@@ -3285,6 +3294,9 @@
   if (HasF16C)
     Builder.defineMacro("__F16C__");
 
+  if (HasMOVBE)
+    Builder.defineMacro("__MOVBE__");
+
   if (HasAVX512CD)
     Builder.defineMacro("__AVX512CD__");
   if (HasAVX512ER)
@@ -3386,6 +3398,7 @@
       .Case("bmi", HasBMI)
       .Case("bmi2", HasBMI2)
       .Case("cx16", HasCX16)
+      .Case("movbe", HasMOVBE)
       .Case("f16c", HasF16C)
       .Case("fma", HasFMA)
       .Case("fma4", XOPLevel >= FMA4)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11752.31316.patch
Type: text/x-patch
Size: 2171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150804/0e9ecf18/attachment.bin>


More information about the cfe-commits mailing list