This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Signed divide by 2 pessimization


> From: Marek Michalkiewicz <marekm@linux.org.pl>
> Date: Sun, 10 Sep 2000 18:07:55 +0200 (CEST)
> CC: marekm@linux.org.pl, gcc@gcc.gnu.org

> Would something like this be OK?  Should do the right thing on x86
> as COSTS_N_INSNS (BRANCH_COST) is 2 there, and I can play with shift
> costs on the AVR to make it do the right thing here too.

Just make rtx_cost deal with branch instructions.  It's not very hard;
a branch looks like (set (pc) (if_then_else (eq ...) (label_ref ...) (pc)))
so detect the if_then_else and the (pc) and return the appropriate
value.  It need not work for every case, so long as this is documented.

> (As a side note, this place in expmed.c is indented very far to the
> right - wouldn't it be a good idea to split expand_divmod in a few
> smaller functions?  Or is this function deliberately so big, for speed?)

No, it's the incremental impact of many small patches.  Feel free to
tidy up the code.

> But I'm worried that it is not easy to fix it properly.  If it never
> happens because "someone" doesn't exist (not enough motivation because
> the important targets happen to work well), I'd like to at least have
> the hack now - it already exists, and is better than nothing...

The problem is that the hack itself has a cost.  Someone will
eventually have to do the work properly anyway; and with the hack,
that someone will then have to try to work out what this hack is
doing, why it was needed, and what each port does with it, and then
when the hack goes away each port which used it will have to be
checked to see that it got the costs right.

I'm not saying that such hacks don't have a place; it's just that
their place is in your local tree, not in the master repository.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]