aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2004-05-05 07:23:00 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2004-05-05 07:23:00 +0000
commitcc27e657d36005a8b1672f2ee60a5ad779a0d804 (patch)
treee6579b9ad0769f3b795f008e3c607e1affce3794 /gcc/c-common.c
parentd70bd7fff0dc91c22ce7e118b90dc91bfa1e935a (diff)
downloadgcc-cc27e657d36005a8b1672f2ee60a5ad779a0d804.zip
gcc-cc27e657d36005a8b1672f2ee60a5ad779a0d804.tar.gz
gcc-cc27e657d36005a8b1672f2ee60a5ad779a0d804.tar.bz2
re PR target/14899 (wrong code due to change in compatibility rules for vector types)
gcc/ChangeLog: 2004-05-04 Paolo Bonzini <bonzini@gnu.org> Richard Henderson <rth@redhat.com> PR target/14899 * c-common.c (vector_types_convertible_p): New function. * c-typeck.c (comptypes): Recurse on vector types. (convert_for_assignment): Use vector_types_convertible_p. (digest_init): Use vector_types_convertible_p to check validness of constant vector initializers; otherwise treat them as scalars. * tree.c (make_or_reuse_type): New. (build_common_tree_nodes): Use it. * cp/call.c (standard_conversion): Likewise. * cp/typeck.c (comptypes): Recurse on vector types. (convert_for_assignment): Use vector_types_convertible_p. * config/rs6000/rs6000.c (build_opaque_vector_type): New function. (rs6000_init_builtins): Use it. gcc/testsuite/ChangeLog: 2004-05-04 Paolo Bonzini <bonzini@gnu.org> * g++.dg/ext/spe1.C: New testcase. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r81504
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index c4f0129..15d7e68 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1277,6 +1277,16 @@ constant_fits_type_p (tree c, tree type)
return !TREE_OVERFLOW (c);
}
+/* Nonzero if vector types T1 and T2 can be converted to each other
+ without an explicit cast. */
+int
+vector_types_convertible_p (tree t1, tree t2)
+{
+ return targetm.vector_opaque_p (t1)
+ || targetm.vector_opaque_p (t2)
+ || TYPE_MODE (t1) == TYPE_MODE (t2);
+}
+
/* Convert EXPR to TYPE, warning about conversion problems with constants.
Invoke this function on every expression that is converted implicitly,
i.e. because of language rules and not because of an explicit cast. */