public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jay.krell at cornell dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/46091] New: missed optimization: x86 bt/btc/bts instructions Date: Wed, 20 Oct 2010 05:42:00 -0000 [thread overview] Message-ID: <bug-46091-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46091 Summary: missed optimization: x86 bt/btc/bts instructions Product: gcc Version: 4.3.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: jay.krell@cornell.edu The following code, at least when optimizing for space, should use x86 bt/btc/bts instructions. #include <limits.h> #include <stddef.h> void set_bit(size_t* a, size_t b) { const unsigned c = sizeof(size_t) * CHAR_BIT; a[b / c] |= (((size_t)1) << (b % c)); } void clear_bit(size_t* a, size_t b) { const unsigned c = sizeof(size_t) * CHAR_BIT; a[b / c] &= ~(((size_t)1) << (b % c)); } int get_bit(size_t* a, size_t b) { const unsigned c = sizeof(size_t) * CHAR_BIT; return !!(a[b / c] & (((size_t)1) << (b % c))); }
next reply other threads:[~2010-10-20 5:42 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-10-20 5:42 jay.krell at cornell dot edu [this message] 2010-10-27 20:36 ` [Bug target/46091] " pinskia at gcc dot gnu.org 2014-08-18 19:39 ` avi@cloudius-systems.com
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-46091-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).