From d8bf51df2ab26d538f438509aabd6f5c860953af Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Jan 2025 15:44:08 -0500 Subject: [PATCH 1/5] Test bswap for 1-byte types --- test/runtests.jl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 6ba4c3c..a0be103 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -103,7 +103,8 @@ llvm_ir(f, args) = sprint(code_llvm, f, Base.typesof(args...)) notbool(x) = !(x>=typeof(x)(0)) for op in (~, +, -, abs, abs2, notbool, sign, signbit, count_ones, count_zeros, - leading_ones, leading_zeros, conj, real, imag, trailing_ones, trailing_zeros) + leading_ones, leading_zeros, conj, real, imag, trailing_ones, trailing_zeros, + bswap) @test Tuple(op(V8I32(v8i32))) == map(op, v8i32) end @@ -142,6 +143,14 @@ llvm_ir(f, args) = sprint(code_llvm, f, Base.typesof(args...)) @test Tuple(V8I32(v8i32)^3) === v8i32.^3 end + @testset "bswap" begin + for sz in [1, 2, 4, 8, 16, 32] + VszI8 = Vec{sz,Int8} + vszi8 = ntuple(i->Int8(ifelse(isodd(i), i, -i)), sz) + @test Tuple(bswap(VszI8(vszi8))) == map(bswap, vszi8) + end + end + @testset "saturation" begin v = Vec{4, UInt8}(UInt8.((150, 250, 125, 0))) @test SIMD.add_saturate(v, UInt8(50)) === Vec{4, UInt8}(UInt8.((200, 255, 175, 50))) From 45de37f15857ad27b8fc20685bcae871f8289f9f Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Jan 2025 15:51:52 -0500 Subject: [PATCH 2/5] Fix bswap for 1-byte types --- src/simdvec.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/simdvec.jl b/src/simdvec.jl index cb2c8cd..2366719 100644 --- a/src/simdvec.jl +++ b/src/simdvec.jl @@ -157,6 +157,10 @@ for (op, constraint, llvmop) in UNARY_OPS Vec($(llvmop)(x.data)) end +# Fix up bswap (see ): +# bswap for 1-byte types is a no-op +Base.bswap(x::Vec{<:Any, <:Union{Int8,UInt8}}) = x + Base.:+(v::Vec{<:Any, <:ScalarTypes}) = v Base.:-(v::Vec{<:Any, <:IntegerTypes}) = zero(v) - v Base.:-(v::Vec{<:Any, <:FloatingTypes}) = Vec(Intrinsics.fneg(v.data)) From b5a97be4488f2f0e5105c22b49cb92e49e57e680 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Jan 2025 15:54:46 -0500 Subject: [PATCH 3/5] CI: Update actions --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 208a506..74a882e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,14 +24,17 @@ jobs: include: - arch: "x64" os: "ubuntu-latest" - version: "1.10" + version: "1.11" - arch: "x64" os: "windows-latest" - version: "1.10" + version: "1.11" - arch: "x64" os: "macOS-latest" - version: "1.10" + version: "1.11" - arch: "x86" + os: "ubuntu-latest" + version: "1.11" + - arch: "x64" os: "ubuntu-latest" version: "1.10" - arch: "x64" @@ -59,7 +62,7 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: 82aae245-ad5c-41ac-9e30-b64617ce25b0 with: From ddf3ce589b17cf96fd7d72869727396cb8ad2e85 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Jan 2025 15:59:47 -0500 Subject: [PATCH 4/5] CI: Update actions --- .github/workflows/ci_julia_nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_julia_nightly.yml b/.github/workflows/ci_julia_nightly.yml index f7e5042..fcbbb13 100644 --- a/.github/workflows/ci_julia_nightly.yml +++ b/.github/workflows/ci_julia_nightly.yml @@ -43,7 +43,7 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: 82aae245-ad5c-41ac-9e30-b64617ce25b0 with: From 1e61e8522675fdeaca8c61431bf4bb4ead2e68d7 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Jan 2025 16:00:16 -0500 Subject: [PATCH 5/5] Bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d724d06..d992149 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SIMD" uuid = "fdea26ae-647d-5447-a871-4b548cad5224" authors = ["Erik Schnetter ", "Kristoffer Carlsson "] -version = "3.7.0" +version = "3.7.1" [deps] PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"