Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Tobias Grosser
On 06/30/2011 11:01 AM, Sebastian Pop wrote: On Thu, Jun 30, 2011 at 10:03, Richard Guenther wrote: But what do you do for for (unsigned char i = 128; i< 255; ++i) ? You change 128 to -128 which is wrong. Yes, 128 gets translated to -128. And 255 gets translated to -1. And so the loop i

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Sebastian Pop
On Thu, Jun 30, 2011 at 10:03, Richard Guenther wrote: > But what do you do for > >  for (unsigned char i = 128; i < 255; ++i) > > ?  You change 128 to -128 which is wrong. Yes, 128 gets translated to -128. And 255 gets translated to -1. And so the loop iteration domain gets translated in the pol

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Richard Guenther
On Thu, 30 Jun 2011, Sebastian Pop wrote: > On Thu, Jun 30, 2011 at 09:57, Sebastian Pop wrote: > >> Canonically extended according to TYPE_UNSIGNED I mean.  So what you > >> do is always create signed mpzs - that should simply work without > >> doing anything to the double-int.  Thus, why not do

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Richard Guenther
On Thu, 30 Jun 2011, Sebastian Pop wrote: > On Thu, Jun 30, 2011 at 09:46, Richard Guenther wrote: > > On Thu, 30 Jun 2011, Sebastian Pop wrote: > > > >> On Thu, Jun 30, 2011 at 05:19, Richard Guenther wrote: > >> > That looks odd.  So you given -1U as input you sign-extend that to -1 > >> > >>

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Sebastian Pop
On Thu, Jun 30, 2011 at 09:57, Sebastian Pop wrote: >> Canonically extended according to TYPE_UNSIGNED I mean.  So what you >> do is always create signed mpzs - that should simply work without >> doing anything to the double-int.  Thus, why not do >> >> static inline void >> tree_int_to_gmp (tree

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Sebastian Pop
On Thu, Jun 30, 2011 at 09:46, Richard Guenther wrote: > On Thu, 30 Jun 2011, Sebastian Pop wrote: > >> On Thu, Jun 30, 2011 at 05:19, Richard Guenther wrote: >> > That looks odd.  So you given -1U as input you sign-extend that to -1 >> >> correct >> >> > and then set the mpz to -1ULLL. >> >> and

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Richard Guenther
On Thu, 30 Jun 2011, Sebastian Pop wrote: > On Thu, Jun 30, 2011 at 05:19, Richard Guenther wrote: > > That looks odd.  So you given -1U as input you sign-extend that to -1 > > correct > > > and then set the mpz to -1ULLL. > > and then it sets the mpz to signed -1, given that I'm passing false

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Sebastian Pop
On Thu, Jun 30, 2011 at 05:19, Richard Guenther wrote: > That looks odd.  So you given -1U as input you sign-extend that to -1 correct > and then set the mpz to -1ULLL. and then it sets the mpz to signed -1, given that I'm passing false to UNS: /* Sets RESULT to VAL, taken unsigned if UNS is t

Re: [PATCH] Sign extend before converting constants to GMP values.

2011-06-30 Thread Richard Guenther
On Wed, 29 Jun 2011, Sebastian Pop wrote: > Hi, > > This patch fixes PR47653 by sign extending the double int constants > before converting them to a GMP value. There still are some places > where we should not sign extend the values converted: upper bounds of > unsigned types should for example