]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/9888 (-mcpu=k6 -Os produces out of range loop instructions)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Sun, 9 Mar 2003 15:51:41 +0000 (16:51 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 9 Mar 2003 15:51:41 +0000 (15:51 +0000)
PR optimization/9888
Backport patch from mainline:

2002-07-03  Eric Botcazou  <ebotcazou@multimania.com>
            Jeff Law  <law@redhat.com>

* i386.md (length_immediate attribute): Fix typo.
(length_address attribute): Likewise.
(modrm attribute): Set it to 0 for immediate call instructions.
(jcc_1 pattern): Set modrm attribute to 0.
(jcc_2 pattern ): Likewise.
(jump pattern): Likewise.
(doloop_end_internal pattern): Explicitly set length.
(leave pattern): Fix typo.
(leave_rex64 pattern): Likewise.

From-SVN: r64035

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/i386-loop-1.c

index ccdb5c812039534922abdd5caa867dea174605a4..27b9113c84c78d984a2df7a4991a55e9b7a29939 100644 (file)
@@ -1,3 +1,21 @@
+2003-03-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR optimization/9888
+       Backport patch from mainline:
+
+       2002-07-03  Eric Botcazou  <ebotcazou@multimania.com>
+                   Jeff Law  <law@redhat.com>
+
+       * i386.md (length_immediate attribute): Fix typo.
+       (length_address attribute): Likewise.
+       (modrm attribute): Set it to 0 for immediate call instructions.
+       (jcc_1 pattern): Set modrm attribute to 0.
+       (jcc_2 pattern ): Likewise.
+       (jump pattern): Likewise.
+       (doloop_end_internal pattern): Explicitly set length.
+       (leave pattern): Fix typo.
+       (leave_rex64 pattern): Likewise.
+
 2003-03-08  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR middle-end/7796
index 36a0497818ebf1f3b935293e6a2cb3e23c0e1605..304c889b3b6ae300134a15af83d308879360981c 100644 (file)
 
 ;; The (bounding maximum) length of an instruction immediate.
 (define_attr "length_immediate" ""
-  (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv,sse,mmx")
+  (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv,sse,mmx")
           (const_int 0)
         (eq_attr "i387" "1")
           (const_int 0)
   (cond [(eq_attr "type" "str,cld,other,multi,fxch")
           (const_int 0)
         (and (eq_attr "type" "call")
-             (match_operand 1 "constant_call_address_operand" ""))
+             (match_operand 0 "constant_call_address_operand" ""))
             (const_int 0)
         (and (eq_attr "type" "callv")
              (match_operand 1 "constant_call_address_operand" ""))
              (and (match_operand 0 "register_operand" "")
                   (match_operand 1 "immediate_operand" "")))
           (const_int 0)
+        (and (eq_attr "type" "call")
+             (match_operand 0 "constant_call_address_operand" ""))
+            (const_int 0)
+        (and (eq_attr "type" "callv")
+             (match_operand 1 "constant_call_address_operand" ""))
+            (const_int 0)
         ]
         (const_int 1)))
 
   ""
   "%+j%C1\t%l0"
   [(set_attr "type" "ibr")
+   (set_attr "modrm" "0")
    (set (attr "prefix_0f")
           (if_then_else (and (ge (minus (match_dup 0) (pc))
                                  (const_int -128))
   ""
   "%+j%c1\t%l0"
   [(set_attr "type" "ibr")
+   (set_attr "modrm" "0")
    (set (attr "prefix_0f")
           (if_then_else (and (ge (minus (match_dup 0) (pc))
                                  (const_int -128))
        (label_ref (match_operand 0 "" "")))]
   ""
   "jmp\t%l0"
-  [(set_attr "type" "ibr")])
+  [(set_attr "type" "ibr")
+   (set_attr "modrm" "0")])
 
 (define_expand "indirect_jump"
   [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
     return "dec{l}\t%1\;%+jne\t%l0";
 }
   [(set_attr "ppro_uops" "many")
+   (set (attr "length")
+       (if_then_else (and (eq_attr "alternative" "0")
+                          (and (ge (minus (match_dup 0) (pc))
+                                   (const_int -128))
+                               (lt (minus (match_dup 0) (pc))
+                                   (const_int 124))))
+                     (const_int 2)
+                     (const_int 16)))
    (set (attr "type")
        (if_then_else (and (eq_attr "alternative" "0")
                           (and (ge (minus (match_dup 0) (pc))
   [(set_attr "length_immediate" "0")
    (set_attr "length" "1")
    (set_attr "modrm" "0")
-   (set_attr "modrm" "0")
    (set_attr "athlon_decode" "vector")
    (set_attr "ppro_uops" "few")])
 
   [(set_attr "length_immediate" "0")
    (set_attr "length" "1")
    (set_attr "modrm" "0")
-   (set_attr "modrm" "0")
    (set_attr "athlon_decode" "vector")
    (set_attr "ppro_uops" "few")])
 \f
index 164941741ce19d897c9f35de9c76b99989547b5e..97a86d1e6e3ad9c31d246609d183559df9eb92d2 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/i386-loop-1.c: New test.
+
 2003-03-08  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * gcc.dg/old-style-asm-1.c: Tweak to match mmix-knuth-mmixware.
index 635f012a4777a3d82f01e040277772a10e473378..e8bdaf5bcd34df261a4bbd2e804c96746442bce0 100644 (file)
@@ -1,6 +1,6 @@
 /* PR optimization/9888 */
 /* { dg-do run { target i?86-*-* } } */
-/* { dg-options "-mtune=k6 -O3" } */
+/* { dg-options "-mcpu=k6 -O3" } */
 
 /* Verify that GCC doesn't emit out of range 'loop' instructions.  */