diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/doc/rtl.texi | 3 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 13 | ||||
-rw-r--r-- | gcc/emit-rtl.h | 1 | ||||
-rw-r--r-- | gcc/optabs.c | 2 |
5 files changed, 25 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb0e6c2..79d156e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,13 @@ 2017-11-09 Richard Sandiford <richard.sandiford@linaro.org> + + * doc/rtl.texi (const_vector): Say that elements can be + const_wide_ints too. + * emit-rtl.h (valid_for_const_vec_duplicate_p): Declare. + * emit-rtl.c (valid_for_const_vec_duplicate_p): New function. + (gen_vec_duplicate): Use it instead of CONSTANT_P. + * optabs.c (expand_vector_broadcast): Likewise. + +2017-11-09 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 7e2925a..21524f5 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1625,7 +1625,8 @@ accessed with @code{CONST_FIXED_VALUE_LOW}. @item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}]) Represents a vector constant. The square brackets stand for the vector containing the constant elements. @var{x0}, @var{x1} and so on are -the @code{const_int}, @code{const_double} or @code{const_fixed} elements. +the @code{const_int}, @code{const_wide_int}, @code{const_double} or +@code{const_fixed} elements. The number of units in a @code{const_vector} is obtained with the macro @code{CONST_VECTOR_NUNITS} as in @code{CONST_VECTOR_NUNITS (@var{v})}. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ac6fd6a..a076711 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -5772,6 +5772,17 @@ init_emit (void) #endif } +/* Return true if X is a valid element for a duplicated vector constant + of the given mode. */ + +bool +valid_for_const_vec_duplicate_p (machine_mode, rtx x) +{ + return (CONST_SCALAR_INT_P (x) + || CONST_DOUBLE_AS_FLOAT_P (x) + || CONST_FIXED_P (x)); +} + /* Like gen_const_vec_duplicate, but ignore const_tiny_rtx. */ static rtx @@ -5807,7 +5818,7 @@ gen_const_vec_duplicate (machine_mode mode, rtx elt) rtx gen_vec_duplicate (machine_mode mode, rtx x) { - if (CONSTANT_P (x)) + if (valid_for_const_vec_duplicate_p (mode, x)) return gen_const_vec_duplicate (mode, x); return gen_rtx_VEC_DUPLICATE (mode, x); } diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index ab320e6..dd2415d 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -438,6 +438,7 @@ get_max_uid (void) return crtl->emit.x_cur_insn_uid; } +extern bool valid_for_const_vec_duplicate_p (machine_mode, rtx); extern rtx gen_const_vec_duplicate (machine_mode, rtx); extern rtx gen_vec_duplicate (machine_mode, rtx); diff --git a/gcc/optabs.c b/gcc/optabs.c index 8f7089e..847b801 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -377,7 +377,7 @@ expand_vector_broadcast (machine_mode vmode, rtx op) gcc_checking_assert (VECTOR_MODE_P (vmode)); - if (CONSTANT_P (op)) + if (valid_for_const_vec_duplicate_p (vmode, op)) return gen_const_vec_duplicate (vmode, op); /* ??? If the target doesn't have a vec_init, then we have no easy way |