Last active
August 29, 2015 14:10
-
-
Save ArchRobison/cb9a8c654287445bd7ae to your computer and use it in GitHub Desktop.
Results from https://github.com/JuliaLang/julia/pull/6271 on 2014-Nov-25 17:13 CST.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ cat toivoh.jl | |
| module TestSLP | |
| function rmw!{T}(dest::Ptr{T}, src::Ptr{T}) | |
| s1 = unsafe_load(src, 1) | |
| s2 = unsafe_load(src, 2) | |
| d1 = unsafe_load(dest, 1) | |
| d2 = unsafe_load(dest, 2) | |
| d1 $= s1 | |
| d2 $= s2 | |
| unsafe_store!(dest, d1, 1) | |
| unsafe_store!(dest, d2, 2) | |
| nothing | |
| end | |
| function rmw2!{T}(dest::Vector{T}, src::Vector{T}) | |
| psrc, pdest = pointer(src), pointer(dest) | |
| s1 = unsafe_load(psrc, 1) | |
| s2 = unsafe_load(psrc, 2) | |
| d1 = unsafe_load(pdest, 1) | |
| d2 = unsafe_load(pdest, 2) | |
| d1 $= s1 | |
| d2 $= s2 | |
| unsafe_store!(pdest, d1, 1) | |
| unsafe_store!(pdest, d2, 2) | |
| nothing | |
| end | |
| function rmw2b!{T}(dest::Vector{T}, src::Vector{T}) | |
| @inbounds s1 = src[1] | |
| @inbounds s2 = src[2] | |
| @inbounds d1 = dest[1] | |
| @inbounds d2 = dest[2] | |
| d1 $= s1 | |
| d2 $= s2 | |
| pdest = pointer(dest) | |
| unsafe_store!(pdest, d1, 1) | |
| unsafe_store!(pdest, d2, 2) | |
| nothing | |
| end | |
| function rmw3!{T}(dest::Vector{T}, src::Vector{T}) | |
| @inbounds s1 = src[1] | |
| @inbounds s2 = src[2] | |
| @inbounds d1 = dest[1] | |
| @inbounds d2 = dest[2] | |
| d1 $= s1 | |
| d2 $= s2 | |
| @inbounds dest[1] = d1 | |
| @inbounds dest[2] = d2 | |
| nothing | |
| end | |
| println("\n\nrmw!: ") | |
| code_native(rmw!, (Ptr{Uint64}, Ptr{Uint64})) | |
| println("\n\nrmw2!: ") | |
| code_native(rmw2!, (Vector{Uint64}, Vector{Uint64})) | |
| println("\n\nrmw2b!: ") | |
| code_native(rmw2b!, (Vector{Uint64}, Vector{Uint64})) | |
| println("\n\nrmw3!: ") | |
| code_native(rmw3!, (Vector{Uint64}, Vector{Uint64})) | |
| end # module | |
| $ julia -O toivoh.jl | |
| rmw!: | |
| .text | |
| Filename: toivoh.jl | |
| Source line: 0 | |
| push rbp | |
| mov rbp, rsp | |
| Source line: 6 | |
| vmovups xmm0, xmmword ptr [rdi] | |
| Source line: 8 | |
| vxorps xmm0, xmm0, xmmword ptr [rsi] | |
| Source line: 10 | |
| vmovups xmmword ptr [rdi], xmm0 | |
| Source line: 12 | |
| pop rbp | |
| ret | |
| rmw2!: | |
| .text | |
| Filename: toivoh.jl | |
| Source line: 0 | |
| push rbp | |
| mov rbp, rsp | |
| Source line: 16 | |
| mov rax, qword ptr [rsi + 8] | |
| mov rcx, qword ptr [rdi + 8] | |
| Source line: 19 | |
| vmovups xmm0, xmmword ptr [rcx] | |
| Source line: 21 | |
| vxorps xmm0, xmm0, xmmword ptr [rax] | |
| Source line: 23 | |
| vmovups xmmword ptr [rcx], xmm0 | |
| Source line: 25 | |
| pop rbp | |
| ret | |
| rmw2b!: | |
| .text | |
| Filename: toivoh.jl | |
| Source line: 0 | |
| push rbp | |
| mov rbp, rsp | |
| Source line: 29 | |
| mov rax, qword ptr [rsi + 8] | |
| Source line: 31 | |
| mov rcx, qword ptr [rdi + 8] | |
| vmovups xmm0, xmmword ptr [rcx] | |
| Source line: 33 | |
| vxorps xmm0, xmm0, xmmword ptr [rax] | |
| Source line: 36 | |
| vmovups xmmword ptr [rcx], xmm0 | |
| Source line: 38 | |
| pop rbp | |
| ret | |
| rmw3!: | |
| .text | |
| Filename: toivoh.jl | |
| Source line: 0 | |
| push rbp | |
| mov rbp, rsp | |
| Source line: 42 | |
| mov rax, qword ptr [rsi + 8] | |
| Source line: 44 | |
| mov rcx, qword ptr [rdi + 8] | |
| vmovups xmm0, xmmword ptr [rcx] | |
| Source line: 46 | |
| vxorps xmm0, xmm0, xmmword ptr [rax] | |
| Source line: 48 | |
| vmovups xmmword ptr [rcx], xmm0 | |
| Source line: 50 | |
| pop rbp | |
| ret | |
| $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment