[PATCH] D41376: [libcxx] Implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to.

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 28 11:59:48 PDT 2018


mclow.lists added a comment.

Getting really close.



================
Comment at: libcxx/include/experimental/simd:726
+#if defined(_LIBCPP_COMPILER_CLANG)
+#define _SPECIALIZE_VEC_EXT(_TYPE, _NUM_ELEMENT)                               \
+  template <>                                                                  \
----------------
timshen wrote:
> mclow.lists wrote:
> > When we define user-visible macros in libc++, we prepend them with _LIBCPP_ to avoid collisions.
> > Accordingly, `_SPECIALIZE_VEC_EXT` should be named `_LIBCPP_SPECIALIZE_VEC_EXT`
> > 
> Well _SPECIALIZE_VEC_EXT and _SPECIALIZE_VEC_EXT_32 are not user-visible, as they are (1) '#undef'ed after all uses, and (2) they start with underscore, so don't collide with existing user-defined macros.
I agree, but starting them with _LIBCPP means that people (like me) know that they come from libc++, and not (say) clang, or whatever C library we're sitting on top of.



================
Comment at: libcxx/include/experimental/simd:703
+public:
+  _Tp __get(size_t __index) const { return (&__storage_)[__index]; };
+  void __set(size_t __index, _Tp __val) { (&__storage_)[__index] = __val; }
----------------
Can these (`__get` and `__set`) be noexcept? Obviously, it depends on `_Tp`.


================
Comment at: libcxx/include/experimental/simd:811
+class __simd_reference {
+  static_assert(std::is_same<_Vp, _Tp>::value, "");
+
----------------
If `_Vp` and `_Tp` have to name the same type, why have two of them?
What is the difference, and when would you use each one internally?

    __simd_reference(__simd_storage<_Tp, _Abi>* __ptr, size_t __index);
vs.
    __simd_reference operator=(_Vp __value) &&;



https://reviews.llvm.org/D41376





More information about the cfe-commits mailing list