Bug 112090 - ``(1 >> X) != 0` pattern should be extended to support other constants
Summary: ``(1 >> X) != 0` pattern should be extended to support other constants
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P3 enhancement
Target Milestone: ---
Assignee: Andrew Pinski
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2023-10-25 22:17 UTC by Andrew Pinski
Modified: 2023-10-25 22:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-10-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2023-10-25 22:17:52 UTC
We could extend it to support power of 2 constants or more.

Example:
```
int f(int a)
{
  return 2 != (2 >> a);
}
```

This could be optimized to `a != 0`