This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Generate abs target assembly code with saturation behavior
- From: Shiva Chen <shiva0217 at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, aph at redhat dot com, fweimer at redhat dot com
- Cc: gcc at gcc dot gnu dot org, marc dot glisse at inria dot fr
- Date: Sun, 30 Jun 2013 14:56:11 +0800
- Subject: Re: Generate abs target assembly code with saturation behavior
- References: <CAH=PD7ZBeqpU6MTx8gv+kA1dc2uH+z+L9i7m-RS1qZOGUOtrow at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1306281328460 dot 27363 at digraph dot polyomino dot org dot uk>
Therefore, the macro in libgcc should be fine for GCC even if there
may occur signed overflow.
Because we have GCC implementation defined to follow.
GCC implementation defined could be guarantee even if generate abs.
Because abssi2 shouldn't do saturation.
But how the target generate abs instruction if the target abs have
saturation behavior ?
We couldn't use abssi2 naming pattern and ss_abssi2 naming pattern
doesn't exist.
Or we should suggest CPU provider define another abs instruction
without saturation ?
2013/6/28 Joseph S. Myers <joseph@codesourcery.com>:
> On Fri, 28 Jun 2013, Shiva Chen wrote:
>
>> Does the abssi2 semantically assume target abs shouldn't do saturation ?
>
> Yes. The semantics of RTL abs are modulo, whereas ss_abs does signed
> saturation. Likewise for addition, subtraction and multiplication.
> (Some RTL codes have more complicated target-specific semantics, e.g.
> shifts, and signed INT_MIN / -1 and INT_MIN % -1 should currently be
> considered undefined in RTL rather than defined with modulo semantics.)
>
> --
> Joseph S. Myers
> joseph@codesourcery.com