Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-12 Thread Jeff Law via Gcc-patches
On 4/12/23 00:21, Jakub Jelinek wrote: On Tue, Apr 11, 2023 at 07:26:07PM -0600, Jeff Law wrote: I did bootstrap on riscv, but not a regression test, that's spinning right now. Jeff diff --git a/gcc/combine.cc b/gcc/combine.cc index 22bf8e1ec89..c41d8a09b3b 100644 --- a/gcc/combine.cc

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-12 Thread Jakub Jelinek via Gcc-patches
On Tue, Apr 11, 2023 at 07:26:07PM -0600, Jeff Law wrote: > I did bootstrap on riscv, but not a regression test, that's spinning right > now. > > Jeff > diff --git a/gcc/combine.cc b/gcc/combine.cc > index 22bf8e1ec89..c41d8a09b3b 100644 > --- a/gcc/combine.cc > +++ b/gcc/combine.cc > @@

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-11 Thread Jeff Law via Gcc-patches
On 4/10/23 01:10, Jakub Jelinek wrote: On Sat, Apr 08, 2023 at 06:25:32PM -0600, Jeff Law wrote: On 4/6/23 08:21, Eric Botcazou wrote: So, perhaps just in the return op0; case add further code for WORD_REGISTER_OPERATIONS and sub-word modes which will call nonzero_bits again for the word

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-10 Thread Jakub Jelinek via Gcc-patches
On Sat, Apr 08, 2023 at 06:25:32PM -0600, Jeff Law wrote: > > > On 4/6/23 08:21, Eric Botcazou wrote: > > > > So, perhaps just in the return op0; case add further code for > > > WORD_REGISTER_OPERATIONS and sub-word modes which will call nonzero_bits > > > again for the word mode and decide if

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-09 Thread Hongtao Liu via Gcc-patches
On Mon, Apr 10, 2023 at 1:13 PM Hongtao Liu wrote: > > On Sun, Apr 9, 2023 at 9:15 AM Jeff Law via Gcc-patches > wrote: > > > > > > > > On 4/6/23 05:37, Jakub Jelinek wrote: > > > On Thu, Apr 06, 2023 at 12:51:20PM +0200, Eric Botcazou wrote: > > >>> If we want to fix it in the combiner, I think

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-09 Thread Hongtao Liu via Gcc-patches
On Sun, Apr 9, 2023 at 9:15 AM Jeff Law via Gcc-patches wrote: > > > > On 4/6/23 05:37, Jakub Jelinek wrote: > > On Thu, Apr 06, 2023 at 12:51:20PM +0200, Eric Botcazou wrote: > >>> If we want to fix it in the combiner, I think the fix would be following. > >>> The optimization is about > >>>

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-08 Thread Jeff Law via Gcc-patches
On 4/6/23 05:37, Jakub Jelinek wrote: On Thu, Apr 06, 2023 at 12:51:20PM +0200, Eric Botcazou wrote: If we want to fix it in the combiner, I think the fix would be following. The optimization is about (and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c)) and IMHO we can only optimize it into

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-08 Thread Jeff Law via Gcc-patches
On 4/6/23 08:21, Eric Botcazou wrote: So, perhaps just in the return op0; case add further code for WORD_REGISTER_OPERATIONS and sub-word modes which will call nonzero_bits again for the word mode and decide if it is still safe. Does it work to just replace mode by word_mode in the calls

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Jeff Law via Gcc-patches
On 4/6/23 04:31, Jakub Jelinek wrote: If we want to fix it in the combiner, I think the fix would be following. The optimization is about (and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c)) and IMHO we can only optimize it into (subreg:SI (and:HI (reg:HI xxx) (const_int 0x84c)) 0) if we

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Jeff Law via Gcc-patches
On 4/6/23 04:31, Jakub Jelinek wrote: As before, I unfortunately can't test it on riscv-linux (could perhaps try that on sparc-solaris on GCC Farm which is another WORD_REGISTER_OPERATIONS target, but last my bootstrap attempt there failed miserably because of the Don't bootstrap at

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Eric Botcazou via Gcc-patches
> If the > (and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c)) > to > (subreg:SI (and:HI (reg:HI xxx) (const_int 0x84c)) 0) > transformation is kosher for WORD_REGISTER_OPERATIONS, then I guess the > invalid operation is then in > simplify_context::simplify_binary_operation_1 > case AND: >

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Jakub Jelinek via Gcc-patches
On Thu, Apr 06, 2023 at 12:51:20PM +0200, Eric Botcazou wrote: > > If we want to fix it in the combiner, I think the fix would be following. > > The optimization is about > > (and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c)) > > and IMHO we can only optimize it into > > (subreg:SI (and:HI

Re: [PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Eric Botcazou via Gcc-patches
> If we want to fix it in the combiner, I think the fix would be following. > The optimization is about > (and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c)) > and IMHO we can only optimize it into > (subreg:SI (and:HI (reg:HI xxx) (const_int 0x84c)) 0) > if we know that the upper bits of the

[PATCH] combine: Fix simplify_comparison AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

2023-04-06 Thread Jakub Jelinek via Gcc-patches
On Thu, Apr 06, 2023 at 12:15:51PM +0200, Eric Botcazou wrote: > > Originally I didn't really see this as an operation. But the more and > > more I ponder it feels like it's an operation and thus should be subject > > to WORD_REGISTER_OPERATIONS. > > > > While it's not really binding on RTL