Hi,
Clang 3.7 generated the following code:
$ clang -S -O0 -fno-unwind-tables -fno-asynchronous-unwind-tables
add.c -o add_att_x64.s
add:
pushq %rbp
movq %rsp, %rbp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
movl -4(%rbp), %esi
addl -8(%rbp), %esi
movl %esi, %eax
popq %rbp
retq
While gcc 4.8 generated the following:
$ gcc -S -O0 -fno-unwind-tables -fno-asynchronous-unwind-tables add.c
-o add_att_x64.s
add:
pushq %rbp
movq %rsp, %rbp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
movl -8(%rbp), %eax
movl -4(%rbp), %edx
addl %edx, %eax
popq %rbp
ret
$ cat add.c
int add(int a, int b) {
return a + b;
}
Is the clang version better?
--
Thiago Farina