Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Richard Biener
On Wed, 20 Jan 2021, Richard Sandiford wrote: > Richard Biener writes: > > diff --git a/gcc/hwint.h b/gcc/hwint.h > > index 127b0130c66..8812bc7150f 100644 > > --- a/gcc/hwint.h > > +++ b/gcc/hwint.h > > @@ -333,4 +333,46 @@ absu_hwi (HOST_WIDE_INT x) > >return x >= 0 ? (unsigned HOST_WIDE_IN

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Richard Sandiford via Gcc-patches
Richard Biener writes: > diff --git a/gcc/hwint.h b/gcc/hwint.h > index 127b0130c66..8812bc7150f 100644 > --- a/gcc/hwint.h > +++ b/gcc/hwint.h > @@ -333,4 +333,46 @@ absu_hwi (HOST_WIDE_INT x) >return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x; > } > > +/* Compute the

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Richard Biener
On Wed, 20 Jan 2021, Richard Biener wrote: > On Wed, 20 Jan 2021, Jakub Jelinek wrote: > > > On Wed, Jan 20, 2021 at 01:15:12PM +0100, Richard Biener wrote: > > > OK, fixed. Guess we could also use __builtin_mul_overflow directly > > > if supported via a GCC_VERSION check. Looks like it's prese

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Richard Biener
On Wed, 20 Jan 2021, Jakub Jelinek wrote: > On Wed, Jan 20, 2021 at 01:15:12PM +0100, Richard Biener wrote: > > OK, fixed. Guess we could also use __builtin_mul_overflow directly > > if supported via a GCC_VERSION check. Looks like it's present > > since GCC 5 at least. So sth like (incremental

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Jakub Jelinek via Gcc-patches
On Wed, Jan 20, 2021 at 01:15:12PM +0100, Richard Biener wrote: > OK, fixed. Guess we could also use __builtin_mul_overflow directly > if supported via a GCC_VERSION check. Looks like it's present > since GCC 5 at least. So sth like (incremental) > > diff --git a/gcc/hwint.h b/gcc/hwint.h > ind

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Richard Biener
On Wed, 20 Jan 2021, Jakub Jelinek wrote: > On Wed, Jan 20, 2021 at 12:29:23PM +0100, Richard Biener wrote: > > +/* Compute the product of signed A and B and indicate in *OVERFLOW whether > > + that operation overflowed. */ > > + > > +inline HOST_WIDE_INT > > +mul_hwi (HOST_WIDE_INT a, HOST_WID

Re: [PATCH] Handle overflow in dependence analysis lambda ops gracefully

2021-01-20 Thread Jakub Jelinek via Gcc-patches
On Wed, Jan 20, 2021 at 12:29:23PM +0100, Richard Biener wrote: > +/* Compute the product of signed A and B and indicate in *OVERFLOW whether > + that operation overflowed. */ > + > +inline HOST_WIDE_INT > +mul_hwi (HOST_WIDE_INT a, HOST_WIDE_INT b, bool *overflow) > +{ > + unsigned HOST_WIDE_I