public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jiangning.liu at amperecomputing dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114760] New: traling zero count detection failure Date: Wed, 17 Apr 2024 22:50:48 +0000 [thread overview] Message-ID: <bug-114760-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114760 Bug ID: 114760 Summary: traling zero count detection failure Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jiangning.liu at amperecomputing dot com Target Milestone: --- For this small case, gcc failed to detect trailing zero count calculation, so the x86 instruction tzcnt cannot be generated, but clang can generate it. unsigned ntz32_6a(unsigned x) { int n; n = 32; while (x != 0) { n = n - 1; x = x + x; } return n; } If we slightly change "x = x + x" to "x = x << 1", the optimization will just work. unsigned ntz32_6a(unsigned x) { int n; n = 32; while (x != 0) { n = n - 1; x = x << 1; } return n; } It seems number_of_iterations_cltz/number_of_iterations_cltz_complement in tree-ssa-loop-niter.cc or somewhere else need to be enhanced.
next reply other threads:[~2024-04-17 22:50 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-17 22:50 jiangning.liu at amperecomputing dot com [this message] 2024-04-18 0:27 ` [Bug tree-optimization/114760] " pinskia at gcc dot gnu.org 2024-04-18 6:50 ` rguenth at gcc dot gnu.org 2024-05-11 10:00 ` [Bug tree-optimization/114760] trailing " cvs-commit 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-114760-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).