Commit 31521951 by Marek Polacek Committed by Marek Polacek

c-common.c (check_main_parameter_types): Use VECTOR_TYPE_P or VECTOR_INTEGER_TYPE_P throughout.

	* c-common.c (check_main_parameter_types): Use VECTOR_TYPE_P
	or VECTOR_INTEGER_TYPE_P throughout.
	* c-gimplify.c: Likewise.

	* c-typeck.c: Use VECTOR_TYPE_P throughout.

From-SVN: r225089
parent e0ff153d
2015-06-27 Marek Polacek <polacek@redhat.com>
* c-common.c (check_main_parameter_types): Use VECTOR_TYPE_P
or VECTOR_INTEGER_TYPE_P throughout.
* c-gimplify.c: Likewise.
2015-06-26 Marek Polacek <polacek@redhat.com> 2015-06-26 Marek Polacek <polacek@redhat.com>
* array-notation-common.c (find_rank): Use INDIRECT_REF_P. * array-notation-common.c (find_rank): Use INDIRECT_REF_P.
......
...@@ -2412,7 +2412,7 @@ check_main_parameter_types (tree decl) ...@@ -2412,7 +2412,7 @@ check_main_parameter_types (tree decl)
bool bool
vector_targets_convertible_p (const_tree t1, const_tree t2) vector_targets_convertible_p (const_tree t1, const_tree t2)
{ {
if (TREE_CODE (t1) == VECTOR_TYPE && TREE_CODE (t2) == VECTOR_TYPE if (VECTOR_TYPE_P (t1) && VECTOR_TYPE_P (t2)
&& (TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2)) && (TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2))
&& tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2))) && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
return true; return true;
...@@ -2500,8 +2500,7 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask, ...@@ -2500,8 +2500,7 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask,
|| mask == error_mark_node) || mask == error_mark_node)
return error_mark_node; return error_mark_node;
if (TREE_CODE (TREE_TYPE (mask)) != VECTOR_TYPE if (!VECTOR_INTEGER_TYPE_P (TREE_TYPE (mask)))
|| TREE_CODE (TREE_TYPE (TREE_TYPE (mask))) != INTEGER_TYPE)
{ {
if (complain) if (complain)
error_at (loc, "__builtin_shuffle last argument must " error_at (loc, "__builtin_shuffle last argument must "
...@@ -2509,8 +2508,8 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask, ...@@ -2509,8 +2508,8 @@ c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask,
return error_mark_node; return error_mark_node;
} }
if (TREE_CODE (TREE_TYPE (v0)) != VECTOR_TYPE if (!VECTOR_TYPE_P (TREE_TYPE (v0))
|| TREE_CODE (TREE_TYPE (v1)) != VECTOR_TYPE) || !VECTOR_TYPE_P (TREE_TYPE (v1)))
{ {
if (complain) if (complain)
error_at (loc, "__builtin_shuffle arguments must be vectors"); error_at (loc, "__builtin_shuffle arguments must be vectors");
...@@ -12482,7 +12481,7 @@ convert_vector_to_pointer_for_subscript (location_t loc, ...@@ -12482,7 +12481,7 @@ convert_vector_to_pointer_for_subscript (location_t loc,
tree *vecp, tree index) tree *vecp, tree index)
{ {
bool ret = false; bool ret = false;
if (TREE_CODE (TREE_TYPE (*vecp)) == VECTOR_TYPE) if (VECTOR_TYPE_P (TREE_TYPE (*vecp)))
{ {
tree type = TREE_TYPE (*vecp); tree type = TREE_TYPE (*vecp);
tree type1; tree type1;
...@@ -12548,8 +12547,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, ...@@ -12548,8 +12547,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
bool integer_only_op = false; bool integer_only_op = false;
enum stv_conv ret = stv_firstarg; enum stv_conv ret = stv_firstarg;
gcc_assert (TREE_CODE (type0) == VECTOR_TYPE gcc_assert (VECTOR_TYPE_P (type0) || VECTOR_TYPE_P (type1));
|| TREE_CODE (type1) == VECTOR_TYPE);
switch (code) switch (code)
{ {
/* Most GENERIC binary expressions require homogeneous arguments. /* Most GENERIC binary expressions require homogeneous arguments.
...@@ -12599,7 +12597,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, ...@@ -12599,7 +12597,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
case LT_EXPR: case LT_EXPR:
case GT_EXPR: case GT_EXPR:
/* What about UNLT_EXPR? */ /* What about UNLT_EXPR? */
if (TREE_CODE (type0) == VECTOR_TYPE) if (VECTOR_TYPE_P (type0))
{ {
ret = stv_secondarg; ret = stv_secondarg;
std::swap (type0, type1); std::swap (type0, type1);
......
...@@ -248,7 +248,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, ...@@ -248,7 +248,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
We should get rid of this conversion when we have a proper We should get rid of this conversion when we have a proper
type demotion/promotion pass. */ type demotion/promotion pass. */
tree *op1_p = &TREE_OPERAND (*expr_p, 1); tree *op1_p = &TREE_OPERAND (*expr_p, 1);
if (TREE_CODE (TREE_TYPE (*op1_p)) != VECTOR_TYPE if (!VECTOR_TYPE_P (TREE_TYPE (*op1_p))
&& !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)), && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
unsigned_type_node) unsigned_type_node)
&& !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)), && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
......
2015-06-27 Marek Polacek <polacek@redhat.com>
* c-typeck.c: Use VECTOR_TYPE_P throughout.
2015-06-26 Marek Polacek <polacek@redhat.com> 2015-06-26 Marek Polacek <polacek@redhat.com>
* c-array-notation.c (fix_builtin_array_notation_fn): Use * c-array-notation.c (fix_builtin_array_notation_fn): Use
......
...@@ -2457,7 +2457,7 @@ build_array_ref (location_t loc, tree array, tree index) ...@@ -2457,7 +2457,7 @@ build_array_ref (location_t loc, tree array, tree index)
if (TREE_CODE (TREE_TYPE (array)) != ARRAY_TYPE if (TREE_CODE (TREE_TYPE (array)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (array)) != POINTER_TYPE && TREE_CODE (TREE_TYPE (array)) != POINTER_TYPE
/* Allow vector[index] but not index[vector]. */ /* Allow vector[index] but not index[vector]. */
&& TREE_CODE (TREE_TYPE (array)) != VECTOR_TYPE) && !VECTOR_TYPE_P (TREE_TYPE (array)))
{ {
if (TREE_CODE (TREE_TYPE (index)) != ARRAY_TYPE if (TREE_CODE (TREE_TYPE (index)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (index)) != POINTER_TYPE) && TREE_CODE (TREE_TYPE (index)) != POINTER_TYPE)
...@@ -6729,7 +6729,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, ...@@ -6729,7 +6729,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
vector constructor is not constant (e.g. {1,2,3,foo()}) then punt vector constructor is not constant (e.g. {1,2,3,foo()}) then punt
below and handle as a constructor. */ below and handle as a constructor. */
if (code == VECTOR_TYPE if (code == VECTOR_TYPE
&& TREE_CODE (TREE_TYPE (inside_init)) == VECTOR_TYPE && VECTOR_TYPE_P (TREE_TYPE (inside_init))
&& vector_types_convertible_p (TREE_TYPE (inside_init), type, true) && vector_types_convertible_p (TREE_TYPE (inside_init), type, true)
&& TREE_CONSTANT (inside_init)) && TREE_CONSTANT (inside_init))
{ {
...@@ -7180,7 +7180,7 @@ really_start_incremental_init (tree type) ...@@ -7180,7 +7180,7 @@ really_start_incremental_init (tree type)
if (type == 0) if (type == 0)
type = TREE_TYPE (constructor_decl); type = TREE_TYPE (constructor_decl);
if (TREE_CODE (type) == VECTOR_TYPE if (VECTOR_TYPE_P (type)
&& TYPE_VECTOR_OPAQUE (type)) && TYPE_VECTOR_OPAQUE (type))
error ("opaque vector types cannot be initialized"); error ("opaque vector types cannot be initialized");
...@@ -7266,7 +7266,7 @@ really_start_incremental_init (tree type) ...@@ -7266,7 +7266,7 @@ really_start_incremental_init (tree type)
constructor_unfilled_index = constructor_index; constructor_unfilled_index = constructor_index;
} }
else if (TREE_CODE (constructor_type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (constructor_type))
{ {
/* Vectors are like simple fixed-size arrays. */ /* Vectors are like simple fixed-size arrays. */
constructor_max_index = constructor_max_index =
...@@ -7439,7 +7439,7 @@ push_init_level (location_t loc, int implicit, ...@@ -7439,7 +7439,7 @@ push_init_level (location_t loc, int implicit,
constructor_unfilled_fields = constructor_fields; constructor_unfilled_fields = constructor_fields;
constructor_bit_index = bitsize_zero_node; constructor_bit_index = bitsize_zero_node;
} }
else if (TREE_CODE (constructor_type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (constructor_type))
{ {
/* Vectors are like simple fixed-size arrays. */ /* Vectors are like simple fixed-size arrays. */
constructor_max_index = constructor_max_index =
...@@ -7619,7 +7619,7 @@ pop_init_level (location_t loc, int implicit, ...@@ -7619,7 +7619,7 @@ pop_init_level (location_t loc, int implicit,
else if (TREE_CODE (constructor_type) != RECORD_TYPE else if (TREE_CODE (constructor_type) != RECORD_TYPE
&& TREE_CODE (constructor_type) != UNION_TYPE && TREE_CODE (constructor_type) != UNION_TYPE
&& TREE_CODE (constructor_type) != ARRAY_TYPE && TREE_CODE (constructor_type) != ARRAY_TYPE
&& TREE_CODE (constructor_type) != VECTOR_TYPE) && !VECTOR_TYPE_P (constructor_type))
{ {
/* A nonincremental scalar initializer--just return /* A nonincremental scalar initializer--just return
the element, after verifying there is just one. */ the element, after verifying there is just one. */
...@@ -8769,7 +8769,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, ...@@ -8769,7 +8769,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
pop_init_level (loc, 1, braced_init_obstack), pop_init_level (loc, 1, braced_init_obstack),
true, braced_init_obstack); true, braced_init_obstack);
else if ((TREE_CODE (constructor_type) == ARRAY_TYPE else if ((TREE_CODE (constructor_type) == ARRAY_TYPE
|| TREE_CODE (constructor_type) == VECTOR_TYPE) || VECTOR_TYPE_P (constructor_type))
&& constructor_max_index && constructor_max_index
&& tree_int_cst_lt (constructor_max_index, && tree_int_cst_lt (constructor_max_index,
constructor_index)) constructor_index))
...@@ -9039,7 +9039,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, ...@@ -9039,7 +9039,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
constructor_unfilled_index. */ constructor_unfilled_index. */
constructor_unfilled_index = constructor_index; constructor_unfilled_index = constructor_index;
} }
else if (TREE_CODE (constructor_type) == VECTOR_TYPE) else if (VECTOR_TYPE_P (constructor_type))
{ {
tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
...@@ -10302,8 +10302,7 @@ build_binary_op (location_t location, enum tree_code code, ...@@ -10302,8 +10302,7 @@ build_binary_op (location_t location, enum tree_code code,
/* Do not apply default conversion in mixed vector/scalar expression. */ /* Do not apply default conversion in mixed vector/scalar expression. */
if (convert_p if (convert_p
&& !((TREE_CODE (TREE_TYPE (op0)) == VECTOR_TYPE) && VECTOR_TYPE_P (TREE_TYPE (op0)) == VECTOR_TYPE_P (TREE_TYPE (op1)))
!= (TREE_CODE (TREE_TYPE (op1)) == VECTOR_TYPE)))
{ {
op0 = default_conversion (op0); op0 = default_conversion (op0);
op1 = default_conversion (op1); op1 = default_conversion (op1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment