------- Comment #5 from steven at gcc dot gnu dot org 2008-11-22 09:51 -------
I created a t.c with both functions in it:
unsigned int f1(unsigned int i, unsigned int n) {++i; if (i == n) ++i; return
i;}
unsigned int f2(unsigned int i, unsigned int n) {++i; i += i == n; return i;}
With today's trunk on x86_64, I get:
.file "t.c"
.text
.align 16
.globl f1
.type f1, @function
f1:
.LFB0:
leal 1(%rdi), %eax
addl $2, %edi
cmpl %esi, %eax
cmove %edi, %eax
ret
.LFE0:
.size f1, .-f1
.align 16
.globl f2
.type f2, @function
f2:
.LFB1:
addl $1, %edi
xorl %eax, %eax
cmpl %esi, %edi
sete %al
addl %edi, %eax
ret
.LFE1:
.size f2, .-f2
.section .eh_frame,"aw",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zR"
.byte 0x1
.byte 0x78
.byte 0x10
.byte 0x1
.byte 0x3
.byte 0xc
.byte 0x7
.byte 0x8
.byte 0x11
.byte 0x10
.byte 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB0
.long .LFE0-.LFB0
.byte 0x0
.align 8
.LEFDE1:
.LSFDE3:
.long .LEFDE3-.LASFDE3
.LASFDE3:
.long .LASFDE3-.Lframe1
.long .LFB1
.long .LFE1-.LFB1
.byte 0x0
.align 8
.LEFDE3:
.ident "GCC: (GNU) 4.4.0 20081122 (experimental) [trunk revision
142117]"
.section .note.GNU-stack,"",@progbits
So still not the same functions.
For x86 (32bit) with -march=core2, I get similar code (f1 with a cmove).
Without a -march option, I get code with a jump.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2007-01-22 00:29:40 |2008-11-22 09:51:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30521