Commit 96f9265a by Richard Guenther Committed by Richard Biener

omp-low.c (extract_omp_for_data): Use signed_type_for.

2012-03-07  Richard Guenther  <rguenther@suse.de>

	* omp-low.c (extract_omp_for_data): Use signed_type_for.
	(expand_omp_for_generic): Likewise.
	(expand_omp_for_static_nochunk): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	* tree-vect-stmts.c (vect_gen_perm_mask): Use type_for_mode.
	* tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
	* tree-vect-loop-manip.c (vect_gen_niters_for_prolog_loop):
	Use unsigned_type_for.
	(vect_create_cond_for_align_checks): Use signed_type_for.

From-SVN: r185042
parent 3f1960ac
2012-03-07 Richard Guenther <rguenther@suse.de>
* omp-low.c (extract_omp_for_data): Use signed_type_for.
(expand_omp_for_generic): Likewise.
(expand_omp_for_static_nochunk): Likewise.
(expand_omp_for_static_chunk): Likewise.
* tree-vect-stmts.c (vect_gen_perm_mask): Use type_for_mode.
* tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
* tree-vect-loop-manip.c (vect_gen_niters_for_prolog_loop):
Use unsigned_type_for.
(vect_create_cond_for_align_checks): Use signed_type_for.
2012-03-07 Andrey Belevantsev <abel@ispras.ru> 2012-03-07 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/52203 PR rtl-optimization/52203
......
...@@ -407,8 +407,7 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd, ...@@ -407,8 +407,7 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
tree itype = TREE_TYPE (loop->v); tree itype = TREE_TYPE (loop->v);
if (POINTER_TYPE_P (itype)) if (POINTER_TYPE_P (itype))
itype itype = signed_type_for (itype);
= lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0);
t = build_int_cst (itype, (loop->cond_code == LT_EXPR ? -1 : 1)); t = build_int_cst (itype, (loop->cond_code == LT_EXPR ? -1 : 1));
t = fold_build2_loc (loc, t = fold_build2_loc (loc,
PLUS_EXPR, itype, PLUS_EXPR, itype,
...@@ -3772,7 +3771,7 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3772,7 +3771,7 @@ expand_omp_for_generic (struct omp_region *region,
tree itype = TREE_TYPE (fd->loops[i].v); tree itype = TREE_TYPE (fd->loops[i].v);
if (POINTER_TYPE_P (itype)) if (POINTER_TYPE_P (itype))
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0); itype = signed_type_for (itype);
t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR
? -1 : 1)); ? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype, t = fold_build2 (PLUS_EXPR, itype,
...@@ -3836,8 +3835,7 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3836,8 +3835,7 @@ expand_omp_for_generic (struct omp_region *region,
&& TYPE_PRECISION (type) != TYPE_PRECISION (fd->iter_type)) && TYPE_PRECISION (type) != TYPE_PRECISION (fd->iter_type))
{ {
/* Avoid casting pointers to integer of a different size. */ /* Avoid casting pointers to integer of a different size. */
tree itype tree itype = signed_type_for (type);
= lang_hooks.types.type_for_size (TYPE_PRECISION (type), 0);
t1 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n2)); t1 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n2));
t0 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n1)); t0 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n1));
} }
...@@ -3904,8 +3902,7 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3904,8 +3902,7 @@ expand_omp_for_generic (struct omp_region *region,
if (bias) if (bias)
t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias); t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias);
if (POINTER_TYPE_P (type)) if (POINTER_TYPE_P (type))
t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type), t = fold_convert (signed_type_for (type), t);
0), t);
t = fold_convert (type, t); t = fold_convert (type, t);
t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE, t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE,
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
...@@ -3916,8 +3913,7 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3916,8 +3913,7 @@ expand_omp_for_generic (struct omp_region *region,
if (bias) if (bias)
t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias); t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias);
if (POINTER_TYPE_P (type)) if (POINTER_TYPE_P (type))
t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type), t = fold_convert (signed_type_for (type), t);
0), t);
t = fold_convert (type, t); t = fold_convert (type, t);
iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
...@@ -3932,7 +3928,7 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3932,7 +3928,7 @@ expand_omp_for_generic (struct omp_region *region,
tree vtype = TREE_TYPE (fd->loops[i].v), itype; tree vtype = TREE_TYPE (fd->loops[i].v), itype;
itype = vtype; itype = vtype;
if (POINTER_TYPE_P (vtype)) if (POINTER_TYPE_P (vtype))
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (vtype), 0); itype = signed_type_for (vtype);
t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]); t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]);
t = fold_convert (itype, t); t = fold_convert (itype, t);
t = fold_build2 (MULT_EXPR, itype, t, t = fold_build2 (MULT_EXPR, itype, t,
...@@ -4162,7 +4158,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, ...@@ -4162,7 +4158,7 @@ expand_omp_for_static_nochunk (struct omp_region *region,
itype = type = TREE_TYPE (fd->loop.v); itype = type = TREE_TYPE (fd->loop.v);
if (POINTER_TYPE_P (type)) if (POINTER_TYPE_P (type))
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (type), 0); itype = signed_type_for (type);
entry_bb = region->entry; entry_bb = region->entry;
cont_bb = region->cont; cont_bb = region->cont;
...@@ -4379,7 +4375,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd) ...@@ -4379,7 +4375,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
itype = type = TREE_TYPE (fd->loop.v); itype = type = TREE_TYPE (fd->loop.v);
if (POINTER_TYPE_P (type)) if (POINTER_TYPE_P (type))
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (type), 0); itype = signed_type_for (type);
entry_bb = region->entry; entry_bb = region->entry;
se = split_block (entry_bb, last_stmt (entry_bb)); se = split_block (entry_bb, last_stmt (entry_bb));
......
...@@ -2058,9 +2058,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters) ...@@ -2058,9 +2058,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
? size_int (-TYPE_VECTOR_SUBPARTS (vectype) + 1) : NULL_TREE; ? size_int (-TYPE_VECTOR_SUBPARTS (vectype) + 1) : NULL_TREE;
tree start_addr = vect_create_addr_base_for_vector_ref (dr_stmt, tree start_addr = vect_create_addr_base_for_vector_ref (dr_stmt,
&new_stmts, offset, loop); &new_stmts, offset, loop);
tree ptr_type = TREE_TYPE (start_addr); tree type = unsigned_type_for (TREE_TYPE (start_addr));
tree size = TYPE_SIZE (ptr_type);
tree type = lang_hooks.types.type_for_size (tree_low_cst (size, 1), 1);
tree vectype_size_minus_1 = build_int_cst (type, vectype_align - 1); tree vectype_size_minus_1 = build_int_cst (type, vectype_align - 1);
tree elem_size_log = tree elem_size_log =
build_int_cst (type, exact_log2 (vectype_align/nelements)); build_int_cst (type, exact_log2 (vectype_align/nelements));
...@@ -2278,7 +2276,6 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo, ...@@ -2278,7 +2276,6 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
int mask = LOOP_VINFO_PTR_MASK (loop_vinfo); int mask = LOOP_VINFO_PTR_MASK (loop_vinfo);
tree mask_cst; tree mask_cst;
unsigned int i; unsigned int i;
tree psize;
tree int_ptrsize_type; tree int_ptrsize_type;
char tmp_name[20]; char tmp_name[20];
tree or_tmp_name = NULL_TREE; tree or_tmp_name = NULL_TREE;
...@@ -2291,11 +2288,7 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo, ...@@ -2291,11 +2288,7 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
all zeros followed by all ones. */ all zeros followed by all ones. */
gcc_assert ((mask != 0) && ((mask & (mask+1)) == 0)); gcc_assert ((mask != 0) && ((mask & (mask+1)) == 0));
/* CHECKME: what is the best integer or unsigned type to use to hold a int_ptrsize_type = signed_type_for (ptr_type_node);
cast from a pointer value? */
psize = TYPE_SIZE (ptr_type_node);
int_ptrsize_type
= lang_hooks.types.type_for_size (tree_low_cst (psize, 1), 0);
/* Create expression (mask & (dr_1 || ... || dr_n)) where dr_i is the address /* Create expression (mask & (dr_1 || ... || dr_n)) where dr_i is the address
of the first vector of the i'th data reference. */ of the first vector of the i'th data reference. */
......
...@@ -2709,9 +2709,8 @@ vect_transform_slp_perm_load (gimple stmt, VEC (tree, heap) *dr_chain, ...@@ -2709,9 +2709,8 @@ vect_transform_slp_perm_load (gimple stmt, VEC (tree, heap) *dr_chain,
/* The generic VEC_PERM_EXPR code always uses an integral type of the /* The generic VEC_PERM_EXPR code always uses an integral type of the
same size as the vector element being permuted. */ same size as the vector element being permuted. */
mask_element_type mask_element_type = lang_hooks.types.type_for_mode
= lang_hooks.types.type_for_size (int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))), 1);
(TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (vectype))), 1);
mask_type = get_vectype_for_scalar_type (mask_element_type); mask_type = get_vectype_for_scalar_type (mask_element_type);
nunits = TYPE_VECTOR_SUBPARTS (vectype); nunits = TYPE_VECTOR_SUBPARTS (vectype);
mask = XALLOCAVEC (unsigned char, nunits); mask = XALLOCAVEC (unsigned char, nunits);
......
...@@ -4099,9 +4099,8 @@ vect_gen_perm_mask (tree vectype, unsigned char *sel) ...@@ -4099,9 +4099,8 @@ vect_gen_perm_mask (tree vectype, unsigned char *sel)
if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel)) if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
return NULL; return NULL;
mask_elt_type mask_elt_type = lang_hooks.types.type_for_mode
= lang_hooks.types.type_for_size (int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))), 1);
(TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (vectype))), 1);
mask_type = get_vectype_for_scalar_type (mask_elt_type); mask_type = get_vectype_for_scalar_type (mask_elt_type);
mask_vec = NULL; mask_vec = NULL;
......
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