Skip to content

Instantly share code, notes, and snippets.

@retep998
Created June 26, 2014 20:17
Show Gist options
  • Save retep998/bf4fd704bbd456912c22 to your computer and use it in GitHub Desktop.
Save retep998/bf4fd704bbd456912c22 to your computer and use it in GitHub Desktop.
comparison of asm for code generated by rustc
.text
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
@feat.00 = 1
.def __ZN2p320heb5d6e0aa9a57a67iaa4v0.0E;
.scl 3;
.type 32;
.endef
.align 16, 0x90
__ZN2p320heb5d6e0aa9a57a67iaa4v0.0E:
.cfi_startproc
.cfi_personality 0, _rust_eh_personality
Leh_func_begin0:
.cfi_lsda 0, Lexception0
cmp esp, dword ptr fs:[20]
ja LBB0_2
push 0
push 92
call ___morestack
ret
LBB0_2:
push ebp
Ltmp7:
.cfi_def_cfa_offset 8
Ltmp8:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp9:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 80
Ltmp10:
.cfi_offset esi, -20
Ltmp11:
.cfi_offset edi, -16
Ltmp12:
.cfi_offset ebx, -12
mov dword ptr [esp + 4], 0
mov dword ptr [esp], 775146
call _je_mallocx
mov esi, eax
test esi, esi
je LBB0_22
mov dword ptr [esp], esi
mov dword ptr [esp + 8], 775146
mov dword ptr [esp + 4], 1
call _memset
mov dword ptr [esp + 24], 775146
mov dword ptr [esp + 28], 775146
mov dword ptr [esp + 32], esi
mov byte ptr [esi], 0
mov eax, dword ptr [esp + 24]
cmp eax, 1
jbe LBB0_4
mov eax, dword ptr [esp + 32]
mov byte ptr [eax + 1], 0
mov eax, 2
mov edi, 775146
LBB0_9:
mov ecx, dword ptr [esp + 24]
mov esi, dword ptr [esp + 32]
.align 16, 0x90
LBB0_10:
cmp eax, 879
ja LBB0_19
cmp ecx, eax
jbe LBB0_12
LBB0_13:
movzx edx, byte ptr [esi + eax]
inc eax
cmp edx, 1
je LBB0_10
jmp LBB0_14
LBB0_12:
mov dword ptr [esp + 64], _str1802
mov dword ptr [esp + 68], 8
Ltmp2:
mov dword ptr [esp + 12], ecx
mov dword ptr [esp + 8], eax
lea eax, dword ptr [esp + 64]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h790ef238e174ea86w0v11v0.11.0.preE
Ltmp3:
jmp LBB0_13
.align 16, 0x90
LBB0_14:
lea edx, dword ptr [eax - 1]
mov dword ptr [esp + 20], edx
imul edx, edx
cmp edx, 775145
ja LBB0_9
jmp LBB0_15
.align 16, 0x90
LBB0_18:
mov ecx, dword ptr [esp + 24]
mov esi, dword ptr [esp + 32]
mov edx, ebx
LBB0_15:
mov ebx, edx
add ebx, dword ptr [esp + 20]
cmovb ebx, edi
cmp ecx, edx
jbe LBB0_16
LBB0_17:
mov byte ptr [esi + edx], 0
cmp ebx, 775145
jbe LBB0_18
jmp LBB0_9
LBB0_16:
mov dword ptr [esp + 56], _str1802
mov dword ptr [esp + 60], 8
Ltmp4:
mov dword ptr [esp + 12], ecx
mov dword ptr [esp + 8], edx
lea eax, dword ptr [esp + 56]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h790ef238e174ea86w0v11v0.11.0.preE
Ltmp5:
jmp LBB0_17
LBB0_19:
lea eax, dword ptr [esp + 24]
mov dword ptr [esp + 52], eax
lea eax, dword ptr [esp + 52]
#APP
#NO_APP
cmp dword ptr [esp + 28], 0
je LBB0_21
mov eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB0_21:
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
LBB0_22:
call __ZN3oom20h8deb363eb5c6a64bWNa11v0.11.0.preE
LBB0_4:
mov dword ptr [esp + 40], _str1802
mov dword ptr [esp + 44], 8
Ltmp0:
mov dword ptr [esp + 12], eax
lea eax, dword ptr [esp + 40]
mov dword ptr [esp], eax
mov dword ptr [esp + 8], 1
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h790ef238e174ea86w0v11v0.11.0.preE
Ltmp1:
LBB0_5:
Ltmp6:
mov esi, eax
cmp dword ptr [esp + 28], 0
je LBB0_7
mov eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB0_7:
mov dword ptr [esp], esi
call __Unwind_Resume
.cfi_endproc
Leh_func_end0:
.section .gcc_except_table,"rd"
.align 4
GCC_except_table0:
Lexception0:
.byte 255
.byte 0
.asciz "\303\200"
.byte 3
.byte 65
Lset0 = Leh_func_begin0-Leh_func_begin0
.long Lset0
Lset1 = Ltmp2-Leh_func_begin0
.long Lset1
.long 0
.byte 0
Lset2 = Ltmp2-Leh_func_begin0
.long Lset2
Lset3 = Ltmp5-Ltmp2
.long Lset3
Lset4 = Ltmp6-Leh_func_begin0
.long Lset4
.byte 0
Lset5 = Ltmp5-Leh_func_begin0
.long Lset5
Lset6 = Ltmp0-Ltmp5
.long Lset6
.long 0
.byte 0
Lset7 = Ltmp0-Leh_func_begin0
.long Lset7
Lset8 = Ltmp1-Ltmp0
.long Lset8
Lset9 = Ltmp6-Leh_func_begin0
.long Lset9
.byte 0
Lset10 = Ltmp1-Leh_func_begin0
.long Lset10
Lset11 = Leh_func_end0-Ltmp1
.long Lset11
.long 0
.byte 0
.align 4
.def __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E;
.scl 2;
.type 32;
.endef
.text
.globl __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E
.align 16, 0x90
__ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E:
.cfi_startproc
cmp esp, dword ptr fs:[20]
ja LBB1_2
push 4
push 28
call ___morestack
ret
LBB1_2:
push ebp
Ltmp13:
.cfi_def_cfa_offset 8
Ltmp14:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp15:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 16
Ltmp16:
.cfi_offset esi, -20
Ltmp17:
.cfi_offset edi, -16
Ltmp18:
.cfi_offset ebx, -12
mov esi, dword ptr [ebp + 8]
call __ZN15precise_time_ns20hab4d5aec3a61b82akqa11v0.11.0.preE
mov dword ptr [esi + 12], edx
mov dword ptr [esi + 8], eax
mov eax, dword ptr [esi]
mov dword ptr [esp + 4], eax
mov ebx, dword ptr [esi + 4]
or eax, ebx
je LBB1_7
xor esi, esi
xor edi, edi
.align 16, 0x90
LBB1_4:
add esi, 1
adc edi, 0
call __ZN2p320heb5d6e0aa9a57a67iaa4v0.0E
lea eax, dword ptr [esp + 8]
#APP
#NO_APP
cmp esi, dword ptr [esp + 4]
setb al
cmp edi, ebx
setb cl
je LBB1_6
mov al, cl
LBB1_6:
test al, al
jne LBB1_4
LBB1_7:
call __ZN15precise_time_ns20hab4d5aec3a61b82akqa11v0.11.0.preE
mov ecx, dword ptr [ebp + 8]
mov dword ptr [ecx + 20], edx
mov dword ptr [ecx + 16], eax
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
.cfi_endproc
.def __ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E;
.scl 3;
.type 32;
.endef
.align 16, 0x90
__ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E:
.cfi_startproc
.cfi_personality 0, _rust_eh_personality
Leh_func_begin2:
.cfi_lsda 0, Lexception2
cmp esp, dword ptr fs:[20]
ja LBB2_2
push 0
push 60
call ___morestack
ret
LBB2_2:
push ebp
Ltmp22:
.cfi_def_cfa_offset 8
Ltmp23:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp24:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 48
Ltmp25:
.cfi_offset esi, -20
Ltmp26:
.cfi_offset edi, -16
Ltmp27:
.cfi_offset ebx, -12
lea eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
call __ZN2os4args20h0e9e1b6fc5e98d74VQg11v0.11.0.preE
mov ebx, dword ptr [esp + 32]
mov eax, dword ptr [esp + 40]
mov dword ptr [esp + 12], eax
mov dword ptr [esp + 24], eax
mov dword ptr [esp + 28], ebx
mov dword ptr [esp + 16], L_const
mov dword ptr [esp + 20], 1
Ltmp19:
lea eax, dword ptr [esp + 16]
mov dword ptr [esp + 4], eax
lea eax, dword ptr [esp + 24]
mov dword ptr [esp], eax
call __ZN16test_main_static20h5113466db1836dc9xwb11v0.11.0.preE
Ltmp20:
cmp dword ptr [esp + 36], 0
je LBB2_10
test ebx, ebx
je LBB2_9
imul esi, ebx, 12
mov eax, dword ptr [esp + 12]
add esi, eax
lea ebx, dword ptr [eax + 8]
mov edi, eax
.align 16, 0x90
LBB2_6:
cmp ebx, 8
je LBB2_9
cmp dword ptr [edi + 4], 0
lea edi, dword ptr [edi + 12]
je LBB2_8
mov eax, dword ptr [ebx]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB2_8:
add ebx, 12
cmp edi, esi
jne LBB2_6
LBB2_9:
mov eax, dword ptr [esp + 12]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 2
call _je_dallocx
LBB2_10:
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
LBB2_11:
Ltmp21:
mov dword ptr [esp + 8], eax
cmp dword ptr [esp + 36], 0
je LBB2_18
test ebx, ebx
je LBB2_17
imul edi, ebx, 12
mov eax, dword ptr [esp + 12]
add edi, eax
lea esi, dword ptr [eax + 8]
mov ebx, eax
LBB2_14:
cmp esi, 8
je LBB2_17
cmp dword ptr [ebx + 4], 0
lea ebx, dword ptr [ebx + 12]
je LBB2_16
mov eax, dword ptr [esi]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB2_16:
add esi, 12
cmp ebx, edi
jne LBB2_14
LBB2_17:
mov eax, dword ptr [esp + 12]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 2
call _je_dallocx
LBB2_18:
mov eax, dword ptr [esp + 8]
mov dword ptr [esp], eax
call __Unwind_Resume
.cfi_endproc
Leh_func_end2:
.section .gcc_except_table,"rd"
.align 4
GCC_except_table2:
Lexception2:
.byte 255
.byte 0
.byte 41
.byte 3
.byte 39
Lset12 = Leh_func_begin2-Leh_func_begin2
.long Lset12
Lset13 = Ltmp19-Leh_func_begin2
.long Lset13
.long 0
.byte 0
Lset14 = Ltmp19-Leh_func_begin2
.long Lset14
Lset15 = Ltmp20-Ltmp19
.long Lset15
Lset16 = Ltmp21-Leh_func_begin2
.long Lset16
.byte 0
Lset17 = Ltmp20-Leh_func_begin2
.long Lset17
Lset18 = Leh_func_end2-Ltmp20
.long Lset18
.long 0
.byte 0
.align 4
.def _main;
.scl 2;
.type 32;
.endef
.text
.globl _main
.align 16, 0x90
_main:
.cfi_startproc
cmp esp, dword ptr fs:[20]
ja LBB3_2
push 8
push 16
call ___morestack
ret
LBB3_2:
push ebp
Ltmp28:
.cfi_def_cfa_offset 8
Ltmp29:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp30:
.cfi_def_cfa_register ebp
sub esp, 12
call ___main
mov eax, dword ptr [ebp + 8]
mov ecx, dword ptr [ebp + 12]
mov dword ptr [esp + 8], ecx
mov dword ptr [esp + 4], eax
mov dword ptr [esp], __ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E
call __ZN10lang_start20h0a5c172e8e02db346ye11v0.11.0.preE
add esp, 12
pop ebp
ret
.cfi_endproc
.section .rdata,"rd"
_str1802:
.ascii "euler.rs"
_str1849:
.ascii "bench_p3"
.data
.align 16
L_const:
.byte 0
.zero 3
.long _str1849
.long 8
.zero 4
.byte 0
.byte 0
.zero 2
.byte 1
.zero 3
.long __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E
.zero 4
.text
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
@feat.00 = 1
.def __ZN2p320heb5d6e0aa9a57a67iaa4v0.0E;
.scl 3;
.type 32;
.endef
.align 16, 0x90
__ZN2p320heb5d6e0aa9a57a67iaa4v0.0E:
.cfi_startproc
.cfi_personality 0, _rust_eh_personality
Leh_func_begin0:
.cfi_lsda 0, Lexception0
cmp esp, dword ptr fs:[20]
ja LBB0_2
push 0
push 92
call ___morestack
ret
LBB0_2:
push ebp
Ltmp7:
.cfi_def_cfa_offset 8
Ltmp8:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp9:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 80
Ltmp10:
.cfi_offset esi, -20
Ltmp11:
.cfi_offset edi, -16
Ltmp12:
.cfi_offset ebx, -12
mov dword ptr [esp + 4], 0
mov dword ptr [esp], 775146
call _je_mallocx
test eax, eax
je LBB0_24
mov ecx, 1
.align 16, 0x90
LBB0_4:
mov byte ptr [eax + ecx - 1], 1
mov byte ptr [eax + ecx], 1
add ecx, 2
cmp ecx, 775147
jne LBB0_4
mov dword ptr [esp + 24], 775146
mov dword ptr [esp + 28], 775146
mov dword ptr [esp + 32], eax
mov byte ptr [eax], 0
mov eax, dword ptr [esp + 24]
cmp eax, 1
jbe LBB0_6
mov eax, dword ptr [esp + 32]
mov byte ptr [eax + 1], 0
mov eax, 2
LBB0_11:
mov edi, dword ptr [esp + 24]
mov esi, dword ptr [esp + 32]
.align 16, 0x90
LBB0_12:
cmp eax, 879
ja LBB0_21
cmp edi, eax
jbe LBB0_14
LBB0_15:
mov cl, byte ptr [esi + eax]
inc eax
test cl, cl
jne LBB0_12
jmp LBB0_16
LBB0_14:
mov dword ptr [esp + 64], _str1785
mov dword ptr [esp + 68], 8
Ltmp2:
mov dword ptr [esp + 12], edi
mov dword ptr [esp + 8], eax
lea eax, dword ptr [esp + 64]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h78b771774070d25390v11v0.11.0.preE
Ltmp3:
jmp LBB0_15
.align 16, 0x90
LBB0_16:
lea ecx, dword ptr [eax - 1]
mov dword ptr [esp + 20], ecx
imul ecx, ecx
cmp ecx, 775145
ja LBB0_11
jmp LBB0_17
.align 16, 0x90
LBB0_20:
mov edi, dword ptr [esp + 24]
mov esi, dword ptr [esp + 32]
mov ecx, ebx
LBB0_17:
mov ebx, ecx
add ebx, dword ptr [esp + 20]
setb dl
cmp edi, ecx
jbe LBB0_18
LBB0_19:
test dl, dl
mov edx, 775146
cmovne ebx, edx
mov byte ptr [esi + ecx], 0
cmp ebx, 775145
jbe LBB0_20
jmp LBB0_11
LBB0_18:
mov dword ptr [esp + 56], _str1785
mov dword ptr [esp + 60], 8
Ltmp4:
mov dword ptr [esp + 12], edi
mov dword ptr [esp + 8], ecx
lea eax, dword ptr [esp + 56]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h78b771774070d25390v11v0.11.0.preE
Ltmp5:
jmp LBB0_19
LBB0_21:
lea eax, dword ptr [esp + 24]
mov dword ptr [esp + 52], eax
lea eax, dword ptr [esp + 52]
#APP
#NO_APP
cmp dword ptr [esp + 28], 0
je LBB0_23
mov eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB0_23:
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
LBB0_24:
call __ZN3oom20h4993fb2afb0d6532WNa11v0.11.0.preE
LBB0_6:
mov dword ptr [esp + 40], _str1785
mov dword ptr [esp + 44], 8
Ltmp0:
mov dword ptr [esp + 12], eax
lea eax, dword ptr [esp + 40]
mov dword ptr [esp], eax
mov dword ptr [esp + 8], 1
mov dword ptr [esp + 4], 1
call __ZN7failure17fail_bounds_check20h78b771774070d25390v11v0.11.0.preE
Ltmp1:
LBB0_7:
Ltmp6:
mov esi, eax
cmp dword ptr [esp + 28], 0
je LBB0_9
mov eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB0_9:
mov dword ptr [esp], esi
call __Unwind_Resume
.cfi_endproc
Leh_func_end0:
.section .gcc_except_table,"rd"
.align 4
GCC_except_table0:
Lexception0:
.byte 255
.byte 0
.asciz "\303\200"
.byte 3
.byte 65
Lset0 = Leh_func_begin0-Leh_func_begin0
.long Lset0
Lset1 = Ltmp2-Leh_func_begin0
.long Lset1
.long 0
.byte 0
Lset2 = Ltmp2-Leh_func_begin0
.long Lset2
Lset3 = Ltmp5-Ltmp2
.long Lset3
Lset4 = Ltmp6-Leh_func_begin0
.long Lset4
.byte 0
Lset5 = Ltmp5-Leh_func_begin0
.long Lset5
Lset6 = Ltmp0-Ltmp5
.long Lset6
.long 0
.byte 0
Lset7 = Ltmp0-Leh_func_begin0
.long Lset7
Lset8 = Ltmp1-Ltmp0
.long Lset8
Lset9 = Ltmp6-Leh_func_begin0
.long Lset9
.byte 0
Lset10 = Ltmp1-Leh_func_begin0
.long Lset10
Lset11 = Leh_func_end0-Ltmp1
.long Lset11
.long 0
.byte 0
.align 4
.def __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E;
.scl 2;
.type 32;
.endef
.text
.globl __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E
.align 16, 0x90
__ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E:
.cfi_startproc
cmp esp, dword ptr fs:[20]
ja LBB1_2
push 4
push 28
call ___morestack
ret
LBB1_2:
push ebp
Ltmp13:
.cfi_def_cfa_offset 8
Ltmp14:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp15:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 16
Ltmp16:
.cfi_offset esi, -20
Ltmp17:
.cfi_offset edi, -16
Ltmp18:
.cfi_offset ebx, -12
mov esi, dword ptr [ebp + 8]
call __ZN15precise_time_ns20hab4d5aec3a61b82akqa11v0.11.0.preE
mov dword ptr [esi + 12], edx
mov dword ptr [esi + 8], eax
mov eax, dword ptr [esi]
mov dword ptr [esp + 4], eax
mov ebx, dword ptr [esi + 4]
or eax, ebx
je LBB1_7
xor esi, esi
xor edi, edi
.align 16, 0x90
LBB1_4:
add esi, 1
adc edi, 0
call __ZN2p320heb5d6e0aa9a57a67iaa4v0.0E
lea eax, dword ptr [esp + 8]
#APP
#NO_APP
cmp esi, dword ptr [esp + 4]
setb al
cmp edi, ebx
setb cl
je LBB1_6
mov al, cl
LBB1_6:
test al, al
jne LBB1_4
LBB1_7:
call __ZN15precise_time_ns20hab4d5aec3a61b82akqa11v0.11.0.preE
mov ecx, dword ptr [ebp + 8]
mov dword ptr [ecx + 20], edx
mov dword ptr [ecx + 16], eax
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
.cfi_endproc
.def __ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E;
.scl 3;
.type 32;
.endef
.align 16, 0x90
__ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E:
.cfi_startproc
.cfi_personality 0, _rust_eh_personality
Leh_func_begin2:
.cfi_lsda 0, Lexception2
cmp esp, dword ptr fs:[20]
ja LBB2_2
push 0
push 60
call ___morestack
ret
LBB2_2:
push ebp
Ltmp22:
.cfi_def_cfa_offset 8
Ltmp23:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp24:
.cfi_def_cfa_register ebp
push ebx
push edi
push esi
and esp, -8
sub esp, 48
Ltmp25:
.cfi_offset esi, -20
Ltmp26:
.cfi_offset edi, -16
Ltmp27:
.cfi_offset ebx, -12
lea eax, dword ptr [esp + 32]
mov dword ptr [esp], eax
call __ZN2os4args20h1dbfa15d30096b4cVQg11v0.11.0.preE
mov ebx, dword ptr [esp + 32]
mov eax, dword ptr [esp + 40]
mov dword ptr [esp + 12], eax
mov dword ptr [esp + 24], eax
mov dword ptr [esp + 28], ebx
mov dword ptr [esp + 16], L_const
mov dword ptr [esp + 20], 1
Ltmp19:
lea eax, dword ptr [esp + 16]
mov dword ptr [esp + 4], eax
lea eax, dword ptr [esp + 24]
mov dword ptr [esp], eax
call __ZN16test_main_static20h0dbc1e4d34ca7a13xwb11v0.11.0.preE
Ltmp20:
cmp dword ptr [esp + 36], 0
je LBB2_10
test ebx, ebx
je LBB2_9
imul esi, ebx, 12
mov eax, dword ptr [esp + 12]
add esi, eax
lea ebx, dword ptr [eax + 8]
mov edi, eax
.align 16, 0x90
LBB2_6:
cmp ebx, 8
je LBB2_9
cmp dword ptr [edi + 4], 0
lea edi, dword ptr [edi + 12]
je LBB2_8
mov eax, dword ptr [ebx]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB2_8:
add ebx, 12
cmp edi, esi
jne LBB2_6
LBB2_9:
mov eax, dword ptr [esp + 12]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 2
call _je_dallocx
LBB2_10:
lea esp, dword ptr [ebp - 12]
pop esi
pop edi
pop ebx
pop ebp
ret
LBB2_11:
Ltmp21:
mov dword ptr [esp + 8], eax
cmp dword ptr [esp + 36], 0
je LBB2_18
test ebx, ebx
je LBB2_17
imul edi, ebx, 12
mov eax, dword ptr [esp + 12]
add edi, eax
lea esi, dword ptr [eax + 8]
mov ebx, eax
LBB2_14:
cmp esi, 8
je LBB2_17
cmp dword ptr [ebx + 4], 0
lea ebx, dword ptr [ebx + 12]
je LBB2_16
mov eax, dword ptr [esi]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 0
call _je_dallocx
LBB2_16:
add esi, 12
cmp ebx, edi
jne LBB2_14
LBB2_17:
mov eax, dword ptr [esp + 12]
mov dword ptr [esp], eax
mov dword ptr [esp + 4], 2
call _je_dallocx
LBB2_18:
mov eax, dword ptr [esp + 8]
mov dword ptr [esp], eax
call __Unwind_Resume
.cfi_endproc
Leh_func_end2:
.section .gcc_except_table,"rd"
.align 4
GCC_except_table2:
Lexception2:
.byte 255
.byte 0
.byte 41
.byte 3
.byte 39
Lset12 = Leh_func_begin2-Leh_func_begin2
.long Lset12
Lset13 = Ltmp19-Leh_func_begin2
.long Lset13
.long 0
.byte 0
Lset14 = Ltmp19-Leh_func_begin2
.long Lset14
Lset15 = Ltmp20-Ltmp19
.long Lset15
Lset16 = Ltmp21-Leh_func_begin2
.long Lset16
.byte 0
Lset17 = Ltmp20-Leh_func_begin2
.long Lset17
Lset18 = Leh_func_end2-Ltmp20
.long Lset18
.long 0
.byte 0
.align 4
.def _main;
.scl 2;
.type 32;
.endef
.text
.globl _main
.align 16, 0x90
_main:
.cfi_startproc
cmp esp, dword ptr fs:[20]
ja LBB3_2
push 8
push 16
call ___morestack
ret
LBB3_2:
push ebp
Ltmp28:
.cfi_def_cfa_offset 8
Ltmp29:
.cfi_offset ebp, -8
mov ebp, esp
Ltmp30:
.cfi_def_cfa_register ebp
sub esp, 12
call ___main
mov eax, dword ptr [ebp + 8]
mov ecx, dword ptr [ebp + 12]
mov dword ptr [esp + 8], ecx
mov dword ptr [esp + 4], eax
mov dword ptr [esp], __ZN6__test4main20hcc0a8cc70c47bedfGca4v0.0E
call __ZN10lang_start20h63aa4991194b1b256ye11v0.11.0.preE
add esp, 12
pop ebp
ret
.cfi_endproc
.section .rdata,"rd"
_str1785:
.ascii "euler.rs"
_str1847:
.ascii "bench_p3"
.data
.align 16
L_const:
.byte 0
.zero 3
.long _str1847
.long 8
.zero 4
.byte 0
.byte 0
.zero 2
.byte 1
.zero 3
.long __ZN8bench_p320hf092ec2c73d2fb09nca4v0.0E
.zero 4
extern crate test;
use test::Bencher;
use test::black_box;
use std::iter::range_step;
fn p3() {
let num = 600851475143u64;
let sqrt = (num as f64).sqrt();
let size = sqrt as uint;
let mut sieve = Vec::from_elem(size, true);
*sieve.get_mut(0) = false;
*sieve.get_mut(1) = false;
let sqrtsqrt = sqrt.sqrt() as uint;
for i in range(2, sqrtsqrt) {
if !sieve.get(i) {
for j in range_step(i * i, size, i) {
*sieve.get_mut(j) = false;
}
}
}
black_box(&sieve);
}
#[bench]
fn bench_p3(b: &mut Bencher) {
b.iter(|| p3());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment