[PATCH] D39349: [X86] Make -march=i686 an alias of -march=pentiumpro

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 15:43:03 PDT 2017


craig.topper created this revision.

I think the only reason they are different is because we don't set __tune_i686__ for -march=i686 to match GCC. But GCC 4.9.0 seems to have changed this behavior and they do set it now. So I think they can aliases now.


https://reviews.llvm.org/D39349

Files:
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  test/Preprocessor/predefined-arch-macros.c


Index: test/Preprocessor/predefined-arch-macros.c
===================================================================
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -156,6 +156,8 @@
 // CHECK_I686_M32: #define __i686__ 1
 // CHECK_I686_M32: #define __pentiumpro 1
 // CHECK_I686_M32: #define __pentiumpro__ 1
+// CHECK_I686_M32: #define __tune_i686__ 1
+// CHECK_I686_M32: #define __tune_pentiumpro__ 1
 // CHECK_I686_M32: #define i386 1
 // RUN: not %clang -march=i686 -m64 -E -dM %s -o - 2>&1 \
 // RUN:     -target i386-unknown-linux \
Index: lib/Basic/Targets/X86.h
===================================================================
--- lib/Basic/Targets/X86.h
+++ lib/Basic/Targets/X86.h
@@ -122,7 +122,6 @@
     /// \name i686
     /// i686-generation processors, P6 / Pentium M microarchitecture based.
     //@{
-    CK_i686,
     CK_PentiumPro,
     CK_Pentium2,
     CK_Pentium3,
Index: lib/Basic/Targets/X86.cpp
===================================================================
--- lib/Basic/Targets/X86.cpp
+++ lib/Basic/Targets/X86.cpp
@@ -119,7 +119,6 @@
   case CK_i486:
   case CK_i586:
   case CK_Pentium:
-  case CK_i686:
   case CK_PentiumPro:
   case CK_Lakemont:
     break;
@@ -806,15 +805,8 @@
     Builder.defineMacro("__tune_pentium2__");
     LLVM_FALLTHROUGH;
   case CK_PentiumPro:
-    Builder.defineMacro("__tune_i686__");
-    Builder.defineMacro("__tune_pentiumpro__");
-    LLVM_FALLTHROUGH;
-  case CK_i686:
-    Builder.defineMacro("__i686");
-    Builder.defineMacro("__i686__");
-    // Strangely, __tune_i686__ isn't defined by GCC when CPU == i686.
-    Builder.defineMacro("__pentiumpro");
-    Builder.defineMacro("__pentiumpro__");
+    defineCPUMacros(Builder, "i686");
+    defineCPUMacros(Builder, "pentiumpro");
     break;
   case CK_Pentium4:
     defineCPUMacros(Builder, "pentium4");
@@ -1542,7 +1534,6 @@
   case CK_i586:
   case CK_Pentium:
   case CK_PentiumMMX:
-  case CK_i686:
   case CK_PentiumPro:
   case CK_Pentium2:
   case CK_Pentium3:
@@ -1606,8 +1597,7 @@
       .Case("i586", CK_i586)
       .Case("pentium", CK_Pentium)
       .Case("pentium-mmx", CK_PentiumMMX)
-      .Case("i686", CK_i686)
-      .Case("pentiumpro", CK_PentiumPro)
+      .Cases("i686", "pentiumpro", CK_PentiumPro)
       .Case("pentium2", CK_Pentium2)
       .Cases("pentium3", "pentium3m", CK_Pentium3)
       .Case("pentium-m", CK_PentiumM)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39349.120503.patch
Type: text/x-patch
Size: 2434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171026/f86c3a2c/attachment.bin>


More information about the cfe-commits mailing list