Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)

2016-02-02 Thread Richard Sandiford
Jakub Jelinek writes: > On Sat, Jan 30, 2016 at 02:04:45PM +, Richard Sandiford wrote: >> Not sure what to call it. Maybe canonize_uhwi? Like canonize, except >> that it takes a uhwi instead of a length. >> >> > Can that be done as a follow-up? Certainly it would need >> > to take the uhwi

Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)

2016-02-01 Thread Jakub Jelinek
On Sat, Jan 30, 2016 at 02:04:45PM +, Richard Sandiford wrote: > Not sure what to call it. Maybe canonize_uhwi? Like canonize, except > that it takes a uhwi instead of a length. > > > Can that be done as a follow-up? Certainly it would need > > to take the uhwi to store, pointer to the arra

Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)

2016-01-30 Thread Richard Sandiford
Jakub Jelinek writes: > On Sat, Jan 30, 2016 at 12:31:05PM +, Richard Sandiford wrote: >> Might be wrong, but couldn't the same thing happen for the remainder, >> e.g. for 0xfffe % 0x ? > > You're right, that is broken too. Adjusted patch below. > >> Maybe we should have a helper

[PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)

2016-01-30 Thread Jakub Jelinek
On Sat, Jan 30, 2016 at 12:31:05PM +, Richard Sandiford wrote: > Might be wrong, but couldn't the same thing happen for the remainder, > e.g. for 0xfffe % 0x ? You're right, that is broken too. Adjusted patch below. > Maybe we should have a helper > function to handle storing uh

Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546)

2016-01-30 Thread Richard Sandiford
Jakub Jelinek writes: > As the testcase shows, wide_int unsigned division is broken for > 64bit > precision division of unsigned dividend which have 63rd bit set, and all > higher bits cleared (thus is normalized as 2 HWIs, first with MSB set, > the second 0) and divisor of 1, we return just a sin

[PATCH] Fix wide_int unsigned division (PR tree-optimization/69546)

2016-01-29 Thread Jakub Jelinek
Hi! As the testcase shows, wide_int unsigned division is broken for > 64bit precision division of unsigned dividend which have 63rd bit set, and all higher bits cleared (thus is normalized as 2 HWIs, first with MSB set, the second 0) and divisor of 1, we return just a single HWI, which is equivale