public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or
@ 2020-09-02 11:17 gabravier at gmail dot com
2020-09-02 11:37 ` [Bug tree-optimization/96897] " glisse at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: gabravier at gmail dot com @ 2020-09-02 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Bug ID: 96897
Summary: Failure to optimize not+not+dec+and+not to add+or
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
int f(int x)
{
return ~(~x & (~x - 1));
}
This can be optimized to `return (x + 1) | x;`. This transformation is done by
LLVM, but not by GCC.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize not+not+dec+and+not to add+or
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
@ 2020-09-02 11:37 ` glisse at gcc dot gnu.org
2020-09-02 14:17 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2020-09-02 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
We already transform to
return ~(-2 - x) | x;
so this is really asking for
~(-2 - x) --> x + 1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize not+not+dec+and+not to add+or
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
2020-09-02 11:37 ` [Bug tree-optimization/96897] " glisse at gcc dot gnu.org
@ 2020-09-02 14:17 ` rguenth at gcc dot gnu.org
2020-09-02 15:28 ` [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add gabravier at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-02 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-09-02
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
2020-09-02 11:37 ` [Bug tree-optimization/96897] " glisse at gcc dot gnu.org
2020-09-02 14:17 ` rguenth at gcc dot gnu.org
@ 2020-09-02 15:28 ` gabravier at gmail dot com
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gabravier at gmail dot com @ 2020-09-02 15:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Gabriel Ravier <gabravier at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Failure to optimize |Failure to optimize sub+not
|not+not+dec+and+not to |involving constant to add
|add+or |
--- Comment #2 from Gabriel Ravier <gabravier at gmail dot com> ---
Better test case (I'd assume) :
int f(int x)
{
return ~(constant - x);
}
which should be optimizable to `x + ~constant`.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
` (2 preceding siblings ...)
2020-09-02 15:28 ` [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add gabravier at gmail dot com
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-08-03 22:57 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
` (3 preceding siblings ...)
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
@ 2021-08-03 22:57 ` pinskia at gcc dot gnu.org
2021-08-03 22:59 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
` (4 preceding siblings ...)
2021-08-03 22:57 ` pinskia at gcc dot gnu.org
@ 2021-08-03 22:59 ` pinskia at gcc dot gnu.org
2021-08-03 23:03 ` pinskia at gcc dot gnu.org
2021-08-03 23:04 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 22:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |37516
Assignee|prathamesh3492 at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MIne because this is basically PR 37516.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37516
[Bug 37516] ~(-2 - a) is not being optimized into a + 1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
` (5 preceding siblings ...)
2021-08-03 22:59 ` pinskia at gcc dot gnu.org
@ 2021-08-03 23:03 ` pinskia at gcc dot gnu.org
2021-08-03 23:04 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 23:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Bug 96897 depends on bug 37516, which changed state.
Bug 37516 Summary: ~(-2 - a) is not being optimized into a + 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37516
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |DUPLICATE
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
` (6 preceding siblings ...)
2021-08-03 23:03 ` pinskia at gcc dot gnu.org
@ 2021-08-03 23:04 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 23:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96897
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed with r11-5958.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-03 23:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 11:17 [Bug tree-optimization/96897] New: Failure to optimize not+not+dec+and+not to add+or gabravier at gmail dot com
2020-09-02 11:37 ` [Bug tree-optimization/96897] " glisse at gcc dot gnu.org
2020-09-02 14:17 ` rguenth at gcc dot gnu.org
2020-09-02 15:28 ` [Bug tree-optimization/96897] Failure to optimize sub+not involving constant to add gabravier at gmail dot com
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-08-03 22:57 ` pinskia at gcc dot gnu.org
2021-08-03 22:59 ` pinskia at gcc dot gnu.org
2021-08-03 23:03 ` pinskia at gcc dot gnu.org
2021-08-03 23:04 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).