Timing too good to be true
Paul Jurczak
pauljurczak at yahoo.com
Sat Sep 21 17:27:48 PDT 2013
On Saturday, 21 September 2013 at 22:47:16 UTC, bearophile wrote:
> Paul Jurczak:
>
>> I'm running this test program with multiple compilers on
>> Xubuntu and I'm getting impossibly short timings with LDC
>> compared to DMD and GDC (timing details in comments below). I
>> would appreciate any ideas about what is going on here?
>
> Use -output-s on ldc and show us the asm of just the two
> functions.
>
> Bye,
> bearophile
Here it is:
.globl _D4main5e28_0FiZi
.align 16, 0x90
.type _D4main5e28_0FiZi, at function
_D4main5e28_0FiZi:
.cfi_startproc
movl $1, %eax
cmpl $3, %edi
jl .LBB0_3
movl $2, %r8d
movl $20, %edx
movl $8, %esi
movl %eax, %ecx
.align 16, 0x90
.LBB0_2:
addl %edx, %eax
leal (%rax,%rcx,4), %eax
addl %esi, %ecx
addl $8, %esi
addl $20, %edx
addl $2, %r8d
cmpl %edi, %r8d
jl .LBB0_2
.LBB0_3:
ret
.Ltmp0:
.size _D4main5e28_0FiZi, .Ltmp0-_D4main5e28_0FiZi
.cfi_endproc
.globl _D4main5e28_1FiZi
.align 16, 0x90
.type _D4main5e28_1FiZi, at function
_D4main5e28_1FiZi:
.cfi_startproc
movl $1, %eax
cmpl $3, %edi
jl .LBB1_4
leal -3(%rdi), %ecx
shrl $31, %ecx
leal -3(%rdi,%rcx), %ecx
andl $-2, %ecx
negl %ecx
leal -3(%rdi,%rcx), %ecx
leal 1(%rdi), %edx
subl %ecx, %edx
cmpl $2, %edx
je .LBB1_4
decl %edi
subl %ecx, %edi
movl $1, %ecx
movl $20, %edx
movl $8, %esi
movl $1, %eax
.align 16, 0x90
.LBB1_3:
addl %edx, %eax
leal (%rax,%rcx,4), %eax
addl %esi, %ecx
addl $8, %esi
addl $20, %edx
addl $-2, %edi
jne .LBB1_3
.LBB1_4:
ret
.Ltmp1:
.size _D4main5e28_1FiZi, .Ltmp1-_D4main5e28_1FiZi
.cfi_endproc
More information about the digitalmars-d-ldc
mailing list