* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
@ 2023-10-27 4:04 ` pinskia at gcc dot gnu.org
2023-10-27 13:08 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-27 4:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This shows up in a really really bad benchmark:
https://github.com/kdlucas/byte-unixbench/blob/master/UnixBench/src/whets.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
2023-10-27 4:04 ` [Bug tree-optimization/112104] " pinskia at gcc dot gnu.org
@ 2023-10-27 13:08 ` rguenth at gcc dot gnu.org
2023-10-30 6:34 ` crazylht at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-27 13:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-10-27
Status|UNCONFIRMED |NEW
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. I think it should apply even to
int
foo(long n3, int j, int x) {
for(int i=0; i<n3; i++)
j=j^x;
return j;
}
which alternates between 'j' and 'j^x', thus the result
is n3&1 ? j^x : j?
I wonder if there's some online symbolic calculus service that we can
feed IL during compilation ;)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
2023-10-27 4:04 ` [Bug tree-optimization/112104] " pinskia at gcc dot gnu.org
2023-10-27 13:08 ` rguenth at gcc dot gnu.org
@ 2023-10-30 6:34 ` crazylht at gmail dot com
2023-11-14 17:01 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2023-10-30 6:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
We already have analyze_and_compute_bitop_with_inv_effect, but it only works
when inv is an SSA_NAME, it should be extended to constant.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-10-30 6:34 ` crazylht at gmail dot com
@ 2023-11-14 17:01 ` pinskia at gcc dot gnu.org
2023-11-14 23:59 ` crazylht at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-14 17:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |14.0
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed via r14-5428-gfd1596f9962569afff6c9298a7c79686c6950bef .
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-11-14 17:01 ` pinskia at gcc dot gnu.org
@ 2023-11-14 23:59 ` crazylht at gmail dot com
2023-11-15 0:00 ` pinskia at gcc dot gnu.org
2023-11-15 0:00 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2023-11-14 23:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> Fixed via r14-5428-gfd1596f9962569afff6c9298a7c79686c6950bef .
Note, my patch only handles constant tripcount for XOR, but not do the
transformation when tripcount is variable.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-11-14 23:59 ` crazylht at gmail dot com
@ 2023-11-15 0:00 ` pinskia at gcc dot gnu.org
2023-11-15 0:00 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-15 0:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Resolution|FIXED |---
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hongtao.liu from comment #5)
> (In reply to Andrew Pinski from comment #4)
> > Fixed via r14-5428-gfd1596f9962569afff6c9298a7c79686c6950bef .
>
> Note, my patch only handles constant tripcount for XOR, but not do the
> transformation when tripcount is variable.
Oh.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112104] loop of ^1 should just be reduced to ^(n&1)
2023-10-27 3:47 [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-11-15 0:00 ` pinskia at gcc dot gnu.org
@ 2023-11-15 0:00 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-15 0:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |---
^ permalink raw reply [flat|nested] 8+ messages in thread