public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
@ 2020-06-26 23:17 gabravier at gmail dot com
2020-06-29 9:42 ` [Bug middle-end/95922] " rguenth at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2020-06-26 23:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
Bug ID: 95922
Summary: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) |
(b & c)` the right way on architectures with andnot
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 a, int b, int c)
{
return ((b ^ a) & c) ^ a;
}
This can be optimized to `return (a & ~c) | (b & c);` on processors that have
andnot instructions (at least according to LLVM, which does this transformation
on x86 with -mbmi).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/95922] Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
@ 2020-06-29 9:42 ` rguenth at gcc dot gnu.org
2020-11-20 11:06 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-29 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |middle-end
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be expand-time optimization since on GIMPLE it takes one more
instruction.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/95922] Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
2020-06-29 9:42 ` [Bug middle-end/95922] " rguenth at gcc dot gnu.org
@ 2020-11-20 11:06 ` jakub at gcc dot gnu.org
2020-11-20 15:04 ` gabravier at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-20 11:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What would be the advantage of doing that?
Same number of instructions, but with andn 3 bytes longer...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/95922] Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
2020-06-29 9:42 ` [Bug middle-end/95922] " rguenth at gcc dot gnu.org
2020-11-20 11:06 ` jakub at gcc dot gnu.org
@ 2020-11-20 15:04 ` gabravier at gmail dot com
2021-04-26 1:51 ` pinskia at gcc dot gnu.org
2021-12-27 5:53 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2020-11-20 15:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
--- Comment #3 from Gabriel Ravier <gabravier at gmail dot com> ---
Hm, I guess with the andn it avoids a move, though that isn't much. I posted
this here months ago actually, so idk really what I was thinking... I guess it
might help in some further transformations, but it seems bad overall yeah.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/95922] Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
` (2 preceding siblings ...)
2020-11-20 15:04 ` gabravier at gmail dot com
@ 2021-04-26 1:51 ` pinskia at gcc dot gnu.org
2021-12-27 5:53 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-26 1:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/95922] Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
` (3 preceding siblings ...)
2021-04-26 1:51 ` pinskia at gcc dot gnu.org
@ 2021-12-27 5:53 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 5:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95922
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 94790.
*** This bug has been marked as a duplicate of bug 94790 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-27 5:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 23:17 [Bug tree-optimization/95922] New: Failure to optimize `((b ^ a) & c) ^ a` to `(a & ~c) | (b & c)` the right way on architectures with andnot gabravier at gmail dot com
2020-06-29 9:42 ` [Bug middle-end/95922] " rguenth at gcc dot gnu.org
2020-11-20 11:06 ` jakub at gcc dot gnu.org
2020-11-20 15:04 ` gabravier at gmail dot com
2021-04-26 1:51 ` pinskia at gcc dot gnu.org
2021-12-27 5:53 ` 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).