From 9fdb837f67dfa03da55cc5a9e51fa492c2a72f3b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 18 Jun 2014 12:32:15 +0200 Subject: [PATCH] i386.md (*sibcall_memory): Rename from *sibcall_intern. * config/i386/i386.md (*sibcall_memory): Rename from *sibcall_intern. Do not use unspec as call operand. Use memory_operand instead of memory_nox32_operand and add "m" operand constraint. Disable pattern for TARGET_X32. (*sibcall_pop_memory): Ditto. (*sibcall_value_memory): Ditto. (*sibcall_value_pop_memory): Ditto. (sibcall peepholes): Merge SImode and DImode patterns using W mode iterator. Use memory_operand instead of memory_nox32_operand. Disable pattern for TARGET_X32. Check if eliminated register is really dead after call insn. Generate call RTX without unspec operand. (sibcall_value peepholes): Ditto. (sibcall_pop peepholes): Fix call insn RTXes. Use memory_operand instead of memory_nox32_operand. Check if eliminated register is really dead after call insn. Generate call RTX without unspec operand. (sibcall_value_pop peepholes): Ditto. * config/i386/predicates.md (memory_nox32_operand): Remove predicate. From-SVN: r211776 --- gcc/ChangeLog | 41 +++++-- gcc/config/i386/i386.md | 219 +++++++++++++++------------------- gcc/config/i386/predicates.md | 12 +- 3 files changed, 130 insertions(+), 142 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29c8e529b0e..2089dec9e2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2014-06-18 Uros Bizjak + + * config/i386/i386.md (*sibcall_memory): Rename from *sibcall_intern. + Do not use unspec as call operand. Use memory_operand instead of + memory_nox32_operand and add "m" operand constraint. Disable + pattern for TARGET_X32. + (*sibcall_pop_memory): Ditto. + (*sibcall_value_memory): Ditto. + (*sibcall_value_pop_memory): Ditto. + (sibcall peepholes): Merge SImode and DImode patterns using + W mode iterator. Use memory_operand instead of memory_nox32_operand. + Disable pattern for TARGET_X32. Check if eliminated register is + really dead after call insn. Generate call RTX without unspec operand. + (sibcall_value peepholes): Ditto. + (sibcall_pop peepholes): Fix call insn RTXes. Use memory_operand + instead of memory_nox32_operand. Check if eliminated register is + really dead after call insn. Generate call RTX without unspec operand. + (sibcall_value_pop peepholes): Ditto. + * config/i386/predicates.md (memory_nox32_operand): Remove predicate. + 2014-06-18 Terry Guo PR target/61544 @@ -41,9 +61,8 @@ 2014-06-18 Jakub Jelinek - * gimplify.c (omp_notice_variable): If n is non-NULL - and no flags change in ORT_TARGET region, don't jump to - do_outer. + * gimplify.c (omp_notice_variable): If n is non-NULL and no flags + changed in ORT_TARGET region, don't jump to do_outer. (struct gimplify_adjust_omp_clauses_data): New type. (gimplify_adjust_omp_clauses_1): Adjust for data being a struct gimplify_adjust_omp_clauses_data pointer instead @@ -62,13 +81,11 @@ * omp-low.c (scan_sharing_clauses): Call scan_omp_op on non-DECL_P OMP_CLAUSE_DECL if ctx->outer. (scan_omp_parallel, lower_omp_for): When adding - _LOOPTEMP_ clause var, add it to outer ctx's decl_map - as identity. + _LOOPTEMP_ clause var, add it to outer ctx's decl_map as identity. * tree-core.h (OMP_CLAUSE_MAP_TO_PSET): New map kind. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle various OpenMP 4.0 clauses. - * tree-pretty-print.c (dump_omp_clause): Handle - OMP_CLAUSE_MAP_TO_PSET. + * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_MAP_TO_PSET. 2014-06-17 Andrew MacLeod @@ -187,7 +204,8 @@ * ipa-visiblity.c (cgraph_externally_visible_p): Cleanup. (update_visibility_by_resolution_info): Consider UNDEF; fix checking; reset sections of symbols dragged out of the comdats. - (function_and_variable_visibility): Reset sections of localized symbols. + (function_and_variable_visibility): Reset sections of + localized symbols. 2014-06-16 Richard Biener @@ -599,8 +617,8 @@ * tree.h (decl_section_name, set_decl_section_name): Update prototypes. * sdbout.c (sdbout_one_type): Update. * tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Update. - * varasm.c (IN_NAMED_SECTION, get_named_section, resolve_unique_section, - hot_function_section, get_named_text_section, + * varasm.c (IN_NAMED_SECTION, get_named_section, + resolve_unique_section, hot_function_section, get_named_text_section, USE_SELECT_SECTION_FOR_FUNCTIONS, default_function_rodata_section, make_decl_rtl, default_unique_section): Update. * config/c6x/c6x.c (c6x_in_small_data_p): Update. @@ -1064,8 +1082,7 @@ 2014-06-10 Thomas Schwinge PR lto/61334 - * configure.ac: Use gcc_AC_CHECK_DECLS to check for strnlen - prototype. + * configure.ac: Use gcc_AC_CHECK_DECLS to check for strnlen prototype. * config.in: Regenerate. * configure: Likewise. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 228e3e8ab7b..7cb896423fc 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11354,52 +11354,37 @@ "* return ix86_output_call_insn (insn, operands[0]);" [(set_attr "type" "call")]) -(define_insn "*sibcall_intern" - [(call (unspec [(mem:QI (match_operand:W 0 "memory_nox32_operand"))] - UNSPEC_PEEPSIB) - (match_operand 1))] - "" +(define_insn "*sibcall_memory" + [(call (mem:QI (match_operand:W 0 "memory_operand" "m")) + (match_operand 1)) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)] + "!TARGET_X32" "* return ix86_output_call_insn (insn, operands[0]);" [(set_attr "type" "call")]) (define_peephole2 - [(set (match_operand:DI 0 "register_operand") - (match_operand:DI 1 "memory_nox32_operand")) + [(set (match_operand:W 0 "register_operand") + (match_operand:W 1 "memory_operand")) (call (mem:QI (match_dup 0)) - (match_operand 3))] - "TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3))]) + (match_operand 3))] + "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1)) + && peep2_reg_dead_p (2, operands[0])" + [(parallel [(call (mem:QI (match_dup 1)) + (match_dup 3)) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_peephole2 - [(set (match_operand:DI 0 "register_operand") - (match_operand:DI 1 "memory_nox32_operand")) + [(set (match_operand:W 0 "register_operand") + (match_operand:W 1 "memory_operand")) (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) (call (mem:QI (match_dup 0)) - (match_operand 3))] - "TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))" + (match_operand 3))] + "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2)) + && peep2_reg_dead_p (3, operands[0])" [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3))]) - -(define_peephole2 - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) - (call (mem:QI (match_dup 0)) - (match_operand 3))] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3))]) - -(define_peephole2 - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) - (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (call (mem:QI (match_dup 0)) - (match_operand 3))] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))" - [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) (match_dup 3))]) + (parallel [(call (mem:QI (match_dup 1)) + (match_dup 3)) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_expand "call_pop" [(parallel [(call (match_operand:QI 0) @@ -11434,42 +11419,52 @@ "* return ix86_output_call_insn (insn, operands[0]);" [(set_attr "type" "call")]) -(define_insn "*sibcall_pop_intern" - [(call (unspec [(mem:QI (match_operand:SI 0 "memory_nox32_operand"))] - UNSPEC_PEEPSIB) +(define_insn "*sibcall_pop_memory" + [(call (mem:QI (match_operand:SI 0 "memory_operand" "m")) (match_operand 1)) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) - (match_operand:SI 2 "immediate_operand" "i")))] + (match_operand:SI 2 "immediate_operand" "i"))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)] "!TARGET_64BIT" "* return ix86_output_call_insn (insn, operands[0]);" [(set_attr "type" "call")]) (define_peephole2 [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) + (match_operand:SI 1 "memory_operand")) (parallel [(call (mem:QI (match_dup 0)) (match_operand 3)) (set (reg:SI SP_REG) - (match_operand 4))])] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(parallel [(call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) + (plus:SI (reg:SI SP_REG) + (match_operand:SI 4 "immediate_operand")))])] + "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1)) + && peep2_reg_dead_p (2, operands[0])" + [(parallel [(call (mem:QI (match_dup 1)) (match_dup 3)) - (set (reg:SI SP_REG) (match_dup 4))])]) + (set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_dup 4))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_peephole2 [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) + (match_operand:SI 1 "memory_operand")) (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) (parallel [(call (mem:QI (match_dup 0)) (match_operand 3)) (set (reg:SI SP_REG) - (match_operand 4))])] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))" + (plus:SI (reg:SI SP_REG) + (match_operand:SI 4 "immediate_operand")))])] + "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2)) + && peep2_reg_dead_p (3, operands[0])" [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (parallel [(call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) + (parallel [(call (mem:QI (match_dup 1)) (match_dup 3)) - (set (reg:SI SP_REG) (match_dup 4))])]) + (set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_dup 4))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) ;; Call subroutine, returning value in operand 0 @@ -11513,62 +11508,42 @@ "* return ix86_output_call_insn (insn, operands[1]);" [(set_attr "type" "callv")]) -(define_insn "*sibcall_value_intern" +(define_insn "*sibcall_value_memory" [(set (match_operand 0) - (call (unspec [(mem:QI (match_operand:W 1 "memory_nox32_operand"))] - UNSPEC_PEEPSIB) - (match_operand 2)))] - "" + (call (mem:QI (match_operand:W 1 "memory_operand" "m")) + (match_operand 2))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)] + "!TARGET_X32" "* return ix86_output_call_insn (insn, operands[1]);" [(set_attr "type" "callv")]) (define_peephole2 - [(set (match_operand:DI 0 "register_operand") - (match_operand:DI 1 "memory_nox32_operand")) + [(set (match_operand:W 0 "register_operand") + (match_operand:W 1 "memory_operand")) (set (match_operand 2) (call (mem:QI (match_dup 0)) (match_operand 3)))] - "TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3)))]) + "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1)) + && peep2_reg_dead_p (2, operands[0])" + [(parallel [(set (match_dup 2) + (call (mem:QI (match_dup 1)) + (match_dup 3))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_peephole2 - [(set (match_operand:DI 0 "register_operand") - (match_operand:DI 1 "memory_nox32_operand")) + [(set (match_operand:W 0 "register_operand") + (match_operand:W 1 "memory_operand")) (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) (set (match_operand 2) (call (mem:QI (match_dup 0)) (match_operand 3)))] - "TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))" + "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2)) + && peep2_reg_dead_p (3, operands[0])" [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3)))]) - -(define_peephole2 - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) - (set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3)))] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3)))]) - -(define_peephole2 - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) - (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3)))] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))" - [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3)))]) + (parallel [(set (match_dup 2) + (call (mem:QI (match_dup 1)) + (match_dup 3))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_insn "*call_value_rex64_ms_sysv" [(match_parallel 3 "call_rex64_ms_sysv_operation" @@ -11616,55 +11591,57 @@ "* return ix86_output_call_insn (insn, operands[1]);" [(set_attr "type" "callv")]) -(define_insn "*sibcall_value_pop_intern" +(define_insn "*sibcall_value_pop_memory" [(set (match_operand 0) - (call (unspec [(mem:QI (match_operand:SI 1 "memory_nox32_operand"))] - UNSPEC_PEEPSIB) - (match_operand 2))) + (call (mem:QI (match_operand:SI 1 "memory_operand" "m")) + (match_operand 2))) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) - (match_operand:SI 3 "immediate_operand" "i")))] + (match_operand:SI 3 "immediate_operand" "i"))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)] "!TARGET_64BIT" "* return ix86_output_call_insn (insn, operands[1]);" [(set_attr "type" "callv")]) (define_peephole2 [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) + (match_operand:SI 1 "memory_operand")) (parallel [(set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3))) - (set (reg:SI SP_REG) - (plus:SI (reg:SI SP_REG) - (match_operand:SI 4 "immediate_operand")))] - )] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(parallel [(set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3))) + (call (mem:QI (match_dup 0)) + (match_operand 3))) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) - (match_dup 4)))])]) + (match_operand:SI 4 "immediate_operand")))])] + "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1)) + && peep2_reg_dead_p (2, operands[0])" + [(parallel [(set (match_dup 2) + (call (mem:QI (match_dup 1)) + (match_dup 3))) + (set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_dup 4))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) (define_peephole2 [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "memory_nox32_operand")) + (match_operand:SI 1 "memory_operand")) (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) (parallel [(set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3))) - (set (reg:SI SP_REG) - (plus:SI (reg:SI SP_REG) - (match_operand:SI 4 "immediate_operand")))] - )] - "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))" - [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (parallel [(set (match_dup 2) - (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB) - (match_dup 3))) + (call (mem:QI (match_dup 0)) + (match_operand 3))) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) - (match_dup 4)))])]) + (match_operand:SI 4 "immediate_operand")))])] + "!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2)) + && peep2_reg_dead_p (3, operands[0])" + [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) + (parallel [(set (match_dup 2) + (call (mem:QI (match_dup 1)) + (match_dup 3))) + (set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_dup 4))) + (unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) ;; Call subroutine returning any type. diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 6794372f199..62970bea8c4 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -71,11 +71,10 @@ return ANY_QI_REG_P (op); }) +;; Return true if OP is a memory operands that can be used in sibcalls. (define_predicate "sibcall_memory_operand" - (match_operand 0 "memory_operand") -{ - return CONSTANT_P (XEXP (op, 0)); -}) + (and (match_operand 0 "memory_operand") + (match_test "CONSTANT_P (XEXP (op, 0))"))) ;; Match an SI or HImode register for a zero_extract. (define_special_predicate "ext_register_operand" @@ -587,11 +586,6 @@ (ior (match_operand 0 "register_no_elim_operand") (match_operand 0 "immediate_operand"))) -;; Test for a valid memory operand. -(define_predicate "memory_nox32_operand" - (and (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand"))) - ;; Test for a valid operand for indirect branch. (define_predicate "indirect_branch_operand" (ior (match_operand 0 "register_operand")