aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2003-05-05 20:31:45 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2003-05-05 20:31:45 +0000
commit9938b5d971c49e642b6050e427ba4e5816cec7d9 (patch)
treee0395b7cdcefb033285841242f80cfd86facbea1 /gcc
parente5f3cd6b647a78dedc9febf193651f6498939f79 (diff)
downloadgcc-9938b5d971c49e642b6050e427ba4e5816cec7d9.zip
gcc-9938b5d971c49e642b6050e427ba4e5816cec7d9.tar.gz
gcc-9938b5d971c49e642b6050e427ba4e5816cec7d9.tar.bz2
simd-6.c: New.
2003-05-05 Aldy Hernandez <aldyh@redhat.com> * testsuite/gcc.c-torture/compile/simd-6.c: New. * c-typeck.c (digest_init): Handle arrays of vector constants. From-SVN: r66501
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/simd-6.c3
3 files changed, 20 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 573ec59..3cf8d08 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * testsuite/gcc.c-torture/compile/simd-6.c: New.
+
+ * c-typeck.c (digest_init): Handle arrays of vector constants.
+
2003-05-05 Jakub Jelinek <jakub@redhat.com>
* builtins.c (expand_builtin_mempcpy): New function.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 23b7d2d..c4e482e 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4787,10 +4787,17 @@ digest_init (type, init, require_constant)
/* Build a VECTOR_CST from a *constant* vector constructor. If the
vector constructor is not constant (e.g. {1,2,3,foo()}) then punt
below and handle as a constructor. */
- if (code == VECTOR_TYPE
- && comptypes (TREE_TYPE (inside_init), type)
- && TREE_CONSTANT (inside_init))
- return build_vector (type, CONSTRUCTOR_ELTS (inside_init));
+ if (code == VECTOR_TYPE
+ && comptypes (TREE_TYPE (inside_init), type)
+ && TREE_CONSTANT (inside_init))
+ {
+ if (TREE_CODE (inside_init) == VECTOR_CST
+ && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
+ TYPE_MAIN_VARIANT (type)))
+ return inside_init;
+ else
+ return build_vector (type, CONSTRUCTOR_ELTS (inside_init));
+ }
/* Any type can be initialized
from an expression of the same type, optionally with braces. */
diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-6.c b/gcc/testsuite/gcc.c-torture/compile/simd-6.c
new file mode 100644
index 0000000..9106a73
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/simd-6.c
@@ -0,0 +1,3 @@
+typedef int __attribute__((mode(V2SI))) vec;
+
+vec a[] = {(vec) {1, 2}, {3, 4}};