[gnu.gcc] Adding an optimization to m68k.md?

frank@ladc.bull.com (Frank Mayhar) (10/06/89)

My installation of Gnu C on our XPS 100 is coming along.  It's not quite
there yet, but I can see the light at the end of the tunnel.  Thanks! to
all those who responded to my original request for help.

Now a new question.  How would I go about adding an optimization to the
m68k.md file?  Specifically, I want to optimize the following sequence:

        L4:
                cmp.b %d1,(%a0)+
                beq.w L3
                dbra %d0,L4
        L3:

into:

        L4: 
                cmp.b %d1,(%a0)+ 
                dbeq %d0,L4 

How would I go about doing that?  Is it fairly simple?  Very complicated?
Somewhere in between?  I've read the information about the define_peephole
stuff, but I don't know enough about the internals of m68k.md or about the
compiler itself to keep from getting into trouble.  (And, I would like to
come up with this before Christmas. :-)

Any takers?
-- 
Frank Mayhar  frank@ladc.bull.com (..!{uunet,hacgate,rdahp}!ladcgw!frank)
              Bull HN Information Systems Inc.  Los Angeles Development Center
              5250 W. Century Blvd., LA, CA  90045    Phone:  (213) 216-6241