4 ms·
Clang is much more reasonable, see: {0}[calvinow ~] clang -Os -S test.c -c -o - .text .file "test.c" .globl foo
by jcalvinowens 3y ago
Clang is much more reasonable, see:
{0}[calvinow ~] clang -Os -S test.c -c -o -
.text
.file "test.c"
.globl foo # -- Begin function foo
.type foo,@function
foo: # @foo
.cfi_startproc
# %bb.0:
# kill: def $edi killed $edi def $rdi
leal 3(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $2, %eax
retq
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.cfi_endproc
# -- End function
.ident "Debian clang version 16.0.6 (19)"
.section ".note.GNU-stack","",@progbits
.addrsig
{0}[calvinow ~] clang -Oz -S test.c -c -o -
.text
.file "test.c"
.globl foo # -- Begin function foo
.type foo,@function
foo: # @foo
.cfi_startproc
# %bb.0:
movl %edi, %eax
pushq $4
.cfi_adjust_cfa_offset 8
popq %rcx
.cfi_adjust_cfa_offset -8
cltd
idivl %ecx
retq
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.cfi_endproc
# -- End function
.ident "Debian clang version 16.0.6 (19)"
.section ".note.GNU-stack","",@progbits
.addrsig
{0}[calvinow ~] clang -O2 -S test.c -c -o -
.text
.file "test.c"
.globl foo # -- Begin function foo
.p2align 4, 0x90
.type foo,@function
foo: # @foo
.cfi_startproc
# %bb.0:
# kill: def $edi killed $edi def $rdi
leal 3(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $2, %eax
retq
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.cfi_endproc
# -- End function
.ident "Debian clang version 16.0.6 (19)"
.section ".note.GNU-stack","",@progbits
.addrsig
GCC has -Oz now, but they haven't fixed -Os to be softer like clang's is.