From 2496c7bd5f519bc9334f2a4ad771b4b8c9cba7c7 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Tue, 19 Mar 2002 10:00:43 -0800 Subject: [PATCH] emit-rtl.c (gen_int_mode): New function. * emit-rtl.c (gen_int_mode): New function. * rtl.h: Prototype for it. * combine.c (make_extraction, simplify_comparison), expmed.c (store_bit_field, expand_mult_highpart, expand_divmod), expr.c (convert_modes, store_field), optabs.c (expand_fix), simplify-rtx.c (neg_const_int, simplify_unary_real), * config/rs6000/rs6000.c, config/rs6000/rs6000.md: Use it instead of GEN_INT (trunc_int_for_mode (...)). From-SVN: r51030 --- gcc/ChangeLog | 16 ++++++++++++++-- gcc/combine.c | 4 ++-- gcc/config/rs6000/rs6000.c | 9 +++------ gcc/config/rs6000/rs6000.md | 6 +++--- gcc/emit-rtl.c | 8 ++++++++ gcc/expmed.c | 13 ++++++------- gcc/expr.c | 5 ++--- gcc/optabs.c | 6 +++--- gcc/rtl.h | 2 ++ gcc/simplify-rtx.c | 4 ++-- 10 files changed, 45 insertions(+), 28 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 795c75f1932..fbaee551790 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2002-03-19 Lars Brinkhoff + + * emit-rtl.c (gen_int_mode): New function. + * rtl.h: Prototype for it. + * combine.c (make_extraction, simplify_comparison), expmed.c + (store_bit_field, expand_mult_highpart, expand_divmod), expr.c + (convert_modes, store_field), optabs.c (expand_fix), + simplify-rtx.c (neg_const_int, simplify_unary_real), + + * config/rs6000/rs6000.c, config/rs6000/rs6000.md: + Use it instead of GEN_INT (trunc_int_for_mode (...)). + 2002-03-19 Jakub Jelinek PR c/5656 @@ -95,8 +107,8 @@ 2002-03-18 Aldy Hernandez - * config/rs6000/rs6000.h (PREDICATE_CODES): Add PARALLEL to - any_operand. + * config/rs6000/rs6000.h (PREDICATE_CODES): Add PARALLEL to + any_operand. 2002-03-17 Richard Henderson diff --git a/gcc/combine.c b/gcc/combine.c index 7dc4b29addb..0f175599b29 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6033,7 +6033,7 @@ make_extraction (mode, inner, pos, pos_rtx, len, return new; if (GET_CODE (new) == CONST_INT) - return GEN_INT (trunc_int_for_mode (INTVAL (new), mode)); + return gen_int_mode (INTVAL (new), mode); /* If we know that no extraneous bits are set, and that the high bit is not set, convert the extraction to the cheaper of @@ -10792,7 +10792,7 @@ simplify_comparison (code, pop0, pop1) unsigned HOST_WIDE_INT temp = const_op & GET_MODE_MASK (mode); temp >>= INTVAL (XEXP (op0, 1)); - op1 = GEN_INT (trunc_int_for_mode (temp, mode)); + op1 = gen_int_mode (temp, mode); op0 = XEXP (op0, 0); continue; } diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8ad9fa52e41..de4af5d1d87 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2177,8 +2177,7 @@ rs6000_emit_move (dest, source, mode) /* FIXME. This should never happen. */ /* Since it seems that it does, do the safe thing and convert to a CONST_INT. */ - operands[1] = - GEN_INT (trunc_int_for_mode (CONST_DOUBLE_LOW (operands[1]), mode)); + operands[1] = gen_int_mode (CONST_DOUBLE_LOW (operands[1]), mode); } if (GET_CODE (operands[1]) == CONST_DOUBLE && ! FLOAT_MODE_P (mode) @@ -8312,10 +8311,8 @@ rs6000_emit_eh_toc_restore (stacksize) bottom_of_stack, stacksize, NULL_RTX, 1, OPTAB_WIDEN); - emit_move_insn (tocompare, - GEN_INT (trunc_int_for_mode (TARGET_32BIT - ? 0x80410014 - : 0xE8410028, SImode))); + emit_move_insn (tocompare, gen_int_mode (TARGET_32BIT ? 0x80410014 + : 0xE8410028, SImode)); if (insn_after_throw == NULL_RTX) abort (); diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index f5e27ee68a3..1330361ae72 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -7819,7 +7819,7 @@ else operands[2] = gen_lowpart (SImode, operands[0]); - operands[3] = GEN_INT (trunc_int_for_mode (l, SImode)); + operands[3] = gen_int_mode (l, SImode); }") (define_insn "*movsf_hardfloat" @@ -7909,8 +7909,8 @@ operands[2] = operand_subword (operands[0], endian, 0, DFmode); operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode); - operands[4] = GEN_INT (trunc_int_for_mode (l[endian], SImode)); - operands[5] = GEN_INT (trunc_int_for_mode (l[1 - endian], SImode)); + operands[4] = gen_int_mode (l[endian], SImode); + operands[5] = gen_int_mode (l[1 - endian], SImode); }") (define_split diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 937bd2064e0..d54bacab6b9 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -355,6 +355,14 @@ gen_rtx_CONST_INT (mode, arg) return (rtx) *slot; } +rtx +gen_int_mode (c, mode) + HOST_WIDE_INT c; + enum machine_mode mode; +{ + return GEN_INT (trunc_int_for_mode (c, mode)); +} + /* CONST_DOUBLEs needs special handling because their length is known only at run-time. */ diff --git a/gcc/expmed.c b/gcc/expmed.c index 48a3ef60278..d2edd813c96 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -656,7 +656,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, total_size) value1 = gen_lowpart (maxmode, value1); } else if (GET_CODE (value) == CONST_INT) - value1 = GEN_INT (trunc_int_for_mode (INTVAL (value), maxmode)); + value1 = gen_int_mode (INTVAL (value), maxmode); else if (!CONSTANT_P (value)) /* Parse phase is supposed to make VALUE's data type match that of the component reference, which is a type @@ -2789,7 +2789,7 @@ expand_mult_highpart (mode, op0, cnst1, target, unsignedp, max_cost) if (size > HOST_BITS_PER_WIDE_INT) abort (); - op1 = GEN_INT (trunc_int_for_mode (cnst1, mode)); + op1 = gen_int_mode (cnst1, mode); wide_op1 = immed_double_const (cnst1, @@ -3273,7 +3273,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) if (rem_flag && d < 0) { d = abs_d; - op1 = GEN_INT (trunc_int_for_mode (abs_d, compute_mode)); + op1 = gen_int_mode (abs_d, compute_mode); } if (d == 1) @@ -3312,8 +3312,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) t1 = copy_to_mode_reg (compute_mode, op0); do_cmp_and_jump (t1, const0_rtx, GE, compute_mode, label); - expand_inc (t1, GEN_INT (trunc_int_for_mode - (abs_d - 1, compute_mode))); + expand_inc (t1, gen_int_mode (abs_d - 1, + compute_mode)); emit_label (label); quotient = expand_shift (RSHIFT_EXPR, compute_mode, t1, build_int_2 (lgup, 0), @@ -3853,8 +3853,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, build_int_2 (pre_shift, 0), NULL_RTX, unsignedp); quotient = expand_mult (compute_mode, t1, - GEN_INT (trunc_int_for_mode - (ml, compute_mode)), + gen_int_mode (ml, compute_mode), NULL_RTX, 0); insn = get_last_insn (); diff --git a/gcc/expr.c b/gcc/expr.c index ebe05fc20c9..f8a045a49fd 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1352,7 +1352,7 @@ convert_modes (mode, oldmode, x, unsignedp) && (val & ((HOST_WIDE_INT) 1 << (width - 1)))) val |= (HOST_WIDE_INT) (-1) << width; - return GEN_INT (trunc_int_for_mode (val, mode)); + return gen_int_mode (val, mode); } return gen_lowpart (mode, x); @@ -5150,8 +5150,7 @@ store_field (target, bitsize, bitpos, mode, exp, value_mode, unsignedp, type, if (unsignedp) return expand_and (tmode, temp, - GEN_INT (trunc_int_for_mode (width_mask, - tmode)), + gen_int_mode (width_mask, tmode), NULL_RTX); count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0); diff --git a/gcc/optabs.c b/gcc/optabs.c index 94927b9b2fe..2abf67359c4 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4560,9 +4560,9 @@ expand_fix (to, from, unsignedp) NULL_RTX, 0, OPTAB_LIB_WIDEN); expand_fix (to, target, 0); target = expand_binop (GET_MODE (to), xor_optab, to, - GEN_INT (trunc_int_for_mode - ((HOST_WIDE_INT) 1 << (bitsize - 1), - GET_MODE (to))), + gen_int_mode + ((HOST_WIDE_INT) 1 << (bitsize - 1), + GET_MODE (to)), to, 1, OPTAB_LIB_WIDEN); if (target != to) diff --git a/gcc/rtl.h b/gcc/rtl.h index e8f819c9dd7..711f53b4d9e 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1246,6 +1246,8 @@ extern rtx gen_rtx PARAMS ((enum rtx_code, extern rtvec gen_rtvec PARAMS ((int, ...)); extern rtx copy_insn_1 PARAMS ((rtx)); extern rtx copy_insn PARAMS ((rtx)); +extern rtx gen_int_mode PARAMS ((HOST_WIDE_INT, + enum machine_mode)); /* In rtl.c */ extern rtx rtx_alloc PARAMS ((RTX_CODE)); diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 5fba25cf5a9..21012ce31a3 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -114,7 +114,7 @@ neg_const_int (mode, i) enum machine_mode mode; rtx i; { - return GEN_INT (trunc_int_for_mode (- INTVAL (i), mode)); + return gen_int_mode (- INTVAL (i), mode); } @@ -376,7 +376,7 @@ simplify_unary_real (p) default: abort (); } - args->result = GEN_INT (trunc_int_for_mode (i, args->mode)); + args->result = gen_int_mode (i, args->mode); } else { -- 2.30.2