Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-05-31 Thread Georg-Johann Lay
On 31.05.2017 11:00, Jakub Jelinek wrote: On Wed, May 31, 2017 at 10:48:07AM +0200, Georg-Johann Lay wrote: because divmod in not a single_set: (gdb) p seq $10 = (const rtx_insn *) 0x7730d500 (gdb) pr warning: Expression is not an assignment (and might have no effect) (insn 14 13 0 (parallel

Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-05-31 Thread Jakub Jelinek
On Wed, May 31, 2017 at 10:48:07AM +0200, Georg-Johann Lay wrote: > > > because divmod in not a single_set: > > > (gdb) p seq > > > $10 = (const rtx_insn *) 0x7730d500 > > > (gdb) pr > > > warning: Expression is not an assignment (and might have no effect) > > > (insn 14 13 0 (parallel [ > > >

Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-05-31 Thread Georg-Johann Lay
On 31.05.2017 10:15, Jakub Jelinek wrote: On Wed, May 31, 2017 at 10:06:34AM +0200, Georg-Johann Lay wrote: Hi, this causes a performance degradation for avr. When optimizing for speed, and with a known denominatior, then v6 uses s/umulMM3_highpart insn to avoid division because no div instruct

Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-05-31 Thread Jakub Jelinek
On Wed, May 31, 2017 at 10:06:34AM +0200, Georg-Johann Lay wrote: > Hi, this causes a performance degradation for avr. > > When optimizing for speed, and with a known denominatior, then v6 uses > s/umulMM3_highpart insn to avoid division because no div instruction is > available. > > unsigned sca

Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-05-31 Thread Georg-Johann Lay
On 23.02.2017 06:59, Jeff Law wrote: On 02/22/2017 02:40 PM, Jakub Jelinek wrote: Hi! If both arguments of integer division or modulo are known to be non-negative in corresponding signed type, then signed as well as unsigned division/modulo shall have the exact same result and therefore we can

Re: [PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-02-22 Thread Jeff Law
On 02/22/2017 02:40 PM, Jakub Jelinek wrote: Hi! If both arguments of integer division or modulo are known to be non-negative in corresponding signed type, then signed as well as unsigned division/modulo shall have the exact same result and therefore we can choose between those two depending on

[PATCH] Optimize divmod expansion (PR middle-end/79665)

2017-02-22 Thread Jakub Jelinek
Hi! If both arguments of integer division or modulo are known to be non-negative in corresponding signed type, then signed as well as unsigned division/modulo shall have the exact same result and therefore we can choose between those two depending on which one is faster (or shorter for -Os), which