From 3cea8318b1b3fc81b02e2f99c58778b52aaec7b9 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 7 Mar 2012 13:31:15 +0000 Subject: [PATCH] 2012-03-07 Richard Guenther * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185042 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/omp-low.c | 20 ++++++++------------ gcc/tree-vect-loop-manip.c | 11 ++--------- gcc/tree-vect-slp.c | 5 ++--- gcc/tree-vect-stmts.c | 5 ++--- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c36416..e36572b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2012-03-07 Richard Guenther + + * 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 PR rtl-optimization/52203 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 82ca4fd..84986ef 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -407,8 +407,7 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd, tree itype = TREE_TYPE (loop->v); 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, (loop->cond_code == LT_EXPR ? -1 : 1)); t = fold_build2_loc (loc, PLUS_EXPR, itype, @@ -3772,7 +3771,7 @@ expand_omp_for_generic (struct omp_region *region, tree itype = TREE_TYPE (fd->loops[i].v); 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 ? -1 : 1)); t = fold_build2 (PLUS_EXPR, itype, @@ -3836,8 +3835,7 @@ expand_omp_for_generic (struct omp_region *region, && TYPE_PRECISION (type) != TYPE_PRECISION (fd->iter_type)) { /* Avoid casting pointers to integer of a different size. */ - tree itype - = lang_hooks.types.type_for_size (TYPE_PRECISION (type), 0); + tree itype = signed_type_for (type); t1 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n2)); t0 = fold_convert (fd->iter_type, fold_convert (itype, fd->loop.n1)); } @@ -3904,8 +3902,7 @@ expand_omp_for_generic (struct omp_region *region, if (bias) t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias); if (POINTER_TYPE_P (type)) - t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type), - 0), t); + t = fold_convert (signed_type_for (type), t); t = fold_convert (type, t); t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE, false, GSI_CONTINUE_LINKING); @@ -3916,8 +3913,7 @@ expand_omp_for_generic (struct omp_region *region, if (bias) t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias); if (POINTER_TYPE_P (type)) - t = fold_convert (lang_hooks.types.type_for_size (TYPE_PRECISION (type), - 0), t); + t = fold_convert (signed_type_for (type), t); t = fold_convert (type, t); iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, false, GSI_CONTINUE_LINKING); @@ -3932,7 +3928,7 @@ expand_omp_for_generic (struct omp_region *region, tree vtype = TREE_TYPE (fd->loops[i].v), itype; itype = 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_convert (itype, t); t = fold_build2 (MULT_EXPR, itype, t, @@ -4162,7 +4158,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, itype = type = TREE_TYPE (fd->loop.v); 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; cont_bb = region->cont; @@ -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); 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; se = split_block (entry_bb, last_stmt (entry_bb)); diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 70c4f89..8cf1825 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -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; tree start_addr = vect_create_addr_base_for_vector_ref (dr_stmt, &new_stmts, offset, loop); - tree ptr_type = 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 type = unsigned_type_for (TREE_TYPE (start_addr)); tree vectype_size_minus_1 = build_int_cst (type, vectype_align - 1); tree elem_size_log = build_int_cst (type, exact_log2 (vectype_align/nelements)); @@ -2278,7 +2276,6 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo, int mask = LOOP_VINFO_PTR_MASK (loop_vinfo); tree mask_cst; unsigned int i; - tree psize; tree int_ptrsize_type; char tmp_name[20]; tree or_tmp_name = NULL_TREE; @@ -2291,11 +2288,7 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo, all zeros followed by all ones. */ gcc_assert ((mask != 0) && ((mask & (mask+1)) == 0)); - /* CHECKME: what is the best integer or unsigned type to use to hold a - 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); + int_ptrsize_type = signed_type_for (ptr_type_node); /* Create expression (mask & (dr_1 || ... || dr_n)) where dr_i is the address of the first vector of the i'th data reference. */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index f21abb3..d20fc9d 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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 same size as the vector element being permuted. */ - mask_element_type - = lang_hooks.types.type_for_size - (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (vectype))), 1); + mask_element_type = lang_hooks.types.type_for_mode + (int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))), 1); mask_type = get_vectype_for_scalar_type (mask_element_type); nunits = TYPE_VECTOR_SUBPARTS (vectype); mask = XALLOCAVEC (unsigned char, nunits); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index edfe98d..65a70fa 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -4099,9 +4099,8 @@ vect_gen_perm_mask (tree vectype, unsigned char *sel) if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel)) return NULL; - mask_elt_type - = lang_hooks.types.type_for_size - (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (vectype))), 1); + mask_elt_type = lang_hooks.types.type_for_mode + (int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))), 1); mask_type = get_vectype_for_scalar_type (mask_elt_type); mask_vec = NULL; -- 2.7.4