This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gen_lowpart called where 'truncate' needed?
- From: Ian Lance Taylor <iant at google dot com>
- To: Mat Hostetter <mhostetter at tilera dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 03 Feb 2010 17:49:06 -0800
- Subject: Re: gen_lowpart called where 'truncate' needed?
- References: <7u7hqu6q2x.fsf@ld-1.internal.tilera.com>
Mat Hostetter <mhostetter@tilera.com> writes:
> Since the high bits are already zero, that would be less efficient on
> most platforms, so guarding it with something like this would probably
> be smarter:
>
> if (targetm.mode_rep_extended (mode, GET_MODE(x)) == SIGN_EXTEND)
> return simplify_gen_unary (TRUNCATE, mode, x, GET_MODE (x));
>
> I'm happy to believe I'm doing something wrong in my back end, but I'm
> not sure what that would be. I could also believe these are obscure
> edge cases no one cared about before. Any tips would be appreciated.
Interesting. I think you are in obscure edge case territory. Your
suggestion makes sense to me, and in fact it should probably be put
into gen_lowpart_common.
Ian