diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-11-01 10:37:03 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-11-01 10:37:03 +0000 |
commit | 06ec586d2c384ba016c784de3279f3770d9f399d (patch) | |
tree | fa771154bb36a0e333d0f1ec22f6a13d31021200 /gcc/expmed.c | |
parent | 9b1de7e2e8e99eabf2b8d1ef74eb57fbd41bc730 (diff) | |
download | gcc-06ec586d2c384ba016c784de3279f3770d9f399d.zip gcc-06ec586d2c384ba016c784de3279f3770d9f399d.tar.gz gcc-06ec586d2c384ba016c784de3279f3770d9f399d.tar.bz2 |
Allow vector CONSTs
This patch allows (const ...) wrappers to be used for rtx vector
constants, as an alternative to const_vector. This is useful
for SVE, where the number of elements isn't known until runtime.
It could also be useful in future for fixed-length vectors, to
reduce the amount of memory needed to represent simple constants
with high element counts. However, one nice thing about keeping
it restricted to variable-length vectors is that there is never
any need to handle combinations of (const ...) and CONST_VECTOR.
2017-11-01 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* doc/rtl.texi (const): Update description of address constants.
Say that vector constants are allowed too.
* common.md (E, F): Use CONSTANT_P instead of checking for
CONST_VECTOR.
* emit-rtl.c (gen_lowpart_common): Use const_vec_p instead of
checking for CONST_VECTOR.
* expmed.c (make_tree): Use build_vector_from_val for a CONST
VEC_DUPLICATE.
* expr.c (expand_expr_real_2): Check for vector modes instead
of checking for CONST_VECTOR.
* rtl.h (const_vec_p): New function.
(const_vec_duplicate_p): Check for a CONST VEC_DUPLICATE.
(unwrap_const_vec_duplicate): Handle them here too.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254296
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index eeb25d3..da9a0a2 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5244,7 +5244,15 @@ make_tree (tree type, rtx x) return fold_convert (type, make_tree (t, XEXP (x, 0))); case CONST: - return make_tree (type, XEXP (x, 0)); + { + rtx op = XEXP (x, 0); + if (GET_CODE (op) == VEC_DUPLICATE) + { + tree elt_tree = make_tree (TREE_TYPE (type), XEXP (op, 0)); + return build_vector_from_val (type, elt_tree); + } + return make_tree (type, op); + } case SYMBOL_REF: t = SYMBOL_REF_DECL (x); |