This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gen_lowpart called where 'truncate' needed?
Adam Nemet <adambnemet@gmail.com> writes:
> > > I think the right fix is to call convert_to_mode or convert_move in the
> > > expansion code which ensure the proper truncation.
> >
> > That would yield correct code, but wouldn't it throw away the fact
> > that the high bits are already known to be zero, and yield redundant
> > zero-extension on some platforms? I'm guessing that's why the code was
> > originally written to call convert_lowpart rather than convert_to_mode.
>
> convert_to_mode uses gen_lowpart for truncation if TRULY_NOOP_TRUNCATION.
I was concerned about the !TRULY_NOOP_TRUNCATION case; I didn't want
to harm someone else's performance to benefit my chip. But, looking
around, it looks like (almost?) every chip either #defines
TRULY_NOOP_TRUNCATION or wants this fix. So your suggestion sounds
good to me, and in any case using straightforward type conversions
should surely be the default choice.
-Mat