From c4d70ce3b976c161188e2aac6a4e0a1d5c05cb79 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 9 Aug 2004 06:51:50 +0000 Subject: [PATCH] expr.c (expand_expr_real_1): Use optab_for_tree_code. 2004-08-09 Paolo Bonzini * expr.c (expand_expr_real_1): Use optab_for_tree_code. From-SVN: r85711 --- gcc/ChangeLog | 8 ++++++-- gcc/expr.c | 33 +++++++++++---------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86764366904..5d69b904676 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,8 @@ -2004-07-24 Paolo Bonzini +2004-08-09 Paolo Bonzini + + * expr.c (expand_expr_real_1): Use optab_for_tree_code. + +2004-08-09 Paolo Bonzini * expr.c (var_rtx): Remove. (expand_expr_real_1) +2004-07-18 Paolo Bonzini * config/sh/sh.c (sh_use_dfa_interface): Remove. (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE): Set to diff --git a/gcc/expr.c b/gcc/expr.c index 0c321b95232..211bac8f10b 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -7245,10 +7245,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return op0; case PLUS_EXPR: - this_optab = ! unsignedp && flag_trapv - && (GET_MODE_CLASS (mode) == MODE_INT) - ? addv_optab : add_optab; - /* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and something else, make sure we add the register to the constant and then to the other thing. This case can occur during strength @@ -7383,10 +7379,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return REDUCE_BIT_FIELD (gen_rtx_MINUS (mode, op0, op1)); } - this_optab = ! unsignedp && flag_trapv - && (GET_MODE_CLASS(mode) == MODE_INT) - ? subv_optab : sub_optab; - /* No sense saving up arithmetic to be done if it's all in the wrong mode to form part of an address. And force_operand won't know whether to sign-extend or @@ -7490,7 +7482,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, expand_operands (TREE_OPERAND (TREE_OPERAND (exp, 0), 0), TREE_OPERAND (TREE_OPERAND (exp, 1), 0), NULL_RTX, &op0, &op1, 0); - goto binop2; + goto binop3; } else if (other_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing && innermode == word_mode) @@ -7548,7 +7540,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, build_real (type, dconst1), TREE_OPERAND (exp, 1))), target, tmode, modifier); - this_optab = sdiv_optab; + goto binop; case TRUNC_MOD_EXPR: @@ -7591,9 +7583,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (modifier == EXPAND_STACK_PARM) target = 0; temp = expand_unop (mode, - ! unsignedp && flag_trapv - && (GET_MODE_CLASS(mode) == MODE_INT) - ? negv_optab : neg_optab, op0, target, 0); + optab_for_tree_code (NEGATE_EXPR, type), + op0, target, 0); if (temp == 0) abort (); return REDUCE_BIT_FIELD (temp); @@ -7632,10 +7623,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, /* First try to do it with a special MIN or MAX instruction. If that does not win, use a conditional jump to select the proper value. */ - this_optab = (unsignedp - ? (code == MIN_EXPR ? umin_optab : umax_optab) - : (code == MIN_EXPR ? smin_optab : smax_optab)); - + this_optab = optab_for_tree_code (code, type); temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp, OPTAB_WIDEN); if (temp != 0) @@ -7704,18 +7692,18 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, how to recognize those cases. */ case TRUTH_AND_EXPR: + code = BIT_AND_EXPR; case BIT_AND_EXPR: - this_optab = and_optab; goto binop; case TRUTH_OR_EXPR: + code = BIT_OR_EXPR; case BIT_IOR_EXPR: - this_optab = ior_optab; goto binop; case TRUTH_XOR_EXPR: + code = BIT_XOR_EXPR; case BIT_XOR_EXPR: - this_optab = xor_optab; goto binop; case LSHIFT_EXPR: @@ -8198,12 +8186,13 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, modifier, alt_rtl); } - /* Here to do an ordinary binary operator, generating an instruction - from the optab already placed in `this_optab'. */ + /* Here to do an ordinary binary operator. */ binop: expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), subtarget, &op0, &op1, 0); binop2: + this_optab = optab_for_tree_code (code, type); + binop3: if (modifier == EXPAND_STACK_PARM) target = 0; temp = expand_binop (mode, this_optab, op0, op1, target, -- 2.30.2