public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32648] New: missed-optimization: bit-manipulation via bool's
@ 2007-07-06 12:25 wouter dot vermaelen at scarlet dot be
2007-07-06 12:54 ` [Bug tree-optimization/32648] " rguenth at gcc dot gnu dot org
2007-07-07 3:10 ` rob1weld at aol dot com
0 siblings, 2 replies; 3+ messages in thread
From: wouter dot vermaelen at scarlet dot be @ 2007-07-06 12:25 UTC (permalink / raw)
To: gcc-bugs
> cat b5-xor-b3.cc
bool f1(int a)
{
bool b5 = a & 0x20;
bool b3 = a & 0x08;
return b5 ^ b3;
}
bool f2(int a)
{
return (a ^ (a << 2)) & 0x20;
}
> g++ -O3 -c b5-xor-b3.cc
> objdump -d b5-xor-b3.o
b5-xor-b3.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <_Z2f1i>:
0: c1 ef 03 shr $0x3,%edi
3: 89 f8 mov %edi,%eax
5: c1 ef 02 shr $0x2,%edi
8: 83 e0 01 and $0x1,%eax
b: 83 e7 01 and $0x1,%edi
e: 40 38 f8 cmp %dil,%al
11: 0f 95 c0 setne %al
14: 0f b6 c0 movzbl %al,%eax
17: c3 retq
18: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
1f: 00
0000000000000020 <_Z2f2i>:
20: 8d 04 bd 00 00 00 00 lea 0x0(,%rdi,4),%eax
27: 31 f8 xor %edi,%eax
29: c1 e8 05 shr $0x5,%eax
2c: 83 e0 01 and $0x1,%eax
2f: c3 retq
--
Summary: missed-optimization: bit-manipulation via bool's
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wouter dot vermaelen at scarlet dot be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32648
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-07 3:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-06 12:25 [Bug c++/32648] New: missed-optimization: bit-manipulation via bool's wouter dot vermaelen at scarlet dot be
2007-07-06 12:54 ` [Bug tree-optimization/32648] " rguenth at gcc dot gnu dot org
2007-07-07 3:10 ` rob1weld at aol dot 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).