This is a performance/size regression between 4.6 (4.5) and 4.4. The C code: int foo(long long a) { if (a & (long long) 0x400) return 1; return 0; }
Assemble code generated by 4.6 trunk: foo: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 movq %rsp, %rbp .cfi_offset 6, -16 .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax andl $1024, %eax testq %rax, %rax je .L2 movl $1, %eax jmp .L3 .L2: movl $0, %eax .L3: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc Assemble code generated by 4.4.0: foo: .LFB0: .cfi_startproc shrq $10, %rdi movl %edi, %eax andl $1, %eax ret .cfi_endproc After tree optimizations, both compilers produce different but essentially same forms. RTL expander and later passes then go on to do different optimizations and generate very different code. -- Summary: Code size regression between 4.6(4.5) and 4.4 Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bmei at broadcom dot com GCC host triplet: x86_64-unknown-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45416