GCC Middle and Back End API Reference
|
#include <vec-perm-indices.h>
Public Member Functions | |
vec_perm_indices () | |
vec_perm_indices (const vec_perm_builder &, unsigned int, poly_uint64) | |
void | new_vector (const vec_perm_builder &, unsigned int, poly_uint64) |
void | new_expanded_vector (const vec_perm_indices &, unsigned int) |
bool | new_shrunk_vector (const vec_perm_indices &, unsigned int) |
void | rotate_inputs (int delta) |
const vec_perm_builder & | encoding () const |
poly_uint64 | length () const |
unsigned int | ninputs () const |
poly_uint64 | nelts_per_input () const |
poly_uint64 | input_nelts () const |
element_type | clamp (element_type) const |
element_type | operator[] (unsigned int i) const |
bool | series_p (unsigned int, unsigned int, element_type, element_type) const |
bool | all_in_range_p (element_type, element_type) const |
bool | all_from_input_p (unsigned int) const |
Private Types | |
typedef poly_int64 | element_type |
Private Member Functions | |
vec_perm_indices (const vec_perm_indices &) | |
Private Attributes | |
vec_perm_builder | m_encoding |
unsigned int | m_ninputs |
poly_uint64 | m_nelts_per_input |
This class represents a constant permutation vector, such as that used as the final operand to a VEC_PERM_EXPR. Permutation vectors select indices modulo the number of input elements, and the class canonicalizes each permutation vector for a particular number of input vectors and for a particular number of elements per input. For example, the gimple statements: _1 = VEC_PERM_EXPR <a, a, { 0, 2, 4, 6, 0, 2, 4, 6 }>; _2 = VEC_PERM_EXPR <a, a, { 0, 2, 4, 6, 8, 10, 12, 14 }>; _3 = VEC_PERM_EXPR <a, a, { 0, 2, 20, 22, 24, 2, 4, 14 }>; effectively have only a single vector input "a". If "a" has 8 elements, the indices select elements modulo 8, which makes all three VEC_PERM_EXPRs equivalent. The canonical form is for the indices to be in the range [0, number of input elements - 1], so the class treats the second and third permutation vectors as though they had been the first. The class copes with cases in which the input and output vectors have different numbers of elements.
|
inline |
|
inline |
Construct a permutation vector that selects between NINPUTS vector inputs that have NELTS_PER_INPUT elements each. Take the elements of the new vector from ELEMENTS, clamping each one to be in range.
References nelts_per_input(), new_vector(), and ninputs().
|
private |
|
inline |
Return true if the permutation vector only selects elements from input I.
References all_in_range_p(), i, and m_nelts_per_input.
bool vec_perm_indices::all_in_range_p | ( | element_type | start, |
element_type | size ) const |
Return true if all elements of the permutation vector are in the range [START, START + SIZE).
References clamp(), vector_builder< T, Shape, Derived >::full_nelts(), i, input_nelts(), poly_int< N, C >::is_constant(), m_encoding, MIN, vector_builder< T, Shape, Derived >::nelts_per_pattern(), and vector_builder< T, Shape, Derived >::npatterns().
Referenced by all_from_input_p(), and selector_fits_mode_p().
|
inline |
Return the canonical value for permutation vector element ELT, taking into account the current number of input elements.
References input_nelts(), and known_lt.
Referenced by all_in_range_p(), new_vector(), operator[](), rotate_inputs(), and series_p().
|
inline |
References m_encoding.
Referenced by fold_vec_perm_cst(), new_shrunk_vector(), and valid_mask_for_fold_vec_perm_cst_p().
|
inline |
References m_nelts_per_input, and m_ninputs.
Referenced by all_in_range_p(), and clamp().
|
inline |
References vector_builder< T, Shape, Derived >::full_nelts(), and m_encoding.
Referenced by fold_vec_perm(), valid_mask_for_fold_vec_perm_cst_p(), and vect_gen_perm_mask_any().
|
inline |
References m_nelts_per_input.
Referenced by new_vector(), and vec_perm_indices().
void vec_perm_indices::new_expanded_vector | ( | const vec_perm_indices & | orig, |
unsigned int | factor ) |
Switch to a new permutation vector that selects the same input elements as ORIG, but with each element split into FACTOR pieces. For example, if ORIG is { 1, 2, 0, 3 } and FACTOR is 2, the new permutation is { 2, 3, 4, 5, 0, 1, 6, 7 }.
References vector_builder< T, Shape, Derived >::encoded_nelts(), vector_builder< T, Shape, Derived >::finalize(), vector_builder< T, Shape, Derived >::full_nelts(), i, m_encoding, m_nelts_per_input, m_ninputs, vector_builder< T, Shape, Derived >::nelts_per_pattern(), int_vector_builder< T >::new_vector(), and vector_builder< T, Shape, Derived >::npatterns().
Referenced by can_vec_perm_const_p(), and expand_vec_perm_const().
bool vec_perm_indices::new_shrunk_vector | ( | const vec_perm_indices & | orig, |
unsigned int | factor ) |
Check whether we can switch to a new permutation vector that selects the same input elements as ORIG, but with each element built up from FACTOR pieces. Return true if yes, otherwise return false. Every FACTOR permutation indexes should be continuous separately and the first one of each batch should be able to exactly modulo FACTOR. For example, if ORIG is { 2, 3, 4, 5, 0, 1, 6, 7 } and FACTOR is 2, the new permutation is { 1, 2, 0, 3 }.
References vector_builder< T, Shape, Derived >::encoded_nelts(), encoding(), vector_builder< T, Shape, Derived >::finalize(), vector_builder< T, Shape, Derived >::full_nelts(), gcc_assert, i, m_encoding, m_nelts_per_input, m_ninputs, vector_builder< T, Shape, Derived >::nelts_per_pattern(), int_vector_builder< T >::new_vector(), and vector_builder< T, Shape, Derived >::npatterns().
Referenced by simplify_permutation().
void vec_perm_indices::new_vector | ( | const vec_perm_builder & | elements, |
unsigned int | ninputs, | ||
poly_uint64 | nelts_per_input ) |
A representation of vector permutation indices. Copyright (C) 2017-2024 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Switch to a new permutation vector that selects between NINPUTS vector inputs that have NELTS_PER_INPUT elements each. Take the elements of the new permutation vector from ELEMENTS, clamping each one to be in range.
References clamp(), vector_builder< T, Shape, Derived >::elt(), vector_builder< T, Shape, Derived >::encoded_nelts(), vector_builder< T, Shape, Derived >::finalize(), vector_builder< T, Shape, Derived >::full_nelts(), i, poly_int< N, C >::is_constant(), m_encoding, m_nelts_per_input, m_ninputs, nelts_per_input(), vector_builder< T, Shape, Derived >::nelts_per_pattern(), int_vector_builder< T >::new_vector(), ninputs(), and vector_builder< T, Shape, Derived >::npatterns().
Referenced by calc_perm_vec_perm_simplify_seqs(), and vec_perm_indices().
|
inline |
References m_ninputs.
Referenced by new_vector(), and vec_perm_indices().
|
inline |
Return the value of vector element I, which might or might not be explicitly encoded.
References clamp(), vector_builder< T, Shape, Derived >::elt(), i, and m_encoding.
void vec_perm_indices::rotate_inputs | ( | int | delta | ) |
Rotate the inputs of the permutation right by DELTA inputs. This changes the values of the permutation vector but it doesn't change the way that the elements are encoded.
References clamp(), i, m_encoding, and m_nelts_per_input.
bool vec_perm_indices::series_p | ( | unsigned int | out_base, |
unsigned int | out_step, | ||
element_type | in_base, | ||
element_type | in_step ) const |
Return true if index OUT_BASE + I * OUT_STEP selects input element IN_BASE + I * IN_STEP. For example, the call to test whether a permute reverses a vector of N elements would be: series_p (0, 1, N - 1, -1) which would return true for { N - 1, N - 2, N - 3, ... }. The calls to test for an interleaving of elements starting at N1 and N2 would be: series_p (0, 2, N1, 1) && series_p (1, 2, N2, 1). which would return true for { N1, N2, N1 + 1, N2 + 1, ... }.
References clamp(), vector_builder< T, Shape, Derived >::elt(), vector_builder< T, Shape, Derived >::full_nelts(), known_ge, least_common_multiple(), m_encoding, and vector_builder< T, Shape, Derived >::npatterns().
Referenced by is_combined_permutation_identity(), and shift_amt_for_vec_perm_mask().
|
private |
Referenced by all_in_range_p(), encoding(), length(), new_expanded_vector(), new_shrunk_vector(), new_vector(), operator[](), rotate_inputs(), and series_p().
|
private |
Referenced by all_from_input_p(), input_nelts(), nelts_per_input(), new_expanded_vector(), new_shrunk_vector(), new_vector(), and rotate_inputs().
|
private |
Referenced by input_nelts(), new_expanded_vector(), new_shrunk_vector(), new_vector(), and ninputs().