https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111913

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have a fix.

Basically the pattern:
```
/* popcount(X&Y) + popcount(X|Y) is popcount(x) + popcount(Y).  */
(simplify
  (plus:c (POPCOUNT:s (bit_and:s @0 @1)) (POPCOUNT:s (bit_ior:cs @0 @1)))
  (plus (POPCOUNT @0) (POPCOUNT @1)))
```

Needs a small help with the type that popcount returns. So:
```
/* popcount(X&Y) + popcount(X|Y) is popcount(x) + popcount(Y).  */
(simplify
  (plus:c (POPCOUNT:s (bit_and:s @0 @1)) (POPCOUNT:s (bit_ior:cs @0 @1)))
  (plus (POPCOUNT:type @0) (POPCOUNT:type @1)))
```

Reply via email to