aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@codesourcery.com>2008-07-01 20:48:59 +0000
committerDaniel Jacobowitz <drow@gcc.gnu.org>2008-07-01 20:48:59 +0000
commitf83c7f631f959a5c1189527e90c065b68cdacd4d (patch)
tree2419bef3fd99b284465e5372871e51477048d14a /gcc/c-common.c
parent103a6411005d1807b6ab5dc24033b283b59a6fa1 (diff)
downloadgcc-f83c7f631f959a5c1189527e90c065b68cdacd4d.zip
gcc-f83c7f631f959a5c1189527e90c065b68cdacd4d.tar.gz
gcc-f83c7f631f959a5c1189527e90c065b68cdacd4d.tar.bz2
c-typeck.c (convert_for_assignment): Use vector_targets_convertible_p.
* c-typeck.c (convert_for_assignment): Use vector_targets_convertible_p. * c-common.c (vector_targets_convertible_p): New. * c-common.h (vector_targets_convertible_p): New prototype. * config/rs6000/rs6000.c (rs6000_is_opaque_type): Do not check opaque_p_V2SI_type_node. * typeck.c (comp_ptr_ttypes_real): Use vector_targets_convertible_p. (comp_ptr_ttypes_const): Likewise. * g++.dg/other/opaque-1.C, g++.dg/other/opaque-2.C, g++.dg/other/opaque-3.C: Also run on powerpc*-*-linux*spe*. From-SVN: r137325
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 7bb6149..31c778c 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1207,6 +1207,20 @@ check_main_parameter_types (tree decl)
pedwarn ("%q+D takes only zero or two arguments", decl);
}
+/* True if pointers to distinct types T1 and T2 can be converted to
+ each other without an explicit cast. Only returns true for opaque
+ vector types. */
+bool
+vector_targets_convertible_p (const_tree t1, const_tree t2)
+{
+ if (TREE_CODE (t1) == VECTOR_TYPE && TREE_CODE (t2) == VECTOR_TYPE
+ && (targetm.vector_opaque_p (t1) || targetm.vector_opaque_p (t2))
+ && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
+ return true;
+
+ return false;
+}
+
/* True if vector types T1 and T2 can be converted to each other
without an explicit cast. If EMIT_LAX_NOTE is true, and T1 and T2
can only be converted with -flax-vector-conversions yet that is not