diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-02 18:28:14 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-02 18:28:14 +0000 |
commit | cd5ff7bc323a8fa6eafc4513bc814e4e7fa24120 (patch) | |
tree | 4a69a3ee23bde8480b983e60720932a0219c7a95 /gcc/rtl.h | |
parent | 3d8ca53dd9b4c42b07ef974f92c3c4553cce3a79 (diff) | |
download | gcc-cd5ff7bc323a8fa6eafc4513bc814e4e7fa24120.zip gcc-cd5ff7bc323a8fa6eafc4513bc814e4e7fa24120.tar.gz gcc-cd5ff7bc323a8fa6eafc4513bc814e4e7fa24120.tar.bz2 |
Make CONST_VECTOR_ELT handle implicitly-encoded elements
This patch makes CONST_VECTOR_ELT handle implicitly-encoded elements,
in a similar way to VECTOR_CST_ELT.
2018-01-02 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
(const_vector_encoded_nelts): New function.
(CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
(const_vector_int_elt, const_vector_elt): Declare.
* emit-rtl.c (const_vector_int_elt_1): New function.
(const_vector_elt): Likewise.
* simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
of CONST_VECTOR_ELT.
From-SVN: r256104
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r-- | gcc/rtl.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1969,7 +1969,7 @@ set_regno_raw (rtx x, unsigned int regno, unsigned int nregs) ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low)) /* For a CONST_VECTOR, return element #n. */ -#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR) +#define CONST_VECTOR_ELT(RTX, N) const_vector_elt (RTX, N) /* See rtl.texi for a description of these macros. */ #define CONST_VECTOR_NPATTERNS(RTX) \ @@ -1988,8 +1988,16 @@ set_regno_raw (rtx x, unsigned int regno, unsigned int nregs) #define CONST_VECTOR_ENCODED_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR) +/* Return the number of elements encoded directly in a CONST_VECTOR. */ + +inline unsigned int +const_vector_encoded_nelts (const_rtx x) +{ + return CONST_VECTOR_NPATTERNS (x) * CONST_VECTOR_NELTS_PER_PATTERN (x); +} + /* For a CONST_VECTOR, return the number of elements in a vector. */ -#define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR) +#define CONST_VECTOR_NUNITS(RTX) GET_MODE_NUNITS (GET_MODE (RTX)) /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of. SUBREG_BYTE extracts the byte-number. */ @@ -3001,6 +3009,8 @@ unwrap_const_vec_duplicate (T x) } /* In emit-rtl.c. */ +extern wide_int const_vector_int_elt (const_rtx, unsigned int); +extern rtx const_vector_elt (const_rtx, unsigned int); extern bool const_vec_series_p_1 (const_rtx, rtx *, rtx *); /* Return true if X is an integer constant vector that contains a linear |