Skip to content

Commit 6753f29

Browse files
committed
Use reduced_max and reduced_min from SIMDPirates to fix #111.
1 parent 61a0be5 commit 6753f29

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/LoopVectorization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using VectorizationBase: REGISTER_SIZE, REGISTER_COUNT, extract_data, num_vector
88
AbstractColumnMajorStridedPointer, AbstractRowMajorStridedPointer, AbstractSparseStridedPointer, AbstractStaticStridedPointer,
99
PackedStridedPointer, SparseStridedPointer, RowMajorStridedPointer, StaticStridedPointer, StaticStridedStruct,
1010
maybestaticfirst, maybestaticlast, scalar_less, scalar_greater
11-
using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange, reduced_add, reduced_prod, reduce_to_add, reduce_to_prod, vsum, vprod, vmaximum, vminimum,
11+
using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange, reduced_add, reduced_prod, reduced_max, reduced_min, vsum, vprod, vmaximum, vminimum,
1212
sizeequivalentfloat, sizeequivalentint, vadd!, vsub!, vmul!, vfdiv!, vfmadd!, vfnmadd!, vfmsub!, vfnmsub!,
1313
vfmadd231, vfmsub231, vfnmadd231, vfnmsub231, sizeequivalentfloat, sizeequivalentint, #prefetch,
1414
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone

test/mapreduce.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22
@testset "mapreduce" begin
3-
3+
function maximum_avx(x)
4+
s = typemin(eltype(x))
5+
@avx for i in eachindex(x)
6+
s = max(s, x[i])
7+
end
8+
s
9+
end
410
for T (Int32, Int64, Float32, Float64)
511
if T <: Integer
612
R = T(1):T(100)
@@ -19,6 +25,7 @@
1925
@test vmapreduce(sin, +, x7) mapreduce(sin, +, x7)
2026
@test vmapreduce(log, +, x) mapreduce(log, +, x)
2127
@test vmapreduce(abs2, +, x) mapreduce(abs2, +, x)
28+
@test maximum(x) == vreduce(max, x) == maximum_avx(x)
2229
end
2330

2431
end

0 commit comments

Comments
 (0)