Skip to content

Commit 8b2fceb

Browse files
committed
Add a couple CloseOpen tests.
1 parent a840eb6 commit 8b2fceb

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/dot.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ using Test
99
@test LoopVectorization.choose_order(lsdot) == (Symbol[:i], :i, Symbol("##undefined##"), :i, 4, -1)
1010
function mydot(a, b)
1111
s = zero(eltype(a))
12-
@inbounds @simd for i eachindex(a,b)
13-
s += a[i]*b[i]
12+
za = OffsetArray(a, OffsetArrays.Origin(0))
13+
zb = OffsetArray(b, OffsetArrays.Origin(0))
14+
@inbounds @simd for i LoopVectorization.CloseOpen(min(length(a),length(b)))
15+
s += za[i]*zb[i]
1416
end
1517
s
1618
end
1719
function mydotavx(a, b)
1820
s = zero(eltype(a))
19-
@avx for i eachindex(a,b)
20-
s += a[i]*b[i]
21+
za = OffsetArray(a, OffsetArrays.Origin(0))
22+
zb = OffsetArray(b, OffsetArrays.Origin(0))
23+
@avx for i LoopVectorization.CloseOpen(min(length(a),length(b)))
24+
s += za[i]*zb[i]
2125
end
2226
s
2327
end
@@ -88,9 +92,9 @@ using Test
8892
end
8993
z
9094
end
91-
@macroexpand @avx inline=false unroll=2 for i 1:length(x)
92-
z += x[i]*y[i]
93-
end
95+
# @macroexpand @avx inline=false unroll=2 for i ∈ 1:length(x)
96+
# z += x[i]*y[i]
97+
# end
9498

9599
function dot_unroll2avx_noinline(x::Vector{T}, y::Vector{T}) where {T<:Number}
96100
z = zero(T)

0 commit comments

Comments
 (0)