Re: [PATCH] rs6000: Optimise SImode cstore on 64-bit

2015-12-02 Thread Segher Boessenkool
On Tue, Dec 01, 2015 at 09:39:30PM -0600, Segher Boessenkool wrote: > On Wed, Dec 02, 2015 at 01:50:46PM +1030, Alan Modra wrote: > > On Wed, Dec 02, 2015 at 01:55:17AM +, Segher Boessenkool wrote: > > > + emit_insn (gen_subdi3 (tmp, op1, op2)); > > > + emit_insn (gen_lshrdi3 (tmp2, tmp,

Re: [PATCH] rs6000: Optimise SImode cstore on 64-bit

2015-12-01 Thread David Edelsohn
On Tue, Dec 1, 2015 at 8:55 PM, Segher Boessenkool wrote: > On 64-bit we can do comparisons of 32-bit values by extending those > values to 64-bit, subtracting them, and then getting the high bit of > the result. For registers this is always cheaper than using the

Re: [PATCH] rs6000: Optimise SImode cstore on 64-bit

2015-12-01 Thread Alan Modra
On Wed, Dec 02, 2015 at 01:55:17AM +, Segher Boessenkool wrote: > + emit_insn (gen_subdi3 (tmp, op1, op2)); > + emit_insn (gen_lshrdi3 (tmp2, tmp, GEN_INT (63))); > + emit_insn (gen_anddi3 (tmp3, tmp2, const1_rtx)); Why the AND? The top 63 bits are already clear. -- Alan Modra Australia

[PATCH] rs6000: Optimise SImode cstore on 64-bit

2015-12-01 Thread Segher Boessenkool
On 64-bit we can do comparisons of 32-bit values by extending those values to 64-bit, subtracting them, and then getting the high bit of the result. For registers this is always cheaper than using the carry bit sequence; and if the comparison involves a constant, this is cheaper than the sequence

Re: [PATCH] rs6000: Optimise SImode cstore on 64-bit

2015-12-01 Thread Segher Boessenkool
On Wed, Dec 02, 2015 at 01:50:46PM +1030, Alan Modra wrote: > On Wed, Dec 02, 2015 at 01:55:17AM +, Segher Boessenkool wrote: > > + emit_insn (gen_subdi3 (tmp, op1, op2)); > > + emit_insn (gen_lshrdi3 (tmp2, tmp, GEN_INT (63))); > > + emit_insn (gen_anddi3 (tmp3, tmp2, const1_rtx)); > >