I asked similar question regarding PRE_INC/POST_INC quite a while ago, and there were quite some discussions. Haven't check whether the situation changed. http://gcc.gnu.org/ml/gcc/2007-11/msg00032.html
Bingfeng Mei > -----Original Message----- > From: gcc-ow...@gcc.gnu.org [mailto:gcc-ow...@gcc.gnu.org] On > Behalf Of Ramana Radhakrishnan > Sent: 07 August 2009 14:11 > To: Florent Defay > Cc: gcc@gcc.gnu.org > Subject: Re: PRE_DEC, POST_INC > > On Fri, Aug 7, 2009 at 1:33 PM, Florent > Defay<spira.inhabit...@gmail.com> wrote: > > Hi, > > > > I am working on a new port. > > > > The target machine supports post-increment and pre-decrement > > addressing modes. These modes are twice faster than indexed mode. > > It is important for us that GCC consider them well. > > > GCC does support generation of pre{post}-inc {dec}. GCC's auto-inc > detector works at a basic block level and attempts to generate > auto-inc operations within a basic block . Look at auto-inc-dec.c for > more information.It is an area which could do with some improvement > and work , however no one's found the time to do it yet. > > > > > I wrote emails to gcc-help and I was told that GCC was not > so good at > > pre/post-dec/increment since few targets support these modes. > > > > I would like to know if there is a good way to make pre-dec and > > post-inc modes have more priority than indexed mode. > > Is there current work for dealing with this issue ? > > I am assuming you already have basic generation of auto-incs and you > have your definitions for legitimate{legitimize}_address all set up > correctly. > > In this case you could start by tweaking your address costs macros. > Getting that right can help you get going in the right direction with > the current state of the art. In a previous life while maintaining a > private port of GCC I've dabbled with a few patches posted by Joern > Reneccke with regards to auto-inc-dec that worked well for me in > improving code generation on some of the benchmarks. You should be > able to get them out using Google. > > There are a number of bugzilla entries in the database that cover a > number of cases for auto-inc generation and some ideas on what can be > done to improve this. You might be better off searching in that as > well. One of the problems upto 4.3 was that the ivopts and the loop > optimizers didn't care too much about auto-increment addressing and > thereby pessimizing this in favour of using index addressing. There > have been a few patches that were being discussed in in the recent > past by Bernd Schmidt and Zdenek attempting to address auto-inc > generation for loop ivopts but I'm not sure if these have gone into > trunk yet. > > Hope this helps. > > > cheers > Ramana > >