Skip to content

Commit

Permalink
Use reduced_max and reduced_min from SIMDPirates to fix #111.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed May 10, 2020
1 parent 61a0be5 commit 6753f29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/LoopVectorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using VectorizationBase: REGISTER_SIZE, REGISTER_COUNT, extract_data, num_vector
AbstractColumnMajorStridedPointer, AbstractRowMajorStridedPointer, AbstractSparseStridedPointer, AbstractStaticStridedPointer,
PackedStridedPointer, SparseStridedPointer, RowMajorStridedPointer, StaticStridedPointer, StaticStridedStruct,
maybestaticfirst, maybestaticlast, scalar_less, scalar_greater
using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange, reduced_add, reduced_prod, reduce_to_add, reduce_to_prod, vsum, vprod, vmaximum, vminimum,
using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange, reduced_add, reduced_prod, reduced_max, reduced_min, vsum, vprod, vmaximum, vminimum,
sizeequivalentfloat, sizeequivalentint, vadd!, vsub!, vmul!, vfdiv!, vfmadd!, vfnmadd!, vfmsub!, vfnmsub!,
vfmadd231, vfmsub231, vfnmadd231, vfnmsub231, sizeequivalentfloat, sizeequivalentint, #prefetch,
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone
Expand Down
9 changes: 8 additions & 1 deletion test/mapreduce.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

@testset "mapreduce" begin

function maximum_avx(x)
s = typemin(eltype(x))
@avx for i in eachindex(x)
s = max(s, x[i])
end
s
end
for T (Int32, Int64, Float32, Float64)
if T <: Integer
R = T(1):T(100)
Expand All @@ -19,6 +25,7 @@
@test vmapreduce(sin, +, x7) mapreduce(sin, +, x7)
@test vmapreduce(log, +, x) mapreduce(log, +, x)
@test vmapreduce(abs2, +, x) mapreduce(abs2, +, x)
@test maximum(x) == vreduce(max, x) == maximum_avx(x)
end

end
Expand Down

0 comments on commit 6753f29

Please sign in to comment.