[PATCH] D41412: [libcxx] implement <experimental/simd> concat() and split()

Tim Shen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 30 15:00:07 PDT 2018


timshen added a comment.

A note on test cases: I only used simds ints to test split() and concat(), as both functions don't specialize on the element type, unlike the constructors.



================
Comment at: libcxx/include/experimental/simd:1491
 
-  template <class _Generator, size_t... __indicies>
+  template <class _Generator, size_t... __indices>
   static constexpr decltype(
----------------
mclow.lists wrote:
> I see no change here other than fixing a typo - correct?
That is correct.


================
Comment at: libcxx/include/experimental/simd:1630
+
+#if !defined(_LIBCPP_HAS_NO_VECTOR_EXTENSION) && defined(_LIBCPP_COMPILER_CLANG)
+  template <size_t... __indices, class _Up, int __num_element>
----------------
mclow.lists wrote:
> In general, we try to keep all the compiler-specific bits in `<__config>`. They tend to grow/mutate over time, and so it's nice to have them all in one place.
> 
> Better to define something like `_LIBCPP_HAS_BUILTIN_SHUFFLEVECTOR` and use that; then if GCC gets religion and adds it, you will only have to update a single place.  Also, it makes the reading easier - no more looking at this and wondering "Why are you requiring clang here?"
> 
> Is this the only place you plan on using `__simd_shuffle`? If so, why not a member function.
GCC already got religion and had it, but in a radically different interface. There is little chance that they will merge the interface in the future.

The GCC one is called __builtin_shuffle (https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html). I haven't added it only because I don't care about the performance on GCC.

It's rather non-trivial to eliminate the difference between them, certainly more than a macro like _LIBCPP_HAS_BUILTIN_SHUFFLEVECTOR.

Do you have any other way to improve the readability?


https://reviews.llvm.org/D41412





More information about the cfe-commits mailing list