aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorArtjoms Sinkarovs <artyom.shinkaroff@gmail.com>2010-10-29 14:59:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-10-29 14:59:07 +0000
commitf87bd04b07ddd4c86f6da5c82585bd6de2ce1e73 (patch)
treefa4dba0be3f38bc0ec75158db860b2beeb9c1c68 /gcc/tree.c
parenta01c666cc6107021427499f6b4f1adf0c7869a89 (diff)
downloadgcc-f87bd04b07ddd4c86f6da5c82585bd6de2ce1e73.zip
gcc-f87bd04b07ddd4c86f6da5c82585bd6de2ce1e73.tar.gz
gcc-f87bd04b07ddd4c86f6da5c82585bd6de2ce1e73.tar.bz2
tree.h (build_vector_from_val): Declare.
2010-10-29 Artjoms Sinkarovs <artyom.shinakroff@gmail.com> Andrew Pinski <pinskia@gmail.com> * tree.h (build_vector_from_val): Declare. * tree.c (build_vector_from_val): New function. * c-typeck.c (build_binary_op): Handle vector shifting. * doc/extend.texi: Description of the vector shifting operation. testsuite/ * gcc.c-torture/execute/vector-shift.c: New testcase. * gcc.c-torture/execute/vector-shift1.c: Likewise. * gcc.c-torture/execute/vector-shift2.c: Likewise. * gcc.dg/vector-shift.c: Likewise. * gcc.dg/vector-shift1.c: Likewise. * gcc.dg/torture/vector-shift2.c: Likewise. * gcc.dg/vector-shift3.c: Likewise. * gcc.dg/simd-1b.c: Adjust. Co-Authored-By: Andrew Pinski <pinskia@gmail.com> From-SVN: r166061
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 48279eb..4eb13c1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1366,6 +1366,28 @@ build_vector_from_ctor (tree type, VEC(constructor_elt,gc) *v)
return build_vector (type, nreverse (list));
}
+/* Build a vector of type VECTYPE where all the elements are SCs. */
+tree
+build_vector_from_val (tree vectype, tree sc)
+{
+ int i, nunits = TYPE_VECTOR_SUBPARTS (vectype);
+ VEC(constructor_elt, gc) *v = NULL;
+
+ if (sc == error_mark_node)
+ return sc;
+
+ gcc_assert (TREE_TYPE (sc) == TREE_TYPE (vectype));
+
+ v = VEC_alloc (constructor_elt, gc, nunits);
+ for (i = 0; i < nunits; ++i)
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, sc);
+
+ if (CONSTANT_CLASS_P (sc))
+ return build_vector_from_ctor (vectype, v);
+ else
+ return build_constructor (vectype, v);
+}
+
/* Return a new CONSTRUCTOR node whose type is TYPE and whose values
are in the VEC pointed to by VALS. */
tree