[PATCH] D41376: [libcxx] Implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to.
Tim Shen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 30 12:09:13 PDT 2018
timshen added inline comments.
================
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; }
----------------
mclow.lists wrote:
> Can these (`__get` and `__set`) be noexcept? Obviously, it depends on `_Tp`.
Currently _Tp is always a subset of arithmetic type, so it's safe to say noexcept. Added them, as they may help with -O0 performance.
================
Comment at: libcxx/include/experimental/simd:811
+class __simd_reference {
+ static_assert(std::is_same<_Vp, _Tp>::value, "");
+
----------------
mclow.lists wrote:
> 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) &&;
>
> If _Vp and _Tp have to name the same type, why have two of them?
Currently there is no difference. It's going to be different when simd_mask is implemented (_Vp can be bool, but _Tp may not be).
> What is the difference, and when would you use each one internally?
This is not an internal class. This is part of the interface. IIRC since P0214R9 opreator=() is changed to something. In a later patch operator=() should be implemented as R9 specified.
https://reviews.llvm.org/D41376
More information about the cfe-commits
mailing list