i386.md (*sibcall_memory): Rename from *sibcall_intern.
authorUros Bizjak <uros@gcc.gnu.org>
Wed, 18 Jun 2014 10:32:15 +0000 (12:32 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 18 Jun 2014 10:32:15 +0000 (12:32 +0200)
* 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
gcc/config/i386/i386.md
gcc/config/i386/predicates.md

index 29c8e529b0ef03e2ffee5841e17fcf6930f478ac..2089dec9e2f71f57dddeb0d6153574742aa547f5 100644 (file)
@@ -1,3 +1,23 @@
+2014-06-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       * 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  <terry.guo@arm.com>
 
        PR target/61544
@@ -41,9 +61,8 @@
 
 2014-06-18  Jakub Jelinek  <jakub@redhat.com>
 
-       * 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
        * 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  <amacleod@redhat.com>
 
        * 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  <rguenther@suse.de>
 
        * 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.
 2014-06-10  Thomas Schwinge  <thomas@codesourcery.com>
 
        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.
 
index 228e3e8ab7b5996ab8f97625b79db3cc7c538524..7cb896423fc5542a7380e460b36be5535ab7b43f 100644 (file)
   "* 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"))
-   (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:DI 0 "register_operand")
-        (match_operand:DI 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))])
-
-(define_peephole2
-  [(set (match_operand:SI 0 "register_operand")
-        (match_operand:SI 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:SI 0 "register_operand")
-        (match_operand:SI 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))])
+   (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)
   "* 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
 
   "* 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)))])
-
-(define_peephole2
-  [(set (match_operand:DI 0 "register_operand")
-        (match_operand:DI 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)))])
-
-(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)))])
+  "!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:SI 0 "register_operand")
-        (match_operand:SI 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)))])
+   (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"
   "* 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))"
+                  (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))
+   && peep2_reg_dead_p (2, operands[0])"
   [(parallel [(set (match_dup 2)
-             (call (unspec [(mem:QI (match_dup 1))] UNSPEC_PEEPSIB)
-                   (match_dup 3)))
+                  (call (mem:QI (match_dup 1))
+                        (match_dup 3)))
              (set (reg:SI SP_REG)
                   (plus:SI (reg:SI SP_REG)
-                           (match_dup 4)))])])
+                           (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))"
+                  (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 (2))
+   && peep2_reg_dead_p (3, operands[0])"
   [(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 1))
+                        (match_dup 3)))
              (set (reg:SI SP_REG)
                   (plus:SI (reg:SI SP_REG)
-                           (match_dup 4)))])])
+                           (match_dup 4)))
+             (unspec [(const_int 0)] UNSPEC_PEEPSIB)])])
 
 ;; Call subroutine returning any type.
 
index 6794372f199959a1bd6b5b1e45e35a1f0660b457..62970bea8c44a89f7bd1e4841c2013c68b5cac2f 100644 (file)
   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"
   (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")