Patch to remove i386 *dbra_ge

John Wehle john@feith.com
Sun Jun 18 12:11:00 GMT 2000


> Basically I have no objections against disabling that pattern now (it is not
> too usefull anyway), but please if you do so, just comment it out with
> appropriate comment.  This will make easier in future to restore this feature
> and/or avoid other people to fall into the same trap.

Not a bad suggestion, though I'm not too concern about restoring the feature.

> Perhaps I can take a look later at this issue and teach loop.c about the
> behaviour.

I'm not sure that you need bother.  The current version of VRP (which
uses an optimistic opproach and I need to post) will convert jumps
to using EQ / NE when appropriate.

For example:

  for (i = b; i > 0; i -= 1)
    {
      d += c + i;
    }

which is represented by:

(insn 66 20 67 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 30)
            (const_int 0 [0x0]))) 2 {cmpsi_1} (nil)
    (nil))

(jump_insn 67 66 21 (set (pc)
        (if_then_else (le (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 68)
            (pc))) 271 {*jcc_3} (nil)
    (nil))

code_label 27 21 61 6 "" "" [1 uses])

...

(insn 23 71 24 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 30)
            (const_int 0 [0x0]))) 2 {cmpsi_1} (nil)
    (nil))

(jump_insn 24 23 46 (set (pc)
        (if_then_else (gt (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 27)
            (pc))) 269 {*jcc_1} (nil)
        (nil)))

(code_label 68 46 63 8 "" "" [1 uses])

VRP will convert jump_insn 24 to:

(jump_insn 24 23 46 (set (pc)
        (if_then_else (ne (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 27)
            (pc))) 269 {*jcc_1} (nil)
        (nil)))

Since it knows that (reg:SI 30) at that point is never negative.  Combine
then matches the existing *dbra_ne pattern.

It may make sense to simply kill all the REG_NONNEG code and patterns
once VRP is installed.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



More information about the Gcc-patches mailing list