[PATCH] D39576: [X86] Add -mprefer-avx256 and -mprefer-avx128 to the clang driver

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 15:42:43 PDT 2017


craig.topper created this revision.

As proposed in this RFC http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html


https://reviews.llvm.org/D39576

Files:
  include/clang/Driver/Options.td
  test/Driver/x86-target-features.c


Index: test/Driver/x86-target-features.c
===================================================================
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -84,3 +84,13 @@
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-clzero %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CLZERO %s
 // CLZERO: "-target-feature" "+clzero"
 // NO-CLZERO: "-target-feature" "-clzero"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mprefer-avx128 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PREFERAVX128 %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-prefer-avx128 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PREFERAVX128 %s
+// PREFERAVX128: "-target-feature" "+prefer-avx128"
+// NO-PREFERAVX128: "-target-feature" "-prefer-avx128"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mprefer-avx256 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PREFERAVX256 %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-prefer-avx256 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PREFERAVX256 %s
+// PREFERAVX256: "-target-feature" "+prefer-avx256"
+// NO-PREFERAVX256: "-target-feature" "-prefer-avx256"
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -2500,6 +2500,10 @@
 def mno_pclmul : Flag<["-"], "mno-pclmul">, Group<m_x86_Features_Group>;
 def mpopcnt : Flag<["-"], "mpopcnt">, Group<m_x86_Features_Group>;
 def mno_popcnt : Flag<["-"], "mno-popcnt">, Group<m_x86_Features_Group>;
+def mprefer_avx128 : Flag<["-"], "mprefer-avx128">, Group<m_x86_Features_Group>;
+def mno_prefer_avx128 : Flag<["-"], "mno-prefer-avx128">, Group<m_x86_Features_Group>;
+def mprefer_avx256 : Flag<["-"], "mprefer-avx256">, Group<m_x86_Features_Group>;
+def mno_prefer_avx256 : Flag<["-"], "mno-prefer-avx256">, Group<m_x86_Features_Group>;
 def mprefetchwt1 : Flag<["-"], "mprefetchwt1">, Group<m_x86_Features_Group>;
 def mno_prefetchwt1 : Flag<["-"], "mno-prefetchwt1">, Group<m_x86_Features_Group>;
 def mprfchw : Flag<["-"], "mprfchw">, Group<m_x86_Features_Group>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39576.121399.patch
Type: text/x-patch
Size: 2192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171102/7bca779f/attachment-0001.bin>


More information about the llvm-commits mailing list