diff --git a/include/simsycl/sycl/vec.hh b/include/simsycl/sycl/vec.hh index 7b0909e..cdc5718 100644 --- a/include/simsycl/sycl/vec.hh +++ b/include/simsycl/sycl/vec.hh @@ -359,11 +359,21 @@ class swizzled_vec { for(int i = 0; i < num_elements; ++i) { m_elems[indices[i]] = ptr[offset + i]; } } + void load(size_t offset, const value_type *ptr) const + requires(allow_assign) + { + for(int i = 0; i < num_elements; ++i) { m_elems[indices[i]] = ptr[offset + i]; } + } + template void store(size_t offset, sycl::multi_ptr ptr) const { for(int i = 0; i < num_elements; ++i) { ptr[offset + i] = m_elems[indices[i]]; } } + void store(size_t offset, value_type *ptr) const { + for(int i = 0; i < num_elements; ++i) { ptr[offset + i] = m_elems[indices[i]]; } + } + ReferenceDataT &operator[](int index) const { SIMSYCL_CHECK(index >= 0 && index < num_elements && "Index out of range"); return m_elems[indices[index]]; @@ -693,11 +703,19 @@ class alignas(detail::vec_alignment_v) vec { for(int i = 0; i < NumElements; ++i) { m_elems[i] = ptr[offset + i]; } } + void load(size_t offset, const DataT *ptr) { + for(int i = 0; i < NumElements; ++i) { m_elems[i] = ptr[offset + i]; } + } + template void store(size_t offset, multi_ptr ptr) const { for(int i = 0; i < NumElements; ++i) { ptr[offset + i] = m_elems[i]; } } + void store(size_t offset, DataT *ptr) const { + for(int i = 0; i < NumElements; ++i) { ptr[offset + i] = m_elems[i]; } + } + DataT &operator[](int index) { SIMSYCL_CHECK(index >= 0 && index < NumElements && "Index out of range"); return m_elems[index];