public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46091] New: missed optimization: x86 bt/btc/bts instructions
@ 2010-10-20 5:42 jay.krell at cornell dot edu
2010-10-27 20:36 ` [Bug target/46091] " pinskia at gcc dot gnu.org
2014-08-18 19:39 ` avi@cloudius-systems.com
0 siblings, 2 replies; 3+ messages in thread
From: jay.krell at cornell dot edu @ 2010-10-20 5:42 UTC (permalink / raw)
To: gcc-bugs
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)));
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/46091] missed optimization: x86 bt/btc/bts instructions
2010-10-20 5:42 [Bug target/46091] New: missed optimization: x86 bt/btc/bts instructions jay.krell at cornell dot edu
@ 2010-10-27 20:36 ` pinskia at gcc dot gnu.org
2014-08-18 19:39 ` avi@cloudius-systems.com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-10-27 20:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46091
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/46091] missed optimization: x86 bt/btc/bts instructions
2010-10-20 5:42 [Bug target/46091] New: missed optimization: x86 bt/btc/bts instructions jay.krell at cornell dot edu
2010-10-27 20:36 ` [Bug target/46091] " pinskia at gcc dot gnu.org
@ 2014-08-18 19:39 ` avi@cloudius-systems.com
1 sibling, 0 replies; 3+ messages in thread
From: avi@cloudius-systems.com @ 2014-08-18 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46091
Avi Kivity <avi@cloudius-systems.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |avi@cloudius-systems.com
--- Comment #1 from Avi Kivity <avi@cloudius-systems.com> ---
This is even more important in conjunction with _Atomic.
Note the code as posted cannot be optimized to use bts, since the BitOffset
operand is signed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-18 19:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-20 5:42 [Bug target/46091] New: missed optimization: x86 bt/btc/bts instructions jay.krell at cornell dot edu
2010-10-27 20:36 ` [Bug target/46091] " pinskia at gcc dot gnu.org
2014-08-18 19:39 ` avi@cloudius-systems.com
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).