This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: extendqihi2 and GCC RTL type system
- From: Jeff Law <law at redhat dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>, Jim Wilson <jim dot wilson at linaro dot org>
- Date: Mon, 22 Feb 2016 09:09:00 -0700
- Subject: Re: extendqihi2 and GCC RTL type system
- Authentication-results: sourceware.org; auth=none
- References: <CAGWvnyn4EfEdz8n35iCFHuy=Zba1fugHNkJJmzYk5=oADWCzCA at mail dot gmail dot com>
On 02/22/2016 08:55 AM, David Edelsohn wrote:
csmith has uncovered a latent bug in the the PowerPC port for a
combiner pattern involving extendqihi2 (the alternative in the pattern
has never triggered for real code in over 10 years). Basic extendqihi2
works correctly (the instructions extend to entire register, but the
upper bits are ignored).
The PowerPC architecture can load and store HImode values, but cannot
compute directly on that mode -- only on SImode or DImode.
Right. Similar to the PA in that regard.
One proposed fix for the bug would remove extendqihi2, forcing GCC to
use SUBREGs for HImode extend operations, as it does for all other
computations.
And that should work.
If I remove extendqihi2 (extend:HI pattern) from the PowerPC port,
will that cause any problems for the GCC RTL type system or inhibit
optimizations? I see that Alpha and SPARC define extendqihi2, but
IA-64 and AArch64 do not, so there is precedent for both approaches.
Any insights would be appreciated.
It shouldn't cause any type system kinds of problems. It might cause
missed optimizations though. I'm not sure if combine will handle
optimizing away the SUBREG by exploiting LOAD_EXTEND_OP.
Jeff