public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/> @ 2021-06-03 2:43 ` pinskia at gcc dot gnu.org 2023-05-05 8:17 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-06-03 2:43 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2012-01-04 00:00:00 |2021-6-2 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed again. So looking at the IR, it took until PHI-OPT4 to be able to convert it into: <bb 2> [local count: 1073741824]: if (x_3(D) != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: _1 = x_3(D) & 85; _5 = _1 != 0; _6 = (int) _5; <bb 4> [local count: 1073741824]: # iftmp.0_2 = PHI <_6(3), 0(2)> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/> 2021-06-03 2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org @ 2023-05-05 8:17 ` pinskia at gcc dot gnu.org 2023-10-12 17:56 ` pinskia at gcc dot gnu.org 2023-10-12 18:00 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-05-05 8:17 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > Confirmed again. > So looking at the IR, it took until PHI-OPT4 to be able to convert it into: > <bb 2> [local count: 1073741824]: > if (x_3(D) != 0) > goto <bb 3>; [50.00%] > else > goto <bb 4>; [50.00%] > > <bb 3> [local count: 536870913]: > _1 = x_3(D) & 85; > _5 = _1 != 0; > _6 = (int) _5; > > <bb 4> [local count: 1073741824]: > # iftmp.0_2 = PHI <_6(3), 0(2)> In GCC 12+, phiopt2 is able to convert that into the above. One thing that could be tried is to replace x_3 with 0 and see if _6 would simplify down to 0 (other the phi argument). This could be part of phiopt but would need a lot of work really. Note VRP is able to handle the other way around already: that is: `(x & 0x55) && x ` But that is simplier. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/> 2021-06-03 2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org 2023-05-05 8:17 ` pinskia at gcc dot gnu.org @ 2023-10-12 17:56 ` pinskia at gcc dot gnu.org 2023-10-12 18:00 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-10-12 17:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Mine. Bug 88280 comment #5 fixes part of the issue. The secondary issue is ifcombine does not do the combining to get that point. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2023-10-12 17:56 ` pinskia at gcc dot gnu.org @ 2023-10-12 18:00 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-10-12 18:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note also there are other bugs associated with similar ifcombine issue (besides this one and PR 88280 ). I don't know if I will get to that part until next year though. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] New: x && (x & y) not optimized to x & y @ 2006-05-08 19:28 falk at debian dot org 2006-05-09 6:20 ` [Bug tree-optimization/27504] " pinskia at gcc dot gnu dot org 2006-05-09 8:36 ` rguenth at gcc dot gnu dot org 0 siblings, 2 replies; 6+ messages in thread From: falk at debian dot org @ 2006-05-08 19:28 UTC (permalink / raw) To: gcc-bugs Example: falk@juist:/tmp% cat test.c int f(int x) { return x && (x & 0x55); } falk@juist:/tmp% gcc -c -O3 test.c && objdump -d test.o 0000000000000000 <f>: 0: 00 04 ff 47 clr v0 4: 02 00 00 e6 beq a0,10 <f+0x10> 8: 01 b0 0a 46 and a0,0x55,t0 c: a0 03 e1 43 cmpult zero,t0,v0 10: 01 80 fa 6b ret -- Summary: x && (x & y) not optimized to x & y Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: falk at debian dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y 2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org @ 2006-05-09 6:20 ` pinskia at gcc dot gnu dot org 2006-05-09 8:36 ` rguenth at gcc dot gnu dot org 1 sibling, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-05-09 6:20 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from pinskia at gcc dot gnu dot org 2006-05-09 06:20 ------- Confirmed. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2006-05-09 06:20:01 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y 2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org 2006-05-09 6:20 ` [Bug tree-optimization/27504] " pinskia at gcc dot gnu dot org @ 2006-05-09 8:36 ` rguenth at gcc dot gnu dot org 1 sibling, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2006-05-09 8:36 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from rguenth at gcc dot gnu dot org 2006-05-09 08:36 ------- It get's a little complicated as fold gets (xD.1520 != 0) && ((xD.1520 & 85) != 0) from the frontend. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27504 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-10-12 18:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/> 2021-06-03 2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org 2023-05-05 8:17 ` pinskia at gcc dot gnu.org 2023-10-12 17:56 ` pinskia at gcc dot gnu.org 2023-10-12 18:00 ` pinskia at gcc dot gnu.org 2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org 2006-05-09 6:20 ` [Bug tree-optimization/27504] " pinskia at gcc dot gnu dot org 2006-05-09 8:36 ` rguenth at gcc dot gnu dot 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).