From 1a55af8114597411984a86a700c4b75f9dd6fbc8 Mon Sep 17 00:00:00 2001 From: Jeffrey Sarnoff Date: Wed, 23 Dec 2020 13:13:02 -0500 Subject: [PATCH 1/2] Update overdub.jl --- src/overdub.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/overdub.jl b/src/overdub.jl index e10ae3c..b366008 100644 --- a/src/overdub.jl +++ b/src/overdub.jl @@ -4,6 +4,7 @@ Cassette.@context CounterCtx; const ternops = ( (:fma, Core.Intrinsics.fma_float, 2), # 2 flops per FMA instruction + (:muladd, Core.Intrinsics.muladd_float, 2), # 2 flops per muladd instruction ) const binops = ( @@ -11,9 +12,12 @@ const binops = ( (:sub, Core.Intrinsics.sub_float, 1), (:mul, Core.Intrinsics.mul_float, 1), (:div, Core.Intrinsics.div_float, 1), + (:rem, Core.Intrinsics.rem_float, 1), ) const unops = ( + (:abs, Core.Intrinsics.abs_float, 1), + (:neg, Core.Intrinsics.neg_float, 1), (:sqrt, Core.Intrinsics.sqrt_llvm, 1), ) From 681838163fed6bc99fe5c1d41c0472af7e530af5 Mon Sep 17 00:00:00 2001 From: Jeffrey Sarnoff Date: Wed, 23 Dec 2020 13:14:02 -0500 Subject: [PATCH 2/2] Update runtests.jl --- test/runtests.jl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 53d5845..c023a89 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -105,6 +105,30 @@ end end end + @testset "neg" begin + let cnt = @count_ops -(4.2) + @test cnt.neg64 == 1 + @test GFlops.flop(cnt) == 1 + end + + let cnt = @count_ops -(4.2f0) + @test cnt.neg32 == 1 + @test GFlops.flop(cnt) == 1 + end + end + + @testset "abs" begin + let cnt = @count_ops abs(-4.2) + @test cnt.abs64 == 1 + @test GFlops.flop(cnt) == 1 + end + + let cnt = @count_ops abs(-4.2f0) + @test cnt.abs32 == 1 + @test GFlops.flop(cnt) == 1 + end + end + @testset "sqrt" begin let cnt = @count_ops sqrt(4.2) @test cnt.sqrt64 == 1 @@ -117,6 +141,18 @@ end end end + @testset "rem" begin + let cnt = @count_ops rem(12.0, 5.0) + @test cnt.rem64 == 1 + @test GFlops.flop(cnt) == 1 + end + + let cnt = @count_ops rem(12.0f0, 5.0f0) + @test cnt.rem32 == 1 + @test GFlops.flop(cnt) == 1 + end + end + @testset "fma" begin let cnt = @count_ops fma(1.0, 2.0, 3.0) @test cnt.fma64 == 1 @@ -129,6 +165,18 @@ end end end + @testset "muladd" begin + let cnt = @count_ops muladd(1.0, 2.0, 3.0) + @test cnt.muladd64 == 1 + @test GFlops.flop(cnt) == 2 + end + + let cnt = @count_ops muladd(1.0f0, 2.0f0, 3.0f0) + @test cnt.muladd32 == 1 + @test GFlops.flop(cnt) == 2 + end + end + @testset "interpolated arguments" begin let N = 100