diff options
Diffstat (limited to 'gcc/tree.cc')
| -rw-r--r-- | gcc/tree.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc index 446261a..298784e 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -10823,6 +10823,24 @@ uniform_vector_p (const_tree vec) return NULL_TREE; } +/* If OP is a uniform vector return the element it is a splat from. */ + +tree +ssa_uniform_vector_p (tree op) +{ + if (TREE_CODE (op) == VECTOR_CST + || TREE_CODE (op) == VEC_DUPLICATE_EXPR + || TREE_CODE (op) == CONSTRUCTOR) + return uniform_vector_p (op); + if (TREE_CODE (op) == SSA_NAME) + { + gimple *def_stmt = SSA_NAME_DEF_STMT (op); + if (gimple_assign_single_p (def_stmt)) + return uniform_vector_p (gimple_assign_rhs1 (def_stmt)); + } + return NULL_TREE; +} + /* If the argument is INTEGER_CST, return it. If the argument is vector with all elements the same INTEGER_CST, return that INTEGER_CST. Otherwise return NULL_TREE. |
