Re-apply "[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to."

...with proper guarding #ifdefs for unsupported C++11.

llvm-svn: 338318
diff --git a/libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp b/libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
index 60230cc..49b2b55 100644
--- a/libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++98, c++03
+// UNSUPPORTED: c++98, c++03, c++11, c++14
 
 // See GCC PR63723.
 // UNSUPPORTED: gcc-4.9
@@ -20,18 +20,19 @@
 #include <cstdint>
 #include <experimental/simd>
 
-using namespace std::experimental::parallelism_v2;
+namespace ex = std::experimental::parallelism_v2;
 
 template <class T, class... Args>
 auto not_supported_native_simd_ctor(Args&&... args)
-    -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) = delete;
+    -> decltype(ex::native_simd<T>(std::forward<Args>(args)...),
+                void()) = delete;
 
 template <class T>
 void not_supported_native_simd_ctor(...) {}
 
 template <class T, class... Args>
 auto supported_native_simd_ctor(Args&&... args)
-    -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) {}
+    -> decltype(ex::native_simd<T>(std::forward<Args>(args)...), void()) {}
 
 template <class T>
 void supported_native_simd_ctor(...) = delete;
@@ -55,4 +56,31 @@
   not_supported_native_simd_ctor<int>(3.);
 }
 
-int main() {}
+void compile_convertible() {
+  struct ConvertibleToInt {
+    operator int64_t() const;
+  };
+  supported_native_simd_ctor<int64_t>(ConvertibleToInt());
+
+  struct NotConvertibleToInt {};
+  not_supported_native_simd_ctor<int64_t>(NotConvertibleToInt());
+}
+
+void compile_unsigned() {
+  not_supported_native_simd_ctor<int>(3u);
+  supported_native_simd_ctor<uint16_t>(3u);
+}
+
+template <typename SimdType>
+void test_broadcast() {
+  SimdType a(3);
+  for (size_t i = 0; i < a.size(); i++) {
+    assert(a[i] == 3);
+  }
+}
+
+int main() {
+  test_broadcast<ex::native_simd<int>>();
+  test_broadcast<ex::fixed_size_simd<int, 4>>();
+  test_broadcast<ex::fixed_size_simd<int, 15>>();
+}