21#include "argon/argon_full.hpp"
22#include "argon/helpers/size.hpp"
24#include "arm_simd/helpers/vec128.hpp"
26#ifdef __ARM_FEATURE_MVE
32namespace argon::vectorize {
36template <
typename ScalarType>
37struct load : std::ranges::view_interface<load<ScalarType>> {
51 LoadIterator() =
default;
81 LoadIterator tmp = *
this;
96 LoadIterator tmp = *
this;
112 LoadIterator it = *
this;
121 LoadIterator it = *
this;
140 friend LoadIterator
operator+(
const int n,
const LoadIterator& it) {
return it + n; }
143 friend bool operator==(
const LoadIterator& a,
const LoadIterator& b) {
return a.ptr_ == b.ptr_; }
146 friend bool operator==(
const LoadIterator& a,
const ScalarType*
ptr) {
return a.ptr_ ==
ptr; }
149 friend bool operator!=(
const LoadIterator& a,
const LoadIterator& b) {
return a.ptr_ != b.ptr_; }
152 friend bool operator!=(
const LoadIterator& a,
const ScalarType*
ptr) {
return a.ptr_ !=
ptr; }
155 friend auto operator<=>(
const LoadIterator& a,
const LoadIterator& b) {
return a.ptr_ <=> b.ptr_; }
158 const ScalarType* ptr_;
160 static_assert(std::sized_sentinel_for<LoadIterator, LoadIterator>);
161 static_assert(std::bidirectional_iterator<LoadIterator>);
162 static_assert(std::input_iterator<LoadIterator>);
173 const ScalarType*
end() {
return start_ + (size_ *
lanes); }
177 size_t size()
const {
return size_; }
182 template <std::ranges::contiguous_range R>
186 count_{
std::ranges::
size(r)} {}
190 load(
const std::span<ScalarType> span)
191 : start_{span.data()}, size_{
helpers::vectorizeable_size<ScalarType>(span.
size()) /
lanes}, count_{span.
size()} {}
199 const ScalarType* start_;
204static_assert(std::ranges::range<load<int32_t>>);
205static_assert(std::ranges::view<load<int32_t>>);
206static_assert(std::movable<load<int32_t>>);
207static_assert(std::ranges::viewable_range<load<int32_t>>);
209template <std::ranges::contiguous_range R>
212template <
typename ScalarType>
Definition argon_full.hpp:44
Read-only view of a range as vectors, including a final partial vector.
Definition tail.hpp:168
Contains helper templates and concepts for type manipulation and compile-time utilities.
Definition argon.hpp:156
typename ArgonFor< std::remove_cv_t< T > >::type ArgonFor_t
Helper alias to get the Argon type for a given vector type.
Definition argon_for.hpp:46
ace Argon< T > load(const T *ptr)
Load a quad-word vector from a pointer.
Definition argon.hpp:143
Lane deconstruction feature.
Definition argon_full.hpp:1547
The Iterator type for the range.
Definition load.hpp:45
LoadIterator & operator+=(int n)
Increments the iterator by a number of steps.
Definition load.hpp:65
friend bool operator!=(const LoadIterator &a, const LoadIterator &b)
Compares LoadIterators for inequality.
Definition load.hpp:149
LoadIterator operator+(int n) const
Adds an integer to the iterator and returns a new iterator.
Definition load.hpp:111
Argon< ScalarType > operator*() const
Dereferences the iterator to get the SIMD vector.
Definition load.hpp:60
LoadIterator operator++(int)
Postfix increment operator.
Definition load.hpp:80
friend bool operator==(const LoadIterator &a, const ScalarType *ptr)
Compares LoadIterators for equality.
Definition load.hpp:146
std::bidirectional_iterator_tag iterator_category
The iterator category.
Definition load.hpp:46
LoadIterator & operator-=(int n)
Decrements the iterator by a number of steps.
Definition load.hpp:73
LoadIterator & operator++()
Prefix increment operator.
Definition load.hpp:88
std::ptrdiff_t difference_type
The difference type.
Definition load.hpp:47
friend LoadIterator operator+(const int n, const LoadIterator &it)
Adds an integer to the iterator and returns a new iterator.
Definition load.hpp:140
friend bool operator==(const LoadIterator &a, const LoadIterator &b)
Compares LoadIterators for equality.
Definition load.hpp:143
LoadIterator & operator--()
Prefix decrement operator.
Definition load.hpp:103
friend bool operator!=(const LoadIterator &a, const ScalarType *ptr)
Compares LoadIterators for inequality.
Definition load.hpp:152
LoadIterator operator--(int)
Postfix decrement operator.
Definition load.hpp:95
LoadIterator operator-(int n) const
Subtracts an integer from the iterator and returns a new iterator.
Definition load.hpp:120
difference_type operator-(const LoadIterator &other) const
Calculates the difference between two iterators.
Definition load.hpp:134
helpers::ArgonFor_t< intrinsic_type > value_type
The value type of the iterator.
Definition load.hpp:48
LoadIterator(const ScalarType *ptr)
Constructs a LoadIterator from a pointer to the data.
Definition load.hpp:55
value_type operator[](int n) const
Accesses the element at the given index.
Definition load.hpp:129
friend auto operator<=>(const LoadIterator &a, const LoadIterator &b)
Compares LoadIterators.
Definition load.hpp:155
const ScalarType * end()
Returns an iterator to the end of the range.
Definition load.hpp:173
load_tail< ScalarType > with_tail() const
A view of the same range that also visits the final, partial vector.
Definition load.hpp:196
size_t size() const
Returns the size of the range.
Definition load.hpp:177
load(R &&r)
Construct a load from a range.
Definition load.hpp:183
static constexpr size_t lanes
The number of lanes in the SIMD vector.
Definition load.hpp:39
const ScalarType * sentinel
The sentinel type for the range.
Definition load.hpp:165
iterator begin()
Returns an iterator to the beginning of the range.
Definition load.hpp:169
load(const std::span< ScalarType > span)
Construct a load from a span.
Definition load.hpp:190
LoadIterator iterator
The iterator type for the range.
Definition load.hpp:164
simd::Vec128_t< ScalarType > intrinsic_type
The SIMD vector type.
Definition load.hpp:38
Vectorized views that also visit the final, partial vector of a range (see with_tail() on the views).