mstorsjo updated this revision to Diff 121623.
mstorsjo retitled this revision from "[X86] Add 3dnow and 3dnowa to the list of 
valid target features" to "[X86] Fix the spelling of 3dnow and 3dnowa in 
isValidFeatureName".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Updated based on Craig's comments.


https://reviews.llvm.org/D39631

Files:
  lib/Basic/Targets/X86.cpp
  test/Headers/mm3dnow.c


Index: test/Headers/mm3dnow.c
===================================================================
--- /dev/null
+++ test/Headers/mm3dnow.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
+// expected-no-diagnostics
+
+#if defined(i386) || defined(__x86_64__)
+#include <mm3dnow.h>
+
+int __attribute__((__target__(("3dnow")))) foo(int a) {
+  _m_femms();
+  return 4;
+}
+
+__m64 __attribute__((__target__(("3dnowa")))) bar(__m64 a) {
+  return _m_pf2iw(a);
+}
+#endif
Index: lib/Basic/Targets/X86.cpp
===================================================================
--- lib/Basic/Targets/X86.cpp
+++ lib/Basic/Targets/X86.cpp
@@ -1121,6 +1121,8 @@
 
 bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
   return llvm::StringSwitch<bool>(Name)
+      .Case("3dnow", true)
+      .Case("3dnowa", true)
       .Case("aes", true)
       .Case("avx", true)
       .Case("avx2", true)
@@ -1147,8 +1149,6 @@
       .Case("fxsr", true)
       .Case("lwp", true)
       .Case("lzcnt", true)
-      .Case("mm3dnow", true)
-      .Case("mm3dnowa", true)
       .Case("mmx", true)
       .Case("movbe", true)
       .Case("mpx", true)


Index: test/Headers/mm3dnow.c
===================================================================
--- /dev/null
+++ test/Headers/mm3dnow.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
+// expected-no-diagnostics
+
+#if defined(i386) || defined(__x86_64__)
+#include <mm3dnow.h>
+
+int __attribute__((__target__(("3dnow")))) foo(int a) {
+  _m_femms();
+  return 4;
+}
+
+__m64 __attribute__((__target__(("3dnowa")))) bar(__m64 a) {
+  return _m_pf2iw(a);
+}
+#endif
Index: lib/Basic/Targets/X86.cpp
===================================================================
--- lib/Basic/Targets/X86.cpp
+++ lib/Basic/Targets/X86.cpp
@@ -1121,6 +1121,8 @@
 
 bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
   return llvm::StringSwitch<bool>(Name)
+      .Case("3dnow", true)
+      .Case("3dnowa", true)
       .Case("aes", true)
       .Case("avx", true)
       .Case("avx2", true)
@@ -1147,8 +1149,6 @@
       .Case("fxsr", true)
       .Case("lwp", true)
       .Case("lzcnt", true)
-      .Case("mm3dnow", true)
-      .Case("mm3dnowa", true)
       .Case("mmx", true)
       .Case("movbe", true)
       .Case("mpx", true)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to