|
Argon 0.1.0
|
NEON loads and stores of a loop's final, partial vector, branching on its scalar lane count. More...
#include <array>#include <cstddef>#include <type_traits>#include "argon/argon_full.hpp"#include "argon/argon_half.hpp"#include "argon/features.h"#include "argon/store.hpp"

Go to the source code of this file.
Namespaces | |
| namespace | argon |
| A 128-bit SIMD vector wrapping a scalar type, providing arithmetic, logical, and data-movement operations. | |
Typedefs | |
| template<size_t Stride, typename ScalarType> | |
| using | argon::vectorize::detail::half_multi_type = neon::MultiVector_t<typename ArgonHalf<ScalarType>::vector_type, Stride> |
| The channels of interleaved data as doublewords, the operand of the structured loads and stores. | |
Functions | |
| template<typename ScalarType> | |
| ScalarType * | argon::vectorize::detail::opaque_address (ScalarType *ptr) |
| ptr, as an address the compiler can't relate to its neighbours. | |
| template<size_t Lane, typename ScalarType> | |
| ArgonHalf< ScalarType > | argon::vectorize::detail::load_lanes (ArgonHalf< ScalarType > v, const ScalarType *ptr, size_t first, size_t count) |
| Load lanes [Lane, half - 1) of the doubleword v from ptr + lane, while first + lane < count. | |
| template<size_t Lane, typename ScalarType> | |
| void | argon::vectorize::detail::store_lanes (ArgonHalf< ScalarType > v, ScalarType *ptr, size_t first, size_t count) |
| Store lanes [Lane, half - 1) of the doubleword v to ptr + lane, while first + lane < count (see load_lanes()). | |
| template<typename ScalarType> | |
| Argon< ScalarType > | argon::vectorize::detail::load_first_n (const ScalarType *ptr, size_t count) |
| Load the first count lanes at ptr (0 < count < lanes); the rest are zero and not read. | |
| template<typename ScalarType> | |
| void | argon::vectorize::detail::store_first_n (ScalarType *ptr, Argon< ScalarType > value, size_t count) |
| Store the first count lanes of value to ptr (0 < count < lanes); the rest are not written. | |
| template<size_t Lane, size_t Stride, typename ScalarType> | |
| half_multi_type< Stride, ScalarType > | argon::vectorize::detail::load_frames (half_multi_type< Stride, ScalarType > multi, const ScalarType *ptr, size_t first, size_t count) |
| Load frames [Lane, half - 1) of multi from ptr + lane * Stride, one vld2-vld4 to a lane each, while first + lane < count (see load_lanes()). | |
| template<size_t Lane, size_t Stride, typename ScalarType> | |
| void | argon::vectorize::detail::store_frames (half_multi_type< Stride, ScalarType > multi, ScalarType *ptr, size_t first, size_t count) |
| Store frames [Lane, half - 1) of multi to ptr + lane * Stride, one vst2-vst4 from a lane each, while first + lane < count (see load_lanes()). | |
| template<size_t Stride, typename ScalarType> | |
| std::array< Argon< ScalarType >, Stride > | argon::vectorize::detail::load_first_n_interleaved (const ScalarType *ptr, size_t count) |
| Load the first count frames (0 < count < lanes) of Stride interleaved elements at ptr, one vector per channel; lanes past count are zero and not read. | |
| template<size_t Stride, typename ScalarType> | |
| void | argon::vectorize::detail::store_first_n_interleaved (ScalarType *ptr, std::array< Argon< ScalarType >, Stride > value, size_t count) |
| Store the first count frames (0 < count < lanes) of value, one vector per channel, interleaved to ptr; frames past count are not written. | |
| template<typename N, typename S> | |
| Argon< S > | argon::vectorize::detail::load_first_n_widen (const N *ptr, size_t count) |
| Load the first count (0 < count < lanes) elements of the narrower integer type N at ptr, extending each to a lane of S; lanes past count are zero and not read. | |
| template<typename N, typename S> | |
| void | argon::vectorize::detail::store_first_n_narrow (N *ptr, Argon< S > value, size_t count) |
| Store the low bits of the first count (0 < count < lanes) lanes of value as the narrower integer type N; memory past count is not written. | |
NEON loads and stores of a loop's final, partial vector, branching on its scalar lane count.
A partial vector knows how many of its lanes are in range as a scalar. Building a predicate from that count (FirstN) and branching on each of its lanes reads every lane of the mask back into a core register, and on NEON those transfers (vmov.32 r, d[k]) stall the pipeline. These helpers compare the scalar count instead:
Every helper takes 0 < count < lanes: a full vector uses the whole-vector accesses. The lane walks recurse through always-inline templates rather than a lambda, which the compiler may outline once there are many lanes. A std::array's elements are reached through its non-const data(), which libstdc++ marks always-inline; its operator[] and const data() are not, so under -fno-inline-functions they would be calls. MVE needs none of this, since its predicate is native and tail-predicated loops are built from vctp, so these are not defined there.
|
inline |
Load lanes [Lane, half - 1) of the doubleword v from ptr + lane, while first + lane < count.
The doubleword's last lane is never loaded here: it is in range only when the whole doubleword is, which the callers then load at once.
|
inline |
ptr, as an address the compiler can't relate to its neighbours.
clang lowers vst1_lane to a plain store of the extracted element, and in ARM (not Thumb) mode it may fold that store's address into a pre-indexed core store (strh r, [r0, r1]!), which has no NEON form and so is fed by a vmov from the lane. An empty asm that claims to change the address keeps each lane store a vst1 to one lane; it emits no instruction.