------- Comment #5 from pinskia at gcc dot gnu dot org 2006-08-28 14:37 ------- (In reply to comment #4) > So not all gcc3 releases do so well. Are there GCC releases that optimize the > two functions to identical code?
Yes (FSF) 3.2.3. .globl f .type f,@function f: movl 4(%esp), %eax testl %eax, %eax movl 12(%esp), %eax cmovne 8(%esp), %eax addl %eax, %eax ret .Lfe1: .size f,.Lfe1-f .p2align 4,,15 .globl f1 .type f1,@function f1: movl 4(%esp), %edx movl 12(%esp), %eax testl %edx, %edx cmovne 8(%esp), %eax addl %eax, %eax ret .Lfe2: .size f1,.Lfe2-f1 .ident "GCC: (GNU) 3.2.3" -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28868