Created
February 21, 2014 22:36
-
-
Save ArchRobison/9145036 to your computer and use it in GitHub Desktop.
Sample sessions with experimental Julia with SLPVectorizer enabled.
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
julia> function foo( a::NTuple{4,Float32}, b::NTuple{4,Float32} ) | |
(a[1]+b[1],a[2]+b[2],a[3]+b[3],a[4]+b[4]) | |
end | |
foo (generic function with 1 method) | |
julia> t = NTuple{4,Float32} | |
(Float32,Float32,Float32,Float32) | |
julia> code_llvm(foo,(t,t)) | |
define <4 x float> @julia_foo111(<4 x float>, <4 x float>) { | |
top: | |
%2 = extractelement <4 x float> %0, i32 0, !dbg !8 | |
%3 = extractelement <4 x float> %1, i32 0, !dbg !8 | |
%4 = fadd float %2, %3, !dbg !8 | |
%5 = insertelement <4 x float> undef, float %4, i32 0, !dbg !8, !julia_type !9 | |
%6 = extractelement <4 x float> %0, i32 1, !dbg !8 | |
%7 = extractelement <4 x float> %1, i32 1, !dbg !8 | |
%8 = fadd float %6, %7, !dbg !8 | |
%9 = insertelement <4 x float> %5, float %8, i32 1, !dbg !8, !julia_type !10 | |
%10 = extractelement <4 x float> %0, i32 2, !dbg !8 | |
%11 = extractelement <4 x float> %1, i32 2, !dbg !8 | |
%12 = fadd float %10, %11, !dbg !8 | |
%13 = insertelement <4 x float> %9, float %12, i32 2, !dbg !8, !julia_type !11 | |
%14 = extractelement <4 x float> %0, i32 3, !dbg !8 | |
%15 = extractelement <4 x float> %1, i32 3, !dbg !8 | |
%16 = fadd float %14, %15, !dbg !8 | |
%17 = insertelement <4 x float> %13, float %16, i32 3, !dbg !8, !julia_type !12 | |
ret <4 x float> %17, !dbg !8 | |
} | |
julia> function bar( a::NTuple{4,Float32}, b::NTuple{4,Float32} ) | |
c1=a[1]+b[1] | |
c2=a[2]+b[2] | |
c3=a[3]+b[3] | |
c4=a[4]+b[4] | |
(c1,c2,c3,c4) | |
end | |
bar (generic function with 1 method) | |
julia> code_llvm(bar,(t,t)) | |
define <4 x float> @julia_bar112(<4 x float>, <4 x float>) { | |
top: | |
%2 = fadd <4 x float> %0, %1, !dbg !8 | |
ret <4 x float> %2, !dbg !9 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment