[Bug tree-optimization/126705] New: `ctz(a*3)` should be simplified into `ctz(a)`

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126705

            Bug ID: 126705
           Summary: `ctz(a*3)` should be simplified into `ctz(a)`
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: easyhack, missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

The number of trailing zeros does not change if multiplying by an odd number.

For an example 3*a will have the same # of trailing zeros as a has.

Example:
```
unsigned f(unsigned t)
{
    return __builtin_ctz(t*3);
}
```
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.