aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2013-05-13 11:30:50 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2013-05-13 09:30:50 +0000
commit640bfeb25ce9b2f645c75d1e04ecce9ad74c4be1 (patch)
treeed915c07d5e51d4f597a85fe3b3ee5781b72abfd /gcc/fold-const.c
parent198fe1bfebf81e2a13b223bedcb41ed34d426862 (diff)
downloadgcc-640bfeb25ce9b2f645c75d1e04ecce9ad74c4be1.zip
gcc-640bfeb25ce9b2f645c75d1e04ecce9ad74c4be1.tar.gz
gcc-640bfeb25ce9b2f645c75d1e04ecce9ad74c4be1.tar.bz2
tree-vect-generic.c (uniform_vector_p): Move ...
2013-05-13 Marc Glisse <marc.glisse@inria.fr> gcc/ * tree-vect-generic.c (uniform_vector_p): Move ... * tree.c (uniform_vector_p): ... here. * tree.h (uniform_vector_p): Declare it. * fold-const.c (fold_binary_loc) <shift>: Turn the second argument into a scalar. gcc/testsuite/ * gcc.dg/vector-shift-2.c: New testcase. From-SVN: r198819
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index bfe9e07..cbd3445 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12409,6 +12409,12 @@ fold_binary_loc (location_t loc,
if (integer_zerop (arg0))
return omit_one_operand_loc (loc, type, arg0, arg1);
+ /* Prefer vector1 << scalar to vector1 << vector2
+ if vector2 is uniform. */
+ if (VECTOR_TYPE_P (TREE_TYPE (arg1))
+ && (tem = uniform_vector_p (arg1)) != NULL_TREE)
+ return fold_build2_loc (loc, code, type, op0, tem);
+
/* Since negative shift count is not well-defined,
don't try to compute it in the compiler. */
if (TREE_CODE (arg1) == INTEGER_CST && tree_int_cst_sgn (arg1) < 0)