Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Uros Bizjak via Gcc-patches
On Mon, Jun 21, 2021 at 12:28 PM Jakub Jelinek wrote: > > On Mon, Jun 21, 2021 at 12:14:09PM +0200, Richard Biener wrote: > > > But we could do what I've done in > > > r11-7694-gd55ce33a34a8e33d17285228b32cf1e564241a70 > > > - have int ix86_last_zero_store_uid; > > > set to INSN_UID of the last st

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Jakub Jelinek via Gcc-patches
On Mon, Jun 21, 2021 at 12:14:09PM +0200, Richard Biener wrote: > > But we could do what I've done in > > r11-7694-gd55ce33a34a8e33d17285228b32cf1e564241a70 > > - have int ix86_last_zero_store_uid; > > set to INSN_UID of the last store emitted by the peephole2s and > > then check that INSN_UID agai

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Richard Biener via Gcc-patches
On Mon, Jun 21, 2021 at 11:59 AM Jakub Jelinek wrote: > > On Mon, Jun 21, 2021 at 11:19:12AM +0200, Richard Biener wrote: > > > --- gcc/config/i386/i386.c.jj 2021-06-21 09:39:21.622487840 +0200 > > > +++ gcc/config/i386/i386.c 2021-06-21 10:21:12.389794740 +0200 > > > @@ -15186,6 +15186,33

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Jakub Jelinek via Gcc-patches
On Mon, Jun 21, 2021 at 11:19:12AM +0200, Richard Biener wrote: > > --- gcc/config/i386/i386.c.jj 2021-06-21 09:39:21.622487840 +0200 > > +++ gcc/config/i386/i386.c 2021-06-21 10:21:12.389794740 +0200 > > @@ -15186,6 +15186,33 @@ ix86_lea_for_add_ok (rtx_insn *insn, rtx > >return ix86_le

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Richard Biener via Gcc-patches
On Mon, Jun 21, 2021 at 10:37 AM Jakub Jelinek via Gcc-patches wrote: > > On Mon, Jun 21, 2021 at 09:18:28AM +0200, Uros Bizjak via Gcc-patches wrote: > > > 2021-06-20 Roger Sayle > > > > > > gcc/ChangeLog > > > PR target/11877 > > > * config/i386/i386.md: New define_peephole2s

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Jakub Jelinek via Gcc-patches
On Mon, Jun 21, 2021 at 09:18:28AM +0200, Uros Bizjak via Gcc-patches wrote: > > 2021-06-20 Roger Sayle > > > > gcc/ChangeLog > > PR target/11877 > > * config/i386/i386.md: New define_peephole2s to shrink writing > > 1, 2 or 4 consecutive zeros to memory when optimizing f

Re: [x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-21 Thread Uros Bizjak via Gcc-patches
On Sun, Jun 20, 2021 at 5:37 PM Roger Sayle wrote: > > > The following patch attempts to resolve PR target/11877 (without > triggering PR/23102). On x86_64, writing an SImode or DImode zero > to memory uses an instruction encoding that is larger than first > clearing a register (using xor) then w

[x86_64 PATCH] PR target/11877: Use xor to write zero to memory with -Os

2021-06-20 Thread Roger Sayle
The following patch attempts to resolve PR target/11877 (without triggering PR/23102). On x86_64, writing an SImode or DImode zero to memory uses an instruction encoding that is larger than first clearing a register (using xor) then writing that to memory. Hence, after reload, the peephole2 pass