From 1a1c441dbe5933ebf9180831236aa5be7d70a434 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 2 Jan 2018 18:27:15 +0000 Subject: Rework VEC_PERM_EXPR folding This patch reworks the VEC_PERM_EXPR folding so that more of it works for variable-length vectors. E.g. it means that we can now recognise variable-length permutes that reduce to a single vector, or cases in which a variable-length permute only needs one input. There should be no functional change for fixed-length vectors. 2018-01-02 Richard Sandiford gcc/ * selftest.h (selftest::vec_perm_indices_c_tests): Declare. * selftest-run-tests.c (selftest::run_tests): Call it. * vector-builder.h (vector_builder::operator ==): New function. (vector_builder::operator !=): Likewise. * vec-perm-indices.h (vec_perm_indices::series_p): Declare. (vec_perm_indices::all_from_input_p): New function. * vec-perm-indices.c (vec_perm_indices::series_p): Likewise. (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise. * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder instead of reading the VECTOR_CST directly. Detect whether both vector inputs are the same before constructing the vec_perm_indices, and update the number of inputs argument accordingly. Use the utility functions added above. Only construct sel2 if we need to. From-SVN: r256098 --- gcc/selftest.h | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/selftest.h') diff --git a/gcc/selftest.h b/gcc/selftest.h index ab8a7c0..23ca665 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -215,6 +215,7 @@ extern void vec_c_tests (); extern void wide_int_cc_tests (); extern void predict_c_tests (); extern void simplify_rtx_c_tests (); +extern void vec_perm_indices_c_tests (); extern int num_passes; -- cgit v1.1