]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386.md (push): Prohibit symbolic constants if flag_pic.
authorJeff Law <law@gcc.gnu.org>
Mon, 9 Feb 1998 22:08:43 +0000 (15:08 -0700)
committerJeff Law <law@gcc.gnu.org>
Mon, 9 Feb 1998 22:08:43 +0000 (15:08 -0700)
        * i386.md (push): Prohibit symbolic constants if flag_pic.
        (movsi+1): Likewise for move to non-register.
GOT fix.
Mon Feb  9 23:07:04 1998  John Wehle  (john@feith.com)
        * i386.md: Remove redundant integer push patterns.
        Don't bother checking for TARGET_PUSH_MEMORY when
        pushing constants or registers.
To avoid having to untangle the got changes....

From-SVN: r17816

gcc/ChangeLog
gcc/config/i386/i386.md

index 22ec9422673770177b82a32fa71d805e5dc5f2bb..7f3e53fc61088aeb39a544cb1d75a19d9d52c3ce 100644 (file)
@@ -1,3 +1,14 @@
+Mon Feb  9 23:08:56 1998  Richard Henderson  <rth@cygnus.com>
+
+       * i386.md (push): Prohibit symbolic constants if flag_pic.
+       (movsi+1): Likewise for move to non-register.
+
+Mon Feb  9 23:07:04 1998  John Wehle  (john@feith.com)
+
+       * i386.md: Remove redundant integer push patterns.
+       Don't bother checking for TARGET_PUSH_MEMORY when
+       pushing constants or registers.
+
 1998-01-28  Mike Stump  <mrs@wrs.com>
  
        * rtlanal.c (dead_or_set_regno_p): Ignore REG_DEAD notes after
index 8ae87644505007dc6d39bdcbe03dc4d7b357ba8f..16c5a31dae6d78987e78a4a07ccc8d2e3c484ff7 100644 (file)
@@ -1,5 +1,5 @@
 ; GCC machine description for Intel X86.
-;; Copyright (C) 1988, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 94-97, 1998 Free Software Foundation, Inc.
 ;; Mostly by William Schelter.
 
 ;; This file is part of GNU CC.
 
 (define_insn ""
   [(set (match_operand:SI 0 "push_operand" "=<")
-       (match_operand:SI 1 "general_operand" "g"))]
-  "TARGET_PUSH_MEMORY"
-  "push%L0 %1")
-
-;; If not a 386, it is faster to move MEM to a REG and then push, rather than
-;; push MEM directly.
+       (match_operand:SI 1 "nonmemory_operand" "rn"))]
+  "flag_pic"
+  "* return AS1 (push%L0,%1);")
 
 (define_insn ""
   [(set (match_operand:SI 0 "push_operand" "=<")
        (match_operand:SI 1 "nonmemory_operand" "ri"))]
-  "!TARGET_PUSH_MEMORY && TARGET_MOVE"
-  "push%L0 %1")
+  "!flag_pic"
+  "* return AS1 (push%L0,%1);")
+
+;; On a 386, it is faster to push MEM directly.
 
 (define_insn ""
   [(set (match_operand:SI 0 "push_operand" "=<")
-       (match_operand:SI 1 "nonmemory_operand" "ri"))]
-  "!TARGET_PUSH_MEMORY && !TARGET_MOVE"
-  "push%L0 %1")
+       (match_operand:SI 1 "memory_operand" "m"))]
+  "TARGET_PUSH_MEMORY"
+  "* return AS1 (push%L0,%1);")
 
 ;; General case of fullword move.
 
 
 (define_insn ""
   [(set (match_operand:SI 0 "general_operand" "=g,r")
-       (match_operand:SI 1 "general_operand" "ri,m"))]
-  "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
+       (match_operand:SI 1 "general_operand" "rn,im"))]
+  "((!TARGET_MOVE || GET_CODE (operands[0]) != MEM)
+    || (GET_CODE (operands[1]) != MEM))
+   && flag_pic"
   "*
 {
   rtx link;
     /* Fastest way to change a 0 to a 1.  */
     return AS1 (inc%L0,%0);
 
-  if (flag_pic && SYMBOLIC_CONST (operands[1]))
+  if (SYMBOLIC_CONST (operands[1]))
     return AS2 (lea%L0,%a1,%0);
 
   return AS2 (mov%L0,%1,%0);
 }")
 
 (define_insn ""
-  [(set (match_operand:HI 0 "push_operand" "=<")
-       (match_operand:HI 1 "general_operand" "g"))]
-  "TARGET_PUSH_MEMORY"
-  "push%W0 %1")
+  [(set (match_operand:SI 0 "general_operand" "=g,r")
+       (match_operand:SI 1 "general_operand" "ri,m"))]
+  "((!TARGET_MOVE || GET_CODE (operands[0]) != MEM)
+    || (GET_CODE (operands[1]) != MEM))
+   && !flag_pic"
+  "*
+{
+  rtx link;
+  if (operands[1] == const0_rtx && REG_P (operands[0]))
+    return AS2 (xor%L0,%0,%0);
+
+  if (operands[1] == const1_rtx
+      && (link = find_reg_note (insn, REG_WAS_0, 0))
+      /* Make sure the insn that stored the 0 is still present.  */
+      && ! INSN_DELETED_P (XEXP (link, 0))
+      && GET_CODE (XEXP (link, 0)) != NOTE
+      /* Make sure cross jumping didn't happen here.  */
+      && no_labels_between_p (XEXP (link, 0), insn)
+      /* Make sure the reg hasn't been clobbered.  */
+      && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+    /* Fastest way to change a 0 to a 1.  */
+    return AS1 (inc%L0,%0);
+
+  return AS2 (mov%L0,%1,%0);
+}")
 
 (define_insn ""
   [(set (match_operand:HI 0 "push_operand" "=<")
        (match_operand:HI 1 "nonmemory_operand" "ri"))]
-  "!TARGET_PUSH_MEMORY && TARGET_MOVE"
-  "push%W0 %1")
+  ""
+  "* return AS1 (push%W0,%1);")
 
 (define_insn ""
   [(set (match_operand:HI 0 "push_operand" "=<")
-       (match_operand:HI 1 "nonmemory_operand" "ri"))]
-  "!TARGET_PUSH_MEMORY && !TARGET_MOVE"
-  "push%W0 %1")
+       (match_operand:HI 1 "memory_operand" "m"))]
+  "TARGET_PUSH_MEMORY"
+  "* return AS1 (push%W0,%1);")
 
 ;; On i486, an incl and movl are both faster than incw and movw.
 
   [(set (match_operand:QI 0 "push_operand" "=<")
        (match_operand:QI 1 "const_int_operand" "n"))]
   ""
-  "* return AS1 (push%W0,%1);")
-
-(define_insn ""
-  [(set (match_operand:QI 0 "push_operand" "=<")
-       (match_operand:QI 1 "register_operand" "q"))]
-  "!TARGET_MOVE"
-  "*
-{
-  operands[1] = gen_rtx (REG, HImode, REGNO (operands[1]));
-  return AS1 (push%W0,%1);
-}")
+  "* return AS1(push%W0,%1);")
 
 (define_insn ""
   [(set (match_operand:QI 0 "push_operand" "=<")
        (match_operand:QI 1 "register_operand" "q"))]
-  "TARGET_MOVE"
+  ""
   "*
 {
   operands[1] = gen_rtx (REG, HImode, REGNO (operands[1]));