Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-20 Thread Hongtao Liu via Gcc-patches
0 Subject: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg. If SRC had been assigned a mode narrower than the copy, we can't always link DEST into the chain even they have same hard_regno_nregs(i.e. HImode/SImode in i386 backend). i.e kmovw %k0, %ed

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-20 Thread Richard Sandiford via Gcc-patches
;> [B] partial_subreg_p (vd->e[sr].mode, vd->e[vd->e[sr].oldest_regno].mode) >> >> For example, all registers in this sequence can be part of the same chain: >> >> (set (reg:HI R1) (reg:HI R0)) >> (set (reg:SI R2) (reg:SI R1)) // [A] >>

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-20 Thread H.J. Lu via Gcc-patches
On Tue, Jan 19, 2021 at 8:32 PM Hongtao Liu via Gcc-patches wrote: > > On Wed, Jan 20, 2021 at 12:10 AM Richard Sandiford > wrote: > > > > Jakub Jelinek via Gcc-patches writes: > > > On Tue, Jan 19, 2021 at 12:38:47PM +, Richard Sandiford via > > > Gcc-patches wrote: > > >> > actually only

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-19 Thread Hongtao Liu via Gcc-patches
On Wed, Jan 20, 2021 at 12:35 PM Hongtao Liu wrote: > > On Wed, Jan 20, 2021 at 12:10 AM Richard Sandiford > wrote: > > > > Jakub Jelinek via Gcc-patches writes: > > > On Tue, Jan 19, 2021 at 12:38:47PM +, Richard Sandiford via > > > Gcc-patches wrote: > > >> > actually only the lower 16bit

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-19 Thread Hongtao Liu via Gcc-patches
set (reg:SI R3) (reg:SI R2)) // [A] && [B] > > is problematic because it dips below the precision of the oldest regno > and then increases again. > > When this happens, I guess we have two choices: > > (1) what the patch does: treat R3 as the start of a new chain. &g

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-19 Thread Richard Sandiford via Gcc-patches
Jakub Jelinek via Gcc-patches writes: > On Tue, Jan 19, 2021 at 12:38:47PM +, Richard Sandiford via Gcc-patches > wrote: >> > actually only the lower 16bits are needed, the original insn is like >> > >> > .294.r.ira >> > (insn 69 68 70 13 (set (reg:HI 96 [ _52 ]) >> > (subreg:HI (reg:

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-19 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 19, 2021 at 12:38:47PM +, Richard Sandiford via Gcc-patches wrote: > > actually only the lower 16bits are needed, the original insn is like > > > > .294.r.ira > > (insn 69 68 70 13 (set (reg:HI 96 [ _52 ]) > > (subreg:HI (reg:DI 82 [ var_6.0_1 ]) 0)) "test.c":21:23 76 > > {

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-19 Thread Richard Sandiford via Gcc-patches
Hongtao Liu writes: > On Mon, Jan 18, 2021 at 7:10 PM Richard Sandiford > wrote: >> >> Hongtao Liu writes: >> > On Mon, Jan 18, 2021 at 6:18 PM Richard Sandiford >> > wrote: >> >> >> >> Hongtao Liu via Gcc-patches writes: >> >> > Hi: >> >> > If SRC had been assigned a mode narrower than the

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Hongtao Liu via Gcc-patches
On Mon, Jan 18, 2021 at 7:10 PM Richard Sandiford wrote: > > Hongtao Liu writes: > > On Mon, Jan 18, 2021 at 6:18 PM Richard Sandiford > > wrote: > >> > >> Hongtao Liu via Gcc-patches writes: > >> > Hi: > >> > If SRC had been assigned a mode narrower than the copy, we can't link > >> > DEST i

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Richard Sandiford via Gcc-patches
Hongtao Liu writes: > On Mon, Jan 18, 2021 at 6:18 PM Richard Sandiford > wrote: >> >> Hongtao Liu via Gcc-patches writes: >> > Hi: >> > If SRC had been assigned a mode narrower than the copy, we can't link >> > DEST into the chain even they have same >> > hard_regno_nregs(i.e. HImode/SImode i

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Hongtao Liu via Gcc-patches
On Mon, Jan 18, 2021 at 6:43 PM Hongtao Liu wrote: > > On Mon, Jan 18, 2021 at 6:18 PM Richard Sandiford > wrote: > > > > Hongtao Liu via Gcc-patches writes: > > > Hi: > > > If SRC had been assigned a mode narrower than the copy, we can't link > > > DEST into the chain even they have same > >

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Hongtao Liu via Gcc-patches
On Mon, Jan 18, 2021 at 6:18 PM Richard Sandiford wrote: > > Hongtao Liu via Gcc-patches writes: > > Hi: > > If SRC had been assigned a mode narrower than the copy, we can't link > > DEST into the chain even they have same > > hard_regno_nregs(i.e. HImode/SImode in i386 backend). > > In general

Re: [PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Richard Sandiford via Gcc-patches
Hongtao Liu via Gcc-patches writes: > Hi: > If SRC had been assigned a mode narrower than the copy, we can't link > DEST into the chain even they have same > hard_regno_nregs(i.e. HImode/SImode in i386 backend). In general, changes between modes within the same hard register are OK. Could you e

[PATCH] [PR rtl/optimization/98694] Fix incorrect optimization by cprop_hardreg.

2021-01-18 Thread Hongtao Liu via Gcc-patches
Hi: If SRC had been assigned a mode narrower than the copy, we can't link DEST into the chain even they have same hard_regno_nregs(i.e. HImode/SImode in i386 backend). i.e kmovw %k0, %edi vmovd %edi, %xmm2 vpshuflw$0, %xmm2, %xmm0 kmovw %k0, %r8d