From 3968b0504cfc12e1b1f7d6eb385f4d7427a1b32b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 9 Aug 2011 09:38:02 +0200 Subject: [PATCH] re PR target/49781 ([x32] Unnecessary lea in x32 mode) PR target/49781 * config/i386/i386.md (reload_noff_load): New. (reload_noff_store): Ditto. * config/i386/i386.c (ix86_secondary_reload): Use CODE_FOR_reload_noff_load and CODE_FOR_reload_noff_store to handle double-word moves from/to non-offsetable addresses instead of generating XMM temporary. From-SVN: r177583 --- gcc/ChangeLog | 30 +++++++++++++++++------------- gcc/config/i386/i386.c | 15 +++++++++++---- gcc/config/i386/i386.md | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cf86f47322..5832ec1f760 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-08-09 Uros Bizjak + + PR target/49781 + * config/i386/i386.md (reload_noff_load): New. + (reload_noff_store): Ditto. + * config/i386/i386.c (ix86_secondary_reload): Use + CODE_FOR_reload_noff_load and CODE_FOR_reload_noff_store to handle + double-word moves from/to non-offsetable addresses instead of + generating XMM temporary. + 2011-08-09 Anatoly Sokolov * config/mmix/mmix.h (REG_OK_FOR_BASE_P, REG_OK_FOR_INDEX_P): Remove. @@ -47,15 +57,13 @@ (tree-streamer.o): New. (tree-streamer-in.o): New. (tree-streamer-out.o): New. - (lto-cgraph.o): Add dependency on DATA_STREAMER_H and - TREE_STREAMER_H. + (lto-cgraph.o): Add dependency on DATA_STREAMER_H and TREE_STREAMER_H. (lto-streamer-in.o): Add dependency on DATA_STREAMER_H, GIMPLE_STREAMER_H and TREE_STREAMER_H. (lto-streamer-out.o): Add dependency on DATA_STREAMER_H, GIMPLE_STREAMER_H and TREE_STREAMER_H. (lto-streamer.o): Add dependency on STREAMER_HOOKS_H. - (ipa-prop.o): Add dependency on DATA_STREAMER_H and - TREE_STREAMER_H. + (ipa-prop.o): Add dependency on DATA_STREAMER_H and TREE_STREAMER_H. (ipa-inline-analysis.o): Likewise. (ipa-pure-const.o): Likewise. * data-streamer-in.c: New. @@ -80,8 +88,7 @@ (lto_output_sleb128_stream): Likewise. (bp_pack_var_len_unsigned): Likewise. (bp_pack_var_len_int): Likewise. - * lto-streamer-in.c: Include data-streamer.h and - gimple-streamer.h. + * lto-streamer-in.c: Include data-streamer.h and gimple-streamer.h. (struct string_slot): Remove. Update all users. (lto_tag_check_set): Make extern. (lto_tag_check_range): Move to lto-streamer.h. @@ -95,8 +102,7 @@ (lto_input_string): Move to data-streamer-in.c (input_record_start): Move to data-streamer.h (canon_file_name): Use new definition of struct string_slot - from data-streamer.h. - Set S_SLOT.LEN. + from data-streamer.h. Set S_SLOT.LEN. (lto_input_location): Make extern. (lto_input_chain): Move to tree-streamer-in.c. (lto_init_eh): Make extern. @@ -211,8 +217,7 @@ (streamer_hooks_init): Move to streamer-hooks.c. * lto-streamer.h: Include diagnostic.h (struct output_block, struct lto_input_block, - struct data_in, struct bitpack_d): Remove forward - declarations. + struct data_in, struct bitpack_d): Remove forward declarations. (struct bitpack_d): Move to data-streamer.h. (struct lto_streamer_cache_d): Move to tree-streamer.h. (struct streamer_hooks): Move to streamer-hooks.h. @@ -253,10 +258,9 @@ * gthr.h [_PTHREADS95]: Remove. * configure.ac (enable_threads): Remove posix95. * configure: Regenerate. - * doc/install.texi (Configuration, --enable-threads): Remove - posix95. + * doc/install.texi (Configuration, --enable-threads): Remove posix95. -2011-08-07 Uros Bizjak +2011-08-08 Uros Bizjak PR target/49781 * config/i386/i386.c (ix86_decompose_address): Allow zero-extended diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9a21e6bf918..68103565679 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -28247,17 +28247,24 @@ ix86_preferred_output_reload_class (rtx x, reg_class_t regclass) static reg_class_t ix86_secondary_reload (bool in_p, rtx x, reg_class_t rclass, - enum machine_mode mode, - secondary_reload_info *sri ATTRIBUTE_UNUSED) + enum machine_mode mode, secondary_reload_info *sri) { /* Double-word spills from general registers to non-offsettable memory - references (zero-extended addresses) go through XMM register. */ + references (zero-extended addresses) require special handling. */ if (TARGET_64BIT && MEM_P (x) && GET_MODE_SIZE (mode) > UNITS_PER_WORD && rclass == GENERAL_REGS && !offsettable_memref_p (x)) - return SSE_REGS; + { + sri->icode = (in_p + ? CODE_FOR_reload_noff_load + : CODE_FOR_reload_noff_store); + /* Add the cost of move to a temporary. */ + sri->extra_cost = 1; + + return NO_REGS; + } /* QImode spills from non-QI registers require intermediate register on 32bit targets. */ diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index ee93e71bed4..9dc5c853980 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2073,6 +2073,40 @@ (const_string "orig"))) (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,TI,DI,TI,DI,DI,DI,DI,DI")]) +;; Reload patterns to support multi-word load/store +;; with non-offsetable address. +(define_expand "reload_noff_store" + [(parallel [(match_operand 0 "memory_operand" "=m") + (match_operand 1 "register_operand" "r") + (match_operand:DI 2 "register_operand" "=&r")])] + "TARGET_64BIT" +{ + rtx mem = operands[0]; + rtx addr = XEXP (mem, 0); + + emit_move_insn (operands[2], addr); + mem = replace_equiv_address_nv (mem, operands[2]); + + emit_insn (gen_rtx_SET (VOIDmode, mem, operands[1])); + DONE; +}) + +(define_expand "reload_noff_load" + [(parallel [(match_operand 0 "register_operand" "=r") + (match_operand 1 "memory_operand" "m") + (match_operand:DI 2 "register_operand" "=r")])] + "TARGET_64BIT" +{ + rtx mem = operands[1]; + rtx addr = XEXP (mem, 0); + + emit_move_insn (operands[2], addr); + mem = replace_equiv_address_nv (mem, operands[2]); + + emit_insn (gen_rtx_SET (VOIDmode, operands[0], mem)); + DONE; +}) + ;; Convert impossible stores of immediate to existing instructions. ;; First try to get scratch register and go through it. In case this ;; fails, move by 32bit parts. -- 2.30.2