i386.md (ashrsi3_cmpno, [...]): Remove redundant '@' from the template.
authorJan Hubicka <jh@suse.cz>
Sat, 16 Dec 2000 19:00:57 +0000 (20:00 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 16 Dec 2000 19:00:57 +0000 (19:00 +0000)
* i386.md (ashrsi3_cmpno, ashrhi3_cmpno, ashrqi3_cmpno, lshrsi3_cmpno,
lshrhi3_cmpno): Remove redundant '@' from the template.

* i386.md (cmpstrsi_1): Fix type of the compare.

* genattrtab.c (attr_rtx_cost): New function.
(simplify_test_exp): Avoid overactive inlining; use temporary
obstacks for tests.

From-SVN: r38310

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/genattrtab.c

index 4c8093f52525d1ad62761d2aef383f519d4ae23a..91a8e0887d2a12933c72e60d88c6f499ac586b21 100644 (file)
@@ -1,3 +1,14 @@
+Sat Dec 16 19:56:24 MET 2000  Jan Hubicka  <jh@suse.cz>
+
+       * i386.md (ashrsi3_cmpno, ashrhi3_cmpno, ashrqi3_cmpno, lshrsi3_cmpno,
+       lshrhi3_cmpno): Remove redundant '@' from the template.
+
+       * i386.md (cmpstrsi_1): Fix type of the compare.
+
+       * genattrtab.c (attr_rtx_cost): New function.
+       (simplify_test_exp): Avoid overactive inlining; use temporary
+       obstacks for tests.
+
 Sat Dec 16 10:41:11 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * stor-layout.c (place_field): Treat overflowing DECL_SIZE_UNIT
index f3d05bba3505ea7cf8ff335ad195f408b38cc50d..72954bf9e2eaca286e6568298fbd595b9421c4c3 100644 (file)
        (ashiftrt:SI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCNOmode)
    && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
-  "@
-   sar{l}\\t{%2, %0|%0, %2}"
+  "sar{l}\\t{%2, %0|%0, %2}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "SI")])
 
        (ashiftrt:HI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCNOmode)
    && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
-  "@
-   sar{w}\\t{%2, %0|%0, %2}"
+  "sar{w}\\t{%2, %0|%0, %2}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "HI")])
 
        (ashiftrt:QI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCNOmode)
    && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
-  "@
-   sar{b}\\t{%2, %0|%0, %2}"
+  "sar{b}\\t{%2, %0|%0, %2}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "QI")])
 \f
        (lshiftrt:SI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCGOCmode)
    && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
-  "@
-   shr{l}\\t{%2, %0|%0, %2}"
+  "shr{l}\\t{%2, %0|%0, %2}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "SI")])
 
        (lshiftrt:HI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCGOCmode)
    && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
-  "@
-   shr{w}\\t{%2, %0|%0, %2}"
+  "shr{w}\\t{%2, %0|%0, %2}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "HI")])
 
   [(set (reg:CC 17)
        (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2")
                             (const_int 0))
-         (compare:SI (mem:BLK (match_operand:SI 4 "register_operand" "0"))
+         (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
                      (mem:BLK (match_operand:SI 5 "register_operand" "1")))
          (const_int 0)))
    (use (match_operand:SI 3 "immediate_operand" "i"))
index 98b1125661084c5890b8469aeaf2c80c4e69e371..c69ad53769686392965f73c2ee8da8a56bb146bf 100644 (file)
@@ -460,6 +460,7 @@ static rtx attr_eq          PARAMS ((const char *, const char *));
 static const char *attr_numeral        PARAMS ((int));
 static int attr_equal_p                PARAMS ((rtx, rtx));
 static rtx attr_copy_rtx       PARAMS ((rtx));
+static int attr_rtx_cost       PARAMS ((rtx));
 
 #define oballoc(size) obstack_alloc (hash_obstack, size)
 \f
@@ -3151,6 +3152,53 @@ simplify_or_tree (exp, pterm, insn_code, insn_index)
 
   return exp;
 }
+/* Compute approximate cost of the expression.  Used to decide whether
+   expression is cheap enought for inline.  */
+static int
+attr_rtx_cost (x)
+     rtx x;
+{
+  int cost = 0;
+  enum rtx_code code;
+  if (!x)
+    return 0;
+  code = GET_CODE (x);
+  switch (code)
+    {
+    case MATCH_OPERAND:
+      if (XSTR (x, 1)[0])
+       return 10;
+      else
+       return 0;
+    case EQ_ATTR:
+      /* Alternatives don't result into function call.  */
+      if (!strcmp (XSTR (x, 0), "alternative"))
+       return 0;
+      else
+       return 5;
+    default:
+      {
+       int i, j;
+       const char *fmt = GET_RTX_FORMAT (code);
+       for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+         {
+           switch (fmt[i])
+             {
+             case 'V':
+             case 'E':
+               for (j = 0; j < XVECLEN (x, i); j++)
+                 cost += attr_rtx_cost (XVECEXP (x, i, j));
+               break;
+             case 'e':
+               cost += attr_rtx_cost (XEXP (x, i));
+               break;
+             }
+         }
+      }
+      break;
+    }
+  return cost;
+}
 \f
 /* Given an expression, see if it can be simplified for a particular insn
    code based on the values of other attributes being tested.  This can
@@ -3407,7 +3455,16 @@ simplify_test_exp (exp, insn_code, insn_index)
        for (av = attr->first_value; av; av = av->next)
          for (ie = av->first_insn; ie; ie = ie->next)
            if (ie->insn_code == insn_code)
-             return evaluate_eq_attr (exp, av->value, insn_code, insn_index);
+             {
+               rtx x;
+               struct obstack *old = rtl_obstack;
+               rtl_obstack = temp_obstack;
+               x = evaluate_eq_attr (exp, av->value, insn_code, insn_index);
+               x = SIMPLIFY_TEST_EXP (x, insn_code, insn_index);
+               rtl_obstack = old;
+               if (attr_rtx_cost(x) < 20)
+                 return attr_copy_rtx (x);
+             }
       break;
 
     default: