<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
 bool PPCTargetInfo::hasFeature(<u></u>StringRef Feature) const {<br>
-  return Feature == "powerpc";<br>
+  return (Feature == "powerpc" ||<br>
+         (Feature == "vsx" && HasVSX) ||<br>
+         (Feature == "power8-vector" && HasP8Vector));<br>
 }<br>
<br>
<br></blockquote><div><br></div><div>Can you make this a StringSwitch?</div><div><br></div><div>Also, feature of "power8-vector"? What's that supposed to be?</div><div><br></div><div>-eric</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified: cfe/trunk/lib/Headers/altivec.<u></u>h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=220989&r1=220988&r2=220989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/Headers/<u></u>altivec.h?rev=220989&r1=<u></u>220988&r2=220989&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/lib/Headers/altivec.<u></u>h (original)<br>
+++ cfe/trunk/lib/Headers/altivec.<u></u>h Fri Oct 31 14:19:24 2014<br>
@@ -2667,9 +2667,21 @@ vec_max(vector unsigned int __a, vector<br>
 static vector float __ATTRS_o_ai<br>
 vec_max(vector float __a, vector float __b)<br>
 {<br>
+#ifdef __VSX__<br>
+  return __builtin_vsx_xvmaxsp(__a, __b);<br>
+#else<br>
   return __builtin_altivec_vmaxfp(__a, __b);<br>
+#endif<br>
 }<br>
<br>
+#ifdef __VSX__<br>
+static vector double __ATTRS_o_ai<br>
+vec_max(vector double __a, vector double __b)<br>
+{<br>
+  return __builtin_vsx_xvmaxdp(__a, __b);<br>
+}<br>
+#endif<br>
+<br>
 /* vec_vmaxsb */<br>
<br>
 static vector signed char __ATTRS_o_ai<br>
@@ -2795,7 +2807,11 @@ vec_vmaxuw(vector unsigned int __a, vect<br>
 static vector float __attribute__((__always_<u></u>inline__))<br>
 vec_vmaxfp(vector float __a, vector float __b)<br>
 {<br>
+#ifdef __VSX__<br>
+  return __builtin_vsx_xvmaxsp(__a, __b);<br>
+#else<br>
   return __builtin_altivec_vmaxfp(__a, __b);<br>
+#endif<br>
 }<br>
<br>
 /* vec_mergeh */<br>
@@ -3299,8 +3315,20 @@ vec_min(vector unsigned int __a, vector<br>
 static vector float __ATTRS_o_ai<br>
 vec_min(vector float __a, vector float __b)<br>
 {<br>
+#ifdef __VSX__<br>
+  return __builtin_vsx_xvminsp(__a, __b);<br>
+#else<br>
   return __builtin_altivec_vminfp(__a, __b);<br>
+#endif<br>
+}<br>
+<br>
+#ifdef __VSX__<br>
+static vector double __ATTRS_o_ai<br>
+vec_min(vector double __a, vector double __b)<br>
+{<br>
+  return __builtin_vsx_xvmindp(__a, __b);<br>
 }<br>
+#endif<br>
<br>
 /* vec_vminsb */<br>
<br>
@@ -3427,7 +3455,11 @@ vec_vminuw(vector unsigned int __a, vect<br>
 static vector float __attribute__((__always_<u></u>inline__))<br>
 vec_vminfp(vector float __a, vector float __b)<br>
 {<br>
+#ifdef __VSX__<br>
+  return __builtin_vsx_xvminsp(__a, __b);<br>
+#else<br>
   return __builtin_altivec_vminfp(__a, __b);<br>
+#endif<br>
 }<br>
<br>
 /* vec_mladd */<br>
<br>
Modified: cfe/trunk/lib/Sema/DeclSpec.<u></u>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=220989&r1=220988&r2=220989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/Sema/<u></u>DeclSpec.cpp?rev=220989&r1=<u></u>220988&r2=220989&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/lib/Sema/DeclSpec.<u></u>cpp (original)<br>
+++ cfe/trunk/lib/Sema/DeclSpec.<u></u>cpp Fri Oct 31 14:19:24 2014<br>
@@ -18,6 +18,7 @@<br>
 #include "clang/AST/<u></u>NestedNameSpecifier.h"<br>
 #include "clang/AST/TypeLoc.h"<br>
 #include "clang/Basic/LangOptions.h"<br>
+#include "clang/Basic/TargetInfo.h"<br>
 #include "clang/Lex/Preprocessor.h"<br>
 #include "clang/Parse/ParseDiagnostic.<u></u>h" // FIXME: remove this back-dependency!<br>
 #include "clang/Sema/LocInfoType.h"<br>
@@ -689,11 +690,6 @@ bool DeclSpec::SetTypeSpecType(TST T, So<br>
   }<br>
   TypeSpecType = T;<br>
   TypeSpecOwned = false;<br>
-  if (TypeAltiVecVector && !TypeAltiVecBool && (TypeSpecType == TST_double)) {<br>
-    PrevSpec = DeclSpec::getSpecifierName((<u></u>TST) TypeSpecType, Policy);<br>
-    DiagID = diag::err_invalid_vector_decl_<u></u>spec;<br>
-    return true;<br>
-  }<br>
   return false;<br>
 }<br>
<br>
@@ -987,6 +983,13 @@ void DeclSpec::Finish(<u></u>DiagnosticsEngine<br>
       if ((TypeSpecType == TST_char) || (TypeSpecType == TST_int) ||<br>
           (TypeSpecWidth != TSW_unspecified))<br>
         TypeSpecSign = TSS_unsigned;<br>
+    } else if (TypeSpecType == TST_double) {<br>
+      // vector long double and vector long long double are never allowed.<br>
+      // vector double is OK for Power7 and later.<br>
+      if (TypeSpecWidth == TSW_long || TypeSpecWidth == TSW_longlong)<br>
+        Diag(D, TSWLoc, diag::err_invalid_vector_long_<u></u>double_decl_spec);<br>
+      else if (!PP.getTargetInfo().<u></u>hasFeature("vsx"))<br>
+        Diag(D, TSTLoc, diag::err_invalid_vector_<u></u>double_decl_spec);<br>
     } else if (TypeSpecWidth == TSW_long) {<br>
       Diag(D, TSWLoc, diag::warn_vector_long_decl_<u></u>spec_combination)<br>
         << getSpecifierName((TST)<u></u>TypeSpecType, Policy);<br>
<br>
Added: cfe/trunk/test/CodeGen/<u></u>builtins-ppc-vsx.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-vsx.c?rev=220989&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/test/<u></u>CodeGen/builtins-ppc-vsx.c?<u></u>rev=220989&view=auto</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/test/CodeGen/<u></u>builtins-ppc-vsx.c (added)<br>
+++ cfe/trunk/test/CodeGen/<u></u>builtins-ppc-vsx.c Fri Oct 31 14:19:24 2014<br>
@@ -0,0 +1,40 @@<br>
+// REQUIRES: powerpc-registered-target<br>
+// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s<br>
+<br>
+vector float vf = { -1.5, 2.5, -3.5, 4.5 };<br>
+vector double vd = { 3.5, -7.5 };<br>
+double d = 23.4;<br>
+<br>
+vector float res_vf;<br>
+vector double res_vd;<br>
+double res_d;<br>
+<br>
+void test1() {<br>
+// CHECK-LABEL: define void @test1<br>
+<br>
+  /* vec_max */<br>
+  res_vf = vec_max(vf, vf);<br>
+// CHECK: @llvm.ppc.vsx.xvmaxsp<br>
+<br>
+  res_vd = vec_max(vd, vd);<br>
+// CHECK: @llvm.ppc.vsx.xvmaxdp<br>
+<br>
+  res_vf = vec_vmaxfp(vf, vf);<br>
+// CHECK: @llvm.ppc.vsx.xvmaxsp<br>
+<br>
+  /* vec_min */<br>
+  res_vf = vec_min(vf, vf);<br>
+// CHECK: @llvm.ppc.vsx.xvminsp<br>
+<br>
+  res_vd = vec_min(vd, vd);<br>
+// CHECK: @llvm.ppc.vsx.xvmindp<br>
+<br>
+  res_vf = vec_vminfp(vf, vf);<br>
+// CHECK: @llvm.ppc.vsx.xvminsp<br>
+<br>
+  res_d = __builtin_vsx_xsmaxdp(d, d);<br>
+// CHECK: @llvm.ppc.vsx.xsmaxdp<br>
+<br>
+  res_d = __builtin_vsx_xsmindp(d, d);<br>
+// CHECK: @llvm.ppc.vsx.xsmindp<br>
+}<br>
<br>
Modified: cfe/trunk/test/Parser/altivec.<u></u>c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/altivec.c?rev=220989&r1=220988&r2=220989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/test/Parser/<u></u>altivec.c?rev=220989&r1=<u></u>220988&r2=220989&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/test/Parser/altivec.<u></u>c (original)<br>
+++ cfe/trunk/test/Parser/altivec.<u></u>c Fri Oct 31 14:19:24 2014<br>
@@ -61,15 +61,15 @@ vector unsigned long v_ul;          // e<br>
 vector long int v_li;               // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
 vector signed long int v_sli;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
 vector unsigned long int v_uli;     // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
-__vector long double  vv_ld;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
-vector long double  v_ld;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
+__vector long double  vv_ld;        // expected-error {{cannot use 'long double' with '__vector'}}<br>
+vector long double  v_ld;           // expected-error {{cannot use 'long double' with '__vector'}}<br>
 vector bool v_b;                    // expected-warning {{type specifier missing, defaults to 'int'}}<br>
<br>
 // These should have errors.<br>
-__vector double vv_d1;               // expected-error {{cannot use 'double' with '__vector'}}<br>
-vector double v_d2;                  // expected-error {{cannot use 'double' with '__vector'}}<br>
-__vector long double  vv_ld3;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
-vector long double  v_ld4;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
+__vector double vv_d1;               // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}<br>
+vector double v_d2;                  // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}<br>
+__vector long double  vv_ld3;        // expected-error {{cannot use 'long double' with '__vector'}}<br>
+vector long double  v_ld4;           // expected-error {{cannot use 'long double' with '__vector'}}<br>
 vector bool float v_bf;              // expected-error {{cannot use 'float' with '__vector bool'}}<br>
 vector bool double v_bd;             // expected-error {{cannot use 'double' with '__vector bool'}}<br>
 vector bool pixel v_bp;              // expected-error {{cannot use '__pixel' with '__vector bool'}}<br>
<br>
Modified: cfe/trunk/test/Parser/cxx-<u></u>altivec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-altivec.cpp?rev=220989&r1=220988&r2=220989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/test/Parser/<u></u>cxx-altivec.cpp?rev=220989&r1=<u></u>220988&r2=220989&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/test/Parser/cxx-<u></u>altivec.cpp (original)<br>
+++ cfe/trunk/test/Parser/cxx-<u></u>altivec.cpp Fri Oct 31 14:19:24 2014<br>
@@ -61,14 +61,14 @@ vector unsigned long v_ul;          // e<br>
 vector long int v_li;               // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
 vector signed long int v_sli;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
 vector unsigned long int v_uli;     // expected-warning {{Use of 'long' with '__vector' is deprecated}}<br>
-__vector long double  vv_ld;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
-vector long double  v_ld;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
+__vector long double  vv_ld;        // expected-error {{cannot use 'long double' with '__vector'}}<br>
+vector long double  v_ld;           // expected-error {{cannot use 'long double' with '__vector'}}<br>
<br>
 // These should have errors.<br>
-__vector double vv_d1;               // expected-error {{cannot use 'double' with '__vector'}}<br>
-vector double v_d2;                  // expected-error {{cannot use 'double' with '__vector'}}<br>
-__vector long double  vv_ld3;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
-vector long double  v_ld4;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}<br>
+__vector double vv_d1;               // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}<br>
+vector double v_d2;                  // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}<br>
+__vector long double  vv_ld3;        // expected-error {{cannot use 'long double' with '__vector'}}<br>
+vector long double  v_ld4;           // expected-error {{cannot use 'long double' with '__vector'}}<br>
 vector bool v_b;                     // expected-error {{C++ requires a type specifier for all declarations}}<br>
 vector bool float v_bf;              // expected-error {{cannot use 'float' with '__vector bool'}}<br>
 vector bool double v_bd;             // expected-error {{cannot use 'double' with '__vector bool'}}<br>
<br>
Added: cfe/trunk/test/Parser/vsx.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/vsx.c?rev=220989&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/test/Parser/<u></u>vsx.c?rev=220989&view=auto</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/test/Parser/vsx.c (added)<br>
+++ cfe/trunk/test/Parser/vsx.c Fri Oct 31 14:19:24 2014<br>
@@ -0,0 +1,10 @@<br>
+// RUN: %clang_cc1 -triple=powerpc64-unknown-<u></u>linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s<br>
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-<u></u>linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s<br>
+<br>
+// Legitimate for VSX.<br>
+__vector double vv_d1;<br>
+vector double v_d2;<br>
+<br>
+// These should have errors.<br>
+__vector long double  vv_ld3;        // expected-error {{cannot use 'long double' with '__vector'}}<br>
+vector long double  v_ld4;           // expected-error {{cannot use 'long double' with '__vector'}}<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</blockquote></div>