[PATCH] match.pd: Implement missed optimization ((x ^ y) & z) | x -> (z & y) | x [PR109938]

2023-08-04 Thread Drew Ross via Gcc-patches
Adds a simplification for ((x ^ y) & z) | x to be folded into (z & y) | x. Merges this simplification with ((x | y) & z) | x -> (z & y) | x to prevent duplicate pattern. Tested successfully on x86_64 and x86 targets. PR tree-opt/109938 gcc/ChangeLog: * match.pd ((x ^ y) & z) | x

[PATCH] match.pd: Canonicalize (signed x << c) >> c [PR101955]

2023-08-02 Thread Drew Ross via Gcc-patches
Canonicalizes (signed x << c) >> c into the lowest precision(type) - c bits of x IF those bits have a mode precision or a precision of 1. Also combines this rule with (unsigned x << c) >> c -> x & ((unsigned)-1 >> c) to prevent duplicate pattern. Tested successfully on x86_64 and x86 targets. PR

[PATCH] match.pd: Canonicalize (signed x << c) >> c [PR101955]

2023-08-01 Thread Drew Ross via Gcc-patches
Canonicalizes (signed x << c) >> c into the lowest precision(type) - c bits of x IF those bits have a mode precision or a precision of 1. Also combines this rule with (unsigned x << c) >> c -> x & ((unsigned)-1 >> c) to prevent duplicate pattern. Tested successfully on x86_64 and x86 targets. PR

[PATCH] match.pd: Canonicalize (signed x << c) >> c [PR101955]

2023-08-01 Thread Drew Ross via Gcc-patches
Canonicalizes (signed x << c) >> c into the lowest precision(type) - c bits of x IF those bits have a mode precision or a precision of 1. Also combines this rule with (unsigned x << c) >> c -> x & ((unsigned)-1 >> c) to prevent duplicate pattern. Tested successfully on x86_64 and x86 targets. PR

Re: [PATCH] match.pd: Implement missed optimization (x << c) >> c -> -(x & 1) [PR101955]

2023-07-26 Thread Drew Ross via Gcc-patches
; > The RTL is slightly better for the mode precision cases and slightly > worse for the precision 1 case. > > > > > That said - do you have any testcase where the canonicalization is an > enabler > > > for further transforms or was this requested st

Re: [PATCH] match.pd: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986]

2023-07-26 Thread Drew Ross via Gcc-patches
Thanks for catching and fixing David and Andrew. Drew On Tue, Jul 25, 2023 at 5:59 PM Andrew Pinski wrote: > On Tue, Jul 25, 2023 at 1:54 PM Andrew Pinski wrote: > > > > On Tue, Jul 25, 2023 at 12:45 PM Jakub Jelinek via Gcc-patches > > wrote: > > > > > > On Tue, Jul 25, 2023 at 03:42:21PM -0

Re: [PATCH] match.pd: Implement missed optimization (x << c) >> c -> -(x & 1) [PR101955]

2023-07-25 Thread Drew Ross via Gcc-patches
ave any specific test cases. This patch is just in response to pr101955 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101955>. On Tue, Jul 25, 2023 at 2:55 AM Richard Biener wrote: > On Mon, Jul 24, 2023 at 9:42 PM Jakub Jelinek wrote: > > > > On Mon, Jul 24, 2023 at

Re: [PATCH] match.pd: Implement missed optimization (x << c) >> c -> -(x & 1) [PR101955]

2023-07-24 Thread Drew Ross via Gcc-patches
- 1)) (convert (convert:stype @0) work? Drew On Mon, Jul 24, 2023 at 3:16 AM Richard Biener wrote: > On Sat, Jul 22, 2023 at 8:09 AM Jeff Law via Gcc-patches > wrote: > > > > > > > > On 7/21/23 11:27, Andrew Pinski via Gcc-patches wrote: > > > On

[PATCH] match.pd, v2: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986]

2023-07-21 Thread Drew Ross via Gcc-patches
Adds a simplification for (~X | Y) ^ X to be folded into ~(X & Y). Also adds the macro bitwise_equal_p for generic and gimple which returns true iff EXPR1 and EXPR2 have the same value. This helps to reduce the number of nop_converts necessary to match the pattern. Tested successfully on x86_64 a

[PATCH] match.pd: Implement missed optimization (x << c) >> c -> -(x & 1) [PR101955]

2023-07-21 Thread Drew Ross via Gcc-patches
Simplifies (x << c) >> c where x is a signed integral type of width >= int and c = precision(type) - 1 into -(x & 1). Tested successfully on x86_64 and x86 targets. PR middle-end/101955 gcc/ChangeLog: * match.pd (x << c) >> c -> -(x & 1): New simplification. gcc/testsuite/Change

Re: [PATCH] match.pd: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986]

2023-07-19 Thread Drew Ross via Gcc-patches
; > > > On Thu, Jul 06, 2023 at 03:00:28PM +0200, Richard Biener via Gcc-patches > wrote: > > > On Wed, Jul 5, 2023 at 3:42 PM Drew Ross via Gcc-patches > > > wrote: > > > > > > > > Adds a simplification for (~X | Y) ^ X to be folded into ~

[PATCH] match.pd: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986]

2023-07-05 Thread Drew Ross via Gcc-patches
Adds a simplification for (~X | Y) ^ X to be folded into ~(X & Y). Tested successfully on x86_64 and x86 targets. PR middle-end/109986 gcc/ChangeLog: * match.pd ((~X | Y) ^ X -> ~(X & Y)): New simplification. gcc/testsuite/ChangeLog: * gcc.c-