public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pb@gcc.gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug optimization/10982] New: [arm] poor optimisation of "if (var & const)" Date: Mon, 26 May 2003 13:58:00 -0000 [thread overview] Message-ID: <20030526135310.10982.pb@gcc.gnu.org> (raw) PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10982 Summary: [arm] poor optimisation of "if (var & const)" Product: gcc Version: unknown Status: NEW Severity: enhancement Priority: P2 Component: optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: pb@gcc.gnu.org CC: gcc-bugs@gcc.gnu.org GCC target triplet: arm-linux Compiling this code: f(int a) { if (a & 0xfff) return 1; return 0; } with -O2 yields: mov r0, r0, asl #20 mov r0, r0, lsr #20 cmp r0, #0 movne r0, #1 moveq r0, #0 There's no need to fully calculate the value of the AND, since all that we care about is whether it's zero or not. So, I think the first three instructions could be replaced by a single one: movs r0, r0, asl #20 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2003-05-26 13:53 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-26 13:58 pb@gcc.gnu.org [this message] 2003-06-22 3:29 ` [Bug optimization/10982] " pinskia at physics dot uc dot edu 2004-05-09 17:11 ` pb at gcc dot gnu dot org 2004-05-17 11:27 ` [Bug target/10982] " rearnsha at gcc dot gnu dot org 2004-05-17 11:32 ` cvs-commit at gcc dot gnu dot org 2004-05-17 11:38 ` rearnsha at gcc dot gnu dot org 2004-05-17 11:40 ` rearnsha at gcc dot gnu dot 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=20030526135310.10982.pb@gcc.gnu.org \ --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).