|
|
On Wed, Aug 03, 2005 at 01:12:02AM +0300, Leehod Baruch wrote:
> On many cases only the low part is been used without any need of
> simplification, they are just uses of subregs.
How many cases? In general I would have expected that if we extend
to DImode, we actually require a DImode value at some point.
Perhaps the setting of PROMOTE_MODE on ppc belies that assumption.
I wonder if the bulk of this problem can be solved simply by using
the PROMOTE_MODE definition from ia64.
> > Sure, but: How often have you seen this happen? Does it happen
> > more than *once* in SPEC, for instance?
> You are right, this is rare, but it was only an example to show
> that we can use only the low part.
Then you miss my point. Why would you severely complicate your
algorithm considering one-in-a-million cases?
> I don't think that this is the point of the this optimization.
> The sign-extensions are currently generated right after-the-def,
> so the producer *is* currently merged with the sign-extension
> by the combiner.
No, I don't think so. When I've examined this problem in the
past, a typical failure case was:
(set (reg:si 100) (mem:si))
(set (reg:di 101) (sign_extend:di (reg:si 100)))
...
(use (reg:si 100))
(use (reg:di 101))
Combine will not optimize this, because reg100 has two uses.
It will only optimize one use. But of course this can be better
implemented by
(set (reg:di 101) (sign_extend:di (mem:si)))
...
(use (subreg:si (reg:di 101) 0))
(use (reg:di 101))
> The sign-extensions are produced after the def regardless of the
> use, but on *many* cases the use uses only the low part.
Ok, give me some numbers for "many", and we'll have something to
talk about. At the moment all we have are wild assertions.
> I believe (and hope) that you did like the general idea of the
> optimization regardless of the way the presented algorithm
> implements it.
> The general idea is to try and merge the sign extension with both
> the use and the def, eliminate the redundant extensions using
> redundancy elimination and place the non redundant ones at optimal
> placements. ( I intentialy don't specify how it is done.)
> please, correct me if I'm wrong.
Sure. Although my intuition tells me that significantly more
benefit can be had from the defs, and only sparingly from the uses.
> And the original question is: Is it possible to use redundancy
> elimination to optimize sign extensions with different source modes?
> You disagreed with me that this is difficult, but I currently can't
> see how it can be done.
Find all uses for a def, looking through sign-extensions. Of those
uses, find the largest mode. Use that mode as the mode to which the
def must be extended. All other uses will use a subreg of that
extended result.
r~
|
|