diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-08-20 19:04:34 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-08-20 19:04:34 +0000 |
commit | 92695fbb294bf7fe051041e3143f51c37cc22f82 (patch) | |
tree | 88a816e3cb8340cc79bfdf29195dc3a1e20fd9e6 /gcc/rtl.h | |
parent | c629c24604222d7b3a8e6c8a5010f4f3d2a1b1a6 (diff) | |
download | gcc-92695fbb294bf7fe051041e3143f51c37cc22f82.zip gcc-92695fbb294bf7fe051041e3143f51c37cc22f82.tar.gz gcc-92695fbb294bf7fe051041e3143f51c37cc22f82.tar.bz2 |
rtl.h (rtvec_all_equal_p): Declare.
gcc/
* rtl.h (rtvec_all_equal_p): Declare.
(const_vec_duplicate_p, unwrap_const_vec_duplicate): New functions.
* rtl.c (rtvec_all_equal_p): New function.
* expmed.c (expand_mult): Use unwrap_const_vec_duplicate.
* config/aarch64/aarch64.c (aarch64_vect_float_const_representable_p)
(aarch64_simd_dup_constant): Use const_vec_duplicate_p.
* config/arm/arm.c (neon_vdup_constant): Likewise.
* config/s390/s390.c (s390_contiguous_bitmask_vector_p): Likewise.
* config/tilegx/constraints.md (W, Y): Likewise.
* config/tilepro/constraints.md (W, Y): Likewise.
* config/spu/spu.c (spu_legitimate_constant_p): Likewise.
(classify_immediate): Use unwrap_const_vec_duplicate.
* config/tilepro/predicates.md (reg_or_v4s8bit_operand): Likewise.
(reg_or_v2s8bit_operand): Likewise.
* config/tilegx/predicates.md (reg_or_v8s8bit_operand): Likewise.
(reg_or_v4s8bit_operand): Likewise.
From-SVN: r227041
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r-- | gcc/rtl.h | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -2678,6 +2678,42 @@ extern unsigned int rtx_size (const_rtx); extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL); #define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO) extern int rtx_equal_p (const_rtx, const_rtx); +extern bool rtvec_all_equal_p (const_rtvec); + +/* Return true if X is a vector constant with a duplicated element value. */ + +inline bool +const_vec_duplicate_p (const_rtx x) +{ + return GET_CODE (x) == CONST_VECTOR && rtvec_all_equal_p (XVEC (x, 0)); +} + +/* Return true if X is a vector constant with a duplicated element value. + Store the duplicated element in *ELT if so. */ + +template <typename T> +inline bool +const_vec_duplicate_p (T x, T *elt) +{ + if (const_vec_duplicate_p (x)) + { + *elt = CONST_VECTOR_ELT (x, 0); + return true; + } + return false; +} + +/* If X is a vector constant with a duplicated element value, return that + element value, otherwise return X. */ + +template <typename T> +inline T +unwrap_const_vec_duplicate (T x) +{ + if (const_vec_duplicate_p (x)) + x = CONST_VECTOR_ELT (x, 0); + return x; +} /* In emit-rtl.c */ extern rtvec gen_rtvec_v (int, rtx *); |