aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-11-01 10:37:03 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-11-01 10:37:03 +0000
commit06ec586d2c384ba016c784de3279f3770d9f399d (patch)
treefa771154bb36a0e333d0f1ec22f6a13d31021200 /gcc/expr.c
parent9b1de7e2e8e99eabf2b8d1ef74eb57fbd41bc730 (diff)
downloadgcc-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/expr.c')
-rw-r--r--gcc/expr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 496d492..cb294bb 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9429,7 +9429,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
/* Careful here: if the target doesn't support integral vector modes,
a constant selection vector could wind up smooshed into a normal
integral constant. */
- if (CONSTANT_P (op2) && GET_CODE (op2) != CONST_VECTOR)
+ if (CONSTANT_P (op2) && !VECTOR_MODE_P (GET_MODE (op2)))
{
tree sel_type = TREE_TYPE (treeop2);
machine_mode vmode