vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
Loading...
Searching...
No Matches
simd_permute.h File Reference

Permutation functions for the Parallelism TS 2 simd types. More...

#include "simd_concepts.h"
#include "simd.h"
#include "detail.h"
#include "constexpr_wrapper.h"
#include <bit>

Go to the source code of this file.

Namespaces

namespace  vir
 This namespace collects libraries and tools authored by Matthias Kretz.
 
namespace  vir::simd_permutations
 Predefined permutations.
 

Functions

template<std::size_t N = 0, vir::any_simd_or_mask V, detail::index_permutation_function< V::size()> F>
constexpr stdx::resize_simd_t< N==0 ? V::size() :N, V > vir::simd_permute (V const &v, F const idx_perm) noexcept
 Permute the elements of v using the index permutation function idx_perm.
 
template<std::size_t N = 0, vir::vectorizable T, detail::index_permutation_function< 1 > F>
constexpr std::conditional_t< N<=1, T, stdx::resize_simd_t< N==0 ? 1 :N, stdx::simd< T > > > vir::simd_permute (T const &v, F const idx_perm) noexcept
 Overload for scalar inputs.
 
template<int Offset, vir::any_simd_or_mask V>
constexpr V vir::simd_shift_in (V const &a, std::convertible_to< V > auto const &... more) noexcept
 Concatenate a, more..., shift by Offset, and return the first V::size() elements.
 

Variables

constexpr int vir::simd_permute_zero = std::numeric_limits<int>::max()
 Constant that requests a zero value instead of one of the input values.
 
constexpr int vir::simd_permute_uninit = simd_permute_zero - 1
 Constant that allows an arbitrary value instead of one of the input values.
 
constexpr DuplicateEven vir::simd_permutations::duplicate_even {}
 Copies even elements into odd elements.
 
constexpr DuplicateOdd vir::simd_permutations::duplicate_odd {}
 Copies odd elements into even elements.
 
template<unsigned N = 1u>
constexpr SwapNeighbors< N > vir::simd_permutations::swap_neighbors {}
 Swaps N neighboring elements.
 
template<int Position>
constexpr Broadcast< Position > vir::simd_permutations::broadcast {}
 Copy element at index Position into all elements.
 
constexpr Broadcast< 0 > vir::simd_permutations::broadcast_first {}
 Copy the first element into all elements.
 
constexpr Broadcast<-1 > vir::simd_permutations::broadcast_last {}
 Copy the last element into all elements.
 
constexpr Reverse vir::simd_permutations::reverse {}
 Reverse the elements.
 
template<int Offset>
constexpr Rotate< Offset > vir::simd_permutations::rotate {}
 Rotate the elements by Offset.
 
template<int Offset>
constexpr Shift< Offset > vir::simd_permutations::shift {}
 Shift the elements by Offset.
 

Detailed Description

Permutation functions for the Parallelism TS 2 simd types.