This is the mail archive of the 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]
Other format: [Raw text]

Re: [PATCH] Optimize zero_extend into paradoxical subreg

> A recent discussion on GCC's semantics for paradoxical subregs on
> this list suggested there was a need for additional optimizations
> to optimize their use.  In that thread I suggested that simplify_rtx
> could eliminate explicit zero_extension and sign_extension operations
> on targets with LOAD_EXTEND_OP when the extension operand was a MEM.
> The patch below implements this suggestion.
> This patch has been tested by a complete "make bootstap" and "make
> -k check", all languages except Ada and treelang, on i686-pc-linux-gnu
> (which doesn't define LOAD_EXTEND_OP and WORD_REGISTER_OPERATIONS) and
> on hppa2.0w-hp-hpux11.00 (which does).  There are no new regressions
> on either target.
> Now the caveat.  I can't demonstrate this is useful.  I've stepped
> through several examples on HPUX to convince myself the code triggers
> and returns the intended result.  However, in the examples I used the
> optimized RTL was not chosen by combine, so the resulting .s output
> didn't change.  By corollary, I don't have a test case either.  But
> the theory is sound, so I thought I'd post the patch in case other
> platforms, such as powerpc, or more complex code have better luck.
> Ok for the gcc-3_4-basic-improvements-branch?

I'm not convinced this is a good idea.  Surely it would be better to go 
the other way -- ie translate (subreg:M1 (mem:M2) 0) into zero_ or 
sign_extend if M1 is wider than M2.

There's a general principle for RTL that it's better to be explicit about 
an operation than rely on implicit meaning -- your patch seems to go 
against that.


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