From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20236 invoked by alias); 6 Jul 2007 12:25:03 -0000 Received: (qmail 19812 invoked by uid 48); 6 Jul 2007 12:24:50 -0000 Date: Fri, 06 Jul 2007 12:25:00 -0000 Subject: [Bug c++/32648] New: missed-optimization: bit-manipulation via bool's X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "wouter dot vermaelen at scarlet dot be" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-07/txt/msg00740.txt.bz2 > 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