This file contains 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
module TestSIMD | |
immutable TypeConst{T} end | |
function innerloop!{T, M}(dest::Vector{T}, dest_ofs, src::Vector{T}, src_ofs, ::TypeConst{M}) | |
@simd for i=1:M | |
@inbounds dest[i + dest_ofs] $= src[i + src_ofs] | |
end | |
end |
This file contains 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
module TestSIMD2 | |
# requires Julia 0.4 for llvmcall | |
typealias Uint64x2 NTuple{2, Uint64} | |
function ($)(x::Uint64x2, y::Uint64x2) | |
Base.llvmcall("""%3 = xor <2 x i64> %1, %0 | |
ret <2 x i64> %3""", | |
Uint64x2, (Uint64x2, Uint64x2), x, y) | |
end |
This file contains 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
module TestSIMD5 | |
typealias Uint64x2 NTuple{2, Uint64} | |
function ($)(x::Uint64x2, y::Uint64x2) | |
Base.llvmcall("""%3 = xor <2 x i64> %1, %0 | |
ret <2 x i64> %3""", | |
Uint64x2, (Uint64x2, Uint64x2), x, y) | |
end | |
unsafe_aligned_load(p::Ptr{Uint64}, i::Int) = unsafe_aligned_load(ptradd(p, (i-1)*sizeof(Uint64)*2)) |
This file contains 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
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) |
This file contains 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
function code_big_function(n::Int) | |
code = [:( $(Symbol("x$k")) = $(Symbol("x$(k-1)")) + 1 ) for k=1:n] | |
quote | |
let | |
function f(x0) | |
$(code...) | |
return $(Symbol("x$n")) | |
end | |
end | |
end |
OlderNewer