public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112104] New: loop of ^1 should just be reduced to ^(n&1) Date: Fri, 27 Oct 2023 03:47:11 +0000 [thread overview] Message-ID: <bug-112104-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112104 Bug ID: 112104 Summary: loop of ^1 should just be reduced to ^(n&1) Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int foo(long n3) { int j = 0; for(int i=0; i<n3; i++) j=j^1; return j; } int foo1(long n3) { int j = 0; if (n3>=0) j = j ^ (n3&1); return j; } ``` We should figure out that j as the result is just alternating between 0 and 1 (VRP figures that that is the range) in SCCP pattern matching. I Noticed this while looking into PR 111972
next reply other threads:[~2023-10-27 3:47 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-27 3:47 pinskia at gcc dot gnu.org [this message] 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 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112104-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).