From 390b2b32773f84b28c8e6c7abee2ba57efcafe9a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 7 Jun 2010 21:51:19 +0200 Subject: [PATCH] i386.md (*add_1): Remove alternative 2. * config/i386/i386.md (*add_1): Remove alternative 2. : Split instruction. : Remove alternative 2 handling. (*addsi_1_zext) : Split instruction. (add lea splitter): Generate SImode lea for mode sizes <= SImode. (add_zext lea splitter): Use ix86_lea_for_add_ok in insn predicate. (*movsi_1) : Use %a modifier to output operand 1. (ashift_zext lea splitter): Use DImode for multiplication. * config/i386/i386.c (ix86_expand_epilogue): Do not use ix86_gen_add to generate addition. From-SVN: r160394 --- gcc/ChangeLog | 31 ++++++--- gcc/config/i386/i386.c | 9 +-- gcc/config/i386/i386.md | 137 +++++++++++++++++++--------------------- gcc/testsuite/ChangeLog | 12 ++-- 4 files changed, 99 insertions(+), 90 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8565d929c7d..181781e3fdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2010-06-07 Uros Bizjak + + * config/i386/i386.md (*add_1): Remove alternative 2. + : Split instruction. + : Remove alternative 2 handling. + (*addsi_1_zext) : Split instruction. + (add lea splitter): Generate SImode lea for mode sizes <= SImode. + (add_zext lea splitter): Use ix86_lea_for_add_ok in insn predicate. + + (*movsi_1) : Use %a modifier to output operand 1. + (ashift_zext lea splitter): Use DImode for multiplication. + + * config/i386/i386.c (ix86_expand_epilogue): Do not use ix86_gen_add + to generate addition. + 2010-06-07 Joseph Myers * common.opt (fira-verbose): Use Var. @@ -9,8 +24,7 @@ flag_detailed_statistics, flag_remove_unreachable_functions): Remove. * toplev.c (flag_detailed_statistics, flag_signed_char, - flag_short_enums, flag_pcc_struct_return, flag_ira_verbose): - Remove. + flag_short_enums, flag_pcc_struct_return, flag_ira_verbose): Remove. (DEFAULT_PCC_STRUCT_RETURN): Move definition to defaults.h. * toplev.h (flag_crossjumping, flag_if_conversion, flag_if_conversion2, flag_keep_static_consts, flag_peel_loops, @@ -95,7 +109,7 @@ and above and defer till target is known. (optimization_options): Turn on zee pass if TARGET_64BIT is set and turn off otherwise. - + 2010-05-25 Jan Hubicka * df-core.c (df_set_blocks): Use bitmap_head instead of bitmap. @@ -136,7 +150,7 @@ 2010-06-06 Manuel López-Ibáñez PR c/20000 - * c-decl.c (grokdeclarator): Delete warning. + * c-decl.c (grokdeclarator): Delete warning. 2010-06-06 Eric Botcazou @@ -327,8 +341,7 @@ 2010-06-04 H.J. Lu PR boostrap/44421 - * df-problems.c (df_lr_bb_local_compute): Updated for embedded - bitmaps. + * df-problems.c (df_lr_bb_local_compute): Updated for embedded bitmaps. (df_byte_lr_bb_local_compute): Likewise. 2010-06-03 Jason Merrill @@ -358,11 +371,11 @@ (*addqi_1_lea) : Ditto. (*add_2) : Remove assert that operand 0 and operand 1 are equal. - : Ditto. Remove ??? comment. + : Ditto. Remove ??? comment. (*add_3) : Remove assert that operand 0 and operand 1 are equal. - : Ditto. Remove ??? comment. - (*adddi_4) : Remove assert that operand 0 and operand 1 + : Ditto. Remove ??? comment. + (*adddi_4) : Remove assert that operand 0 and operand 1 are equal. (*add_4) : Ditto. (*add_5) : Ditto. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 407238fd430..df18fdbd7eb 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9356,10 +9356,11 @@ ix86_expand_epilogue (int style) if (!call_used_regs[REGNO (crtl->drap_reg)]) param_ptr_offset += UNITS_PER_WORD; - insn = emit_insn ((*ix86_gen_add3) (stack_pointer_rtx, - crtl->drap_reg, - GEN_INT (-param_ptr_offset))); - + insn = emit_insn (gen_rtx_SET + (VOIDmode, stack_pointer_rtx, + gen_rtx_PLUS (Pmode, + crtl->drap_reg, + GEN_INT (-param_ptr_offset)))); ix86_cfa_state->reg = stack_pointer_rtx; ix86_cfa_state->offset = param_ptr_offset; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index d446633aaa1..f7972445cc3 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -1710,7 +1710,7 @@ return "movd\t{%1, %0|%0, %1}"; case TYPE_LEA: - return "lea{l}\t{%1, %0|%0, %1}"; + return "lea{l}\t{%a1, %0|%0, %a1}"; default: gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1])); @@ -6077,18 +6077,17 @@ (set_attr "mode" "SI")]) (define_insn "*add_1" - [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r,r") + [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r") (plus:SWI48 - (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r") - (match_operand:SWI48 2 "" ",r,0,l"))) + (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r") + (match_operand:SWI48 2 "" ",r,l"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, mode, operands)" { switch (get_attr_type (insn)) { case TYPE_LEA: - operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0)); - return "lea{}\t{%a2, %0|%0, %a2}"; + return "#"; case TYPE_INCDEC: gcc_assert (rtx_equal_p (operands[0], operands[1])); @@ -6101,10 +6100,6 @@ } default: - /* Use add as much as possible to replace lea for AGU optimization. */ - if (which_alternative == 2 && TARGET_OPT_AGU) - return "add{}\t{%1, %0|%0, %1}"; - gcc_assert (rtx_equal_p (operands[0], operands[1])); if (x86_maybe_negate_const_int (&operands[2], mode)) return "sub{}\t{%2, %0|%0, %2}"; @@ -6113,11 +6108,8 @@ } } [(set (attr "type") - (cond [(and (eq_attr "alternative" "2") - (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0))) + (cond [(eq_attr "alternative" "2") (const_string "lea") - (eq_attr "alternative" "3") - (const_string "lea") (match_operand:SWI48 2 "incdec_operand" "") (const_string "incdec") ] @@ -6146,8 +6138,7 @@ switch (get_attr_type (insn)) { case TYPE_LEA: - operands[2] = XEXP (SET_SRC (XVECEXP (PATTERN (insn), 0, 0)), 0); - return "lea{l}\t{%a2, %k0|%k0, %a2}"; + return "#"; case TYPE_INCDEC: if (operands[2] == const1_rtx) @@ -6398,6 +6389,64 @@ (const_string "none"))) (set_attr "mode" "QI")]) +;; Convert lea to the lea pattern to avoid flags dependency. +(define_split + [(set (match_operand:DI 0 "register_operand" "") + (plus:DI (match_operand:DI 1 "register_operand" "") + (match_operand:DI 2 "x86_64_nonmemory_operand" ""))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_64BIT && reload_completed + && ix86_lea_for_add_ok (PLUS, insn, operands)" + [(set (match_dup 0) + (plus:DI (match_dup 1) + (match_dup 2)))] + "") + +;; Convert lea to the lea pattern to avoid flags dependency. +(define_split + [(set (match_operand 0 "register_operand" "") + (plus (match_operand 1 "register_operand" "") + (match_operand 2 "nonmemory_operand" ""))) + (clobber (reg:CC FLAGS_REG))] + "reload_completed + && ix86_lea_for_add_ok (PLUS, insn, operands) + && GET_MODE_SIZE (GET_MODE (operands[0])) <= 4" + [(const_int 0)] +{ + rtx pat; + enum machine_mode mode = GET_MODE (operands[0]); + + if (GET_MODE_SIZE (mode) < 4) + operands[0] = gen_lowpart (SImode, operands[0]); + if (mode != Pmode) + { + operands[1] = gen_lowpart (Pmode, operands[1]); + operands[2] = gen_lowpart (Pmode, operands[2]); + } + + pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]); + if (Pmode != SImode) + pat = gen_rtx_SUBREG (SImode, pat, 0); + emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat)); + DONE; +}) + +;; Convert lea to the lea pattern to avoid flags dependency. +(define_split + [(set (match_operand:DI 0 "register_operand" "") + (zero_extend:DI + (plus:SI (match_operand:SI 1 "register_operand" "") + (match_operand:SI 2 "nonmemory_operand" "")))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_64BIT && reload_completed + && ix86_lea_for_add_ok (PLUS, insn, operands)" + [(set (match_dup 0) + (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))] +{ + operands[1] = gen_lowpart (Pmode, operands[1]); + operands[2] = gen_lowpart (Pmode, operands[2]); +}) + (define_insn "*add_2" [(set (reg FLAGS_REG) (compare @@ -6939,60 +6988,6 @@ } [(set_attr "type" "lea") (set_attr "mode" "SI")]) - -;; Convert lea to the lea pattern to avoid flags dependency. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (plus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "x86_64_nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed - && ix86_lea_for_add_ok (PLUS, insn, operands)" - [(set (match_dup 0) - (plus:DI (match_dup 1) - (match_dup 2)))] - "") - -;; Convert lea to the lea pattern to avoid flags dependency. -(define_split - [(set (match_operand 0 "register_operand" "") - (plus (match_operand 1 "register_operand" "") - (match_operand 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] - "reload_completed && ix86_lea_for_add_ok (PLUS, insn, operands)" - [(const_int 0)] -{ - rtx pat; - /* In -fPIC mode the constructs like (const (unspec [symbol_ref])) - may confuse gen_lowpart. */ - if (GET_MODE (operands[0]) != Pmode) - { - operands[1] = gen_lowpart (Pmode, operands[1]); - operands[2] = gen_lowpart (Pmode, operands[2]); - } - operands[0] = gen_lowpart (SImode, operands[0]); - pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]); - if (Pmode != SImode) - pat = gen_rtx_SUBREG (SImode, pat, 0); - emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat)); - DONE; -}) - -;; Convert lea to the lea pattern to avoid flags dependency. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI - (plus:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "nonmemory_operand" "")))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed - && true_regnum (operands[0]) != true_regnum (operands[1])" - [(set (match_dup 0) - (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))] -{ - operands[1] = gen_lowpart (Pmode, operands[1]); - operands[2] = gen_lowpart (Pmode, operands[2]); -}) ;; Subtract instructions @@ -9807,7 +9802,7 @@ "TARGET_64BIT && reload_completed && true_regnum (operands[0]) != true_regnum (operands[1])" [(set (match_dup 0) - (zero_extend:DI (subreg:SI (mult:SI (match_dup 1) (match_dup 2)) 0)))] + (zero_extend:DI (subreg:SI (mult:DI (match_dup 1) (match_dup 2)) 0)))] { operands[1] = gen_lowpart (Pmode, operands[1]); operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70d709eb076..fd6994a3c36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -44,11 +44,11 @@ Additional add dg-compile to avoid failure due missing foo symbol. - * gcc.dg/compound-literal-1.c: Fix for llp64. - * gcc.dg/pr32370.c: Likewise. - * gcc.dg/pr37561.c: Likewise. - * gcc.dg/pr41340.c: Likewise. - * gcc.dg/pr41551.c: Likewise. + * gcc.dg/compound-literal-1.c: Fix for llp64. + * gcc.dg/pr32370.c: Likewise. + * gcc.dg/pr37561.c: Likewise. + * gcc.dg/pr41340.c: Likewise. + * gcc.dg/pr41551.c: Likewise. 2010-05-25 Dodji Seketeli @@ -58,7 +58,7 @@ 2010-06-06 Manuel López-Ibáñez PR c/20000 - * c-c++-common/pr20000.c: New. + * c-c++-common/pr20000.c: New. 2010-06-05 Fabien Chêne -- 2.30.2