From b397965cae46d88d4c274fb2ecdde9a4714a4e6a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:19:29 +0000 Subject: [65/77] Add a SCALAR_TYPE_MODE macro This patch adds a SCALAR_TYPE_MODE macro, along the same lines as SCALAR_INT_TYPE_MODE and SCALAR_FLOAT_TYPE_MODE. It also adds two instances of as_a to c_common_type, when converting an unsigned fixed-point SCALAR_TYPE_MODE to the equivalent signed mode. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree.h (SCALAR_TYPE_MODE): New macro. * expr.c (expand_expr_addr_expr_1): Use it. (expand_expr_real_2): Likewise. * fold-const.c (fold_convert_const_fixed_from_fixed): Likeise. (fold_convert_const_fixed_from_int): Likewise. (fold_convert_const_fixed_from_real): Likewise. (native_encode_fixed): Likewise (native_encode_complex): Likewise (native_encode_vector): Likewise. (native_interpret_fixed): Likewise. (native_interpret_real): Likewise. (native_interpret_complex): Likewise. (native_interpret_vector): Likewise. * omp-simd-clone.c (simd_clone_adjust_return_type): Likewise. (simd_clone_adjust_argument_types): Likewise. (simd_clone_init_simd_arrays): Likewise. (simd_clone_adjust): Likewise. * stor-layout.c (layout_type): Likewise. * tree.c (build_minus_one_cst): Likewise. * tree-cfg.c (verify_gimple_assign_ternary): Likewise. * tree-inline.c (estimate_move_cost): Likewise. * tree-ssa-math-opts.c (convert_plusminus_to_widen): Likewise. * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise. (vectorizable_reduction): Likewise. * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Likewise. (vect_recog_mixed_size_cond_pattern): Likewise. (check_bool_pattern): Likewise. (adjust_bool_pattern): Likewise. (search_type_for_mask_1): Likewise. * tree-vect-slp.c (vect_schedule_slp_instance): Likewise. * tree-vect-stmts.c (vectorizable_conversion): Likewise. (vectorizable_load): Likewise. (vectorizable_store): Likewise. * ubsan.c (ubsan_encode_value): Likewise. * varasm.c (output_constant): Likewise. gcc/c-family/ * c-lex.c (interpret_fixed): Use SCALAR_TYPE_MODE. * c-common.c (c_build_vec_perm_expr): Likewise. gcc/c/ * c-typeck.c (build_binary_op): Use SCALAR_TYPE_MODE. (c_common_type): Likewise. Use as_a when setting m1 and m2 to the signed equivalent of a fixed-point SCALAR_TYPE_MODE. gcc/cp/ * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251516 --- gcc/stor-layout.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 012602d..d6c1bb6 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2219,10 +2219,13 @@ layout_type (tree type) } case FIXED_POINT_TYPE: - /* TYPE_MODE (type) has been set already. */ - TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type))); - TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type))); - break; + { + /* TYPE_MODE (type) has been set already. */ + scalar_mode mode = SCALAR_TYPE_MODE (type); + TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (mode)); + TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (mode)); + break; + } case COMPLEX_TYPE: TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type)); @@ -2243,7 +2246,8 @@ layout_type (tree type) /* Find an appropriate mode for the vector type. */ if (TYPE_MODE (type) == VOIDmode) SET_TYPE_MODE (type, - mode_for_vector (TYPE_MODE (innertype), nunits)); + mode_for_vector (SCALAR_TYPE_MODE (innertype), + nunits)); TYPE_SATURATING (type) = TYPE_SATURATING (TREE_TYPE (type)); TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type)); -- cgit v1.1