[SPARC] Add support for overflow arithmetic

Jakub Jelinek jakub@redhat.com
Fri Oct 21 09:48:00 GMT 2016

On Fri, Oct 21, 2016 at 11:18:31AM +0200, Eric Botcazou wrote:
>       /* For sub-word operations, if target doesn't have them, start
> 	 with precres widening right away, otherwise do it only
> 	 if the most simple cases can't be used.  */
> 	  && orig_precres == precres
> 	  && precres < BITS_PER_WORD)
> 	;
> Jakub, any idea of an elegant way to address this issue?

Then to some extent defining WORD_REGISTER_OPERATIONS on SPARC is a lie,
it only has "INT_REGISTER_OPERATIONS", i.e. all operations smaller than
int are performed on the whole register, int operations can be really done
in SImode in the IL (no need to sign/zero extend anything to DImode, if you
just ignore the high 32 bits).
Guess easiest would be to add some targetm constant or hook that gives
you bit precision - integral arithmetics smaller than this precision is
performed in precision.  Then define it by default to
and for sparc set to 32, then use this targetm constant or hook in
internal-fn.c instead of WORD_REGISTER_OPERATIONS and BITS_PER_WORD.


More information about the Gcc-patches mailing list