[ub] P1407R0: Tell Programmers About Signed Integer Overflow Behavior

Jens Maurer Jens.Maurer at gmx.net
Thu Jan 31 01:08:29 CET 2019


On 01/30/2019 10:05 PM, Hubert Tong wrote:
> On Wed, Jan 30, 2019 at 2:08 PM Scott Schurr <s.scott.schurr at gmail.com <mailto:s.scott.schurr at gmail.com>> wrote:
> 
>     Thanks for pointing that out.  Yes, saturation might be considered a desirable behavior, and I believe it's fairly common for floating point.  I haven't personally seen hardware- or language-level saturation implemented anywhere for integers.  The three Analog Devices DSPs that I have used in the past did not support saturation for integer operations.  But that doesn't say anything about TI, Motorola, or other DSP vendors.  So integer saturation might be out there in the wild.  If anyone is aware of a documented case, that would be great to know about.
> 
> vadd[us][bhw]s on POWER (vector add saturate for various widths of (un)signed integers) is saturating. VADD for ARM NEON has a saturating form and supported integer types.

padd[us][bw] on x86 SSE2 also does saturated addition.

(Sorry, couldn't resist.)

Jens




More information about the ub mailing list