summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2017-02-05 13:41:37 -0800
committerTanner Gooding <tagoo@microsoft.com>2017-05-16 11:33:14 -0700
commit4807b9fc40a8d5644df9dd15e0f43bd307fab395 (patch)
tree486eaa5053af37e28d0781f57759fb24dfbac2e0
parentf2913a39793be26a5bb598582c41790593a5e5f8 (diff)
downloadcoreclr-4807b9fc40a8d5644df9dd15e0f43bd307fab395.tar.gz
coreclr-4807b9fc40a8d5644df9dd15e0f43bd307fab395.tar.bz2
coreclr-4807b9fc40a8d5644df9dd15e0f43bd307fab395.zip
Adding perf tests for the single precision math functions in System.MathF.
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.cs20
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.csproj24
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AcosSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AsinSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Atan2Single.cs48
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AtanSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CeilingSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CosSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CoshSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/ExpSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/FloorSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Log10Single.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/LogSingle.cs48
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/PowSingle.cs48
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/RoundSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinhSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SqrtSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanSingle.cs47
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanhSingle.cs47
20 files changed, 889 insertions, 4 deletions
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.cs
index 8ddc6ad73b..c9b1ef1147 100644
--- a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.cs
@@ -24,23 +24,41 @@ namespace Functions
["absdouble"] = MathTests.AbsDoubleTest,
["abssingle"] = MathTests.AbsSingleTest,
["acosdouble"] = MathTests.AcosDoubleTest,
+ ["acossingle"] = MathTests.AcosSingleTest,
["asindouble"] = MathTests.AsinDoubleTest,
+ ["asinsingle"] = MathTests.AsinSingleTest,
["atandouble"] = MathTests.AtanDoubleTest,
+ ["atansingle"] = MathTests.AtanSingleTest,
["atan2double"] = MathTests.Atan2DoubleTest,
+ ["atan2single"] = MathTests.Atan2SingleTest,
["ceilingdouble"] = MathTests.CeilingDoubleTest,
+ ["ceilingsingle"] = MathTests.CeilingSingleTest,
["cosdouble"] = MathTests.CosDoubleTest,
+ ["cossingle"] = MathTests.CosSingleTest,
["coshdouble"] = MathTests.CoshDoubleTest,
+ ["coshsingle"] = MathTests.CoshSingleTest,
["expdouble"] = MathTests.ExpDoubleTest,
+ ["expsingle"] = MathTests.ExpSingleTest,
["floordouble"] = MathTests.FloorDoubleTest,
+ ["floorsingle"] = MathTests.FloorSingleTest,
["logdouble"] = MathTests.LogDoubleTest,
+ ["logsingle"] = MathTests.LogSingleTest,
["log10double"] = MathTests.Log10DoubleTest,
+ ["log10single"] = MathTests.Log10SingleTest,
["powdouble"] = MathTests.PowDoubleTest,
+ ["powsingle"] = MathTests.PowSingleTest,
["rounddouble"] = MathTests.RoundDoubleTest,
+ ["roundsingle"] = MathTests.RoundSingleTest,
["sindouble"] = MathTests.SinDoubleTest,
+ ["sinsingle"] = MathTests.SinSingleTest,
["sinhdouble"] = MathTests.SinhDoubleTest,
+ ["sinhsingle"] = MathTests.SinhSingleTest,
["sqrtdouble"] = MathTests.SqrtDoubleTest,
+ ["sqrtsingle"] = MathTests.SqrtSingleTest,
["tandouble"] = MathTests.TanDoubleTest,
- ["tanhdouble"] = MathTests.TanhDoubleTest
+ ["tansingle"] = MathTests.TanSingleTest,
+ ["tanhdouble"] = MathTests.TanhDoubleTest,
+ ["tanhsingle"] = MathTests.TanhSingleTest
};
private static int Main(string[] args)
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.csproj b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.csproj
index 773472d4a4..7e788e356f 100644
--- a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Functions.csproj
@@ -29,8 +29,9 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Functions.cs" />
+ <Compile Include="MathTests.cs" />
<Compile Include="Double\AbsDouble.cs" />
- <Compile Include="Single\AbsSingle.cs" />
<Compile Include="Double\AcosDouble.cs" />
<Compile Include="Double\AsinDouble.cs" />
<Compile Include="Double\AtanDouble.cs" />
@@ -40,10 +41,8 @@
<Compile Include="Double\CoshDouble.cs" />
<Compile Include="Double\ExpDouble.cs" />
<Compile Include="Double\FloorDouble.cs" />
- <Compile Include="Functions.cs" />
<Compile Include="Double\LogDouble.cs" />
<Compile Include="Double\Log10Double.cs" />
- <Compile Include="MathTests.cs" />
<Compile Include="Double\PowDouble.cs" />
<Compile Include="Double\RoundDouble.cs" />
<Compile Include="Double\SinDouble.cs" />
@@ -51,6 +50,25 @@
<Compile Include="Double\SqrtDouble.cs" />
<Compile Include="Double\TanDouble.cs" />
<Compile Include="Double\TanhDouble.cs" />
+ <Compile Include="Single\AbsSingle.cs" />
+ <Compile Include="Single\AcosSingle.cs" />
+ <Compile Include="Single\AsinSingle.cs" />
+ <Compile Include="Single\AtanSingle.cs" />
+ <Compile Include="Single\Atan2Single.cs" />
+ <Compile Include="Single\CeilingSingle.cs" />
+ <Compile Include="Single\CosSingle.cs" />
+ <Compile Include="Single\CoshSingle.cs" />
+ <Compile Include="Single\ExpSingle.cs" />
+ <Compile Include="Single\FloorSingle.cs" />
+ <Compile Include="Single\LogSingle.cs" />
+ <Compile Include="Single\Log10Single.cs" />
+ <Compile Include="Single\PowSingle.cs" />
+ <Compile Include="Single\RoundSingle.cs" />
+ <Compile Include="Single\SinSingle.cs" />
+ <Compile Include="Single\SinhSingle.cs" />
+ <Compile Include="Single\SqrtSingle.cs" />
+ <Compile Include="Single\TanSingle.cs" />
+ <Compile Include="Single\TanhSingle.cs" />
</ItemGroup>
<PropertyGroup>
<ProjectJson>$(JitPackagesConfigFileDirectory)benchmark\project.json</ProjectJson>
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AcosSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AcosSingle.cs
new file mode 100644
index 0000000000..4be2d66b09
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AcosSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Acos(float) over 5000 iterations for the domain -1, +1
+
+ private const float acosSingleDelta = 0.0004f;
+ private const float acosSingleExpectedResult = 7852.41084f;
+
+ [Benchmark]
+ public static void AcosSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ AcosSingleTest();
+ }
+ }
+ }
+
+ public static void AcosSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += acosSingleDelta;
+ result += MathF.Acos(value);
+ }
+
+ var diff = MathF.Abs(acosSingleExpectedResult - result);
+
+ if (diff > floatEpsilon)
+ {
+ throw new Exception($"Expected Result {acosSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AsinSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AsinSingle.cs
new file mode 100644
index 0000000000..e7f67759af
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AsinSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Asin(float) over 5000 iterations for the domain -1, +1
+
+ private const float asinSingleDelta = 0.0004f;
+ private const float asinSingleExpectedResult = 1.57079590f;
+
+ [Benchmark]
+ public static void AsinSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ AsinSingleTest();
+ }
+ }
+ }
+
+ public static void AsinSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += asinSingleDelta;
+ result += MathF.Asin(value);
+ }
+
+ var diff = MathF.Abs(asinSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {asinSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Atan2Single.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Atan2Single.cs
new file mode 100644
index 0000000000..aeef16fded
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Atan2Single.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Atan2(float, float) over 5000 iterations for the domain y: -1, +1; x: +1, -1
+
+ private const float atan2SingleDeltaX = -0.0004f;
+ private const float atan2SingleDeltaY = 0.0004f;
+ private const float atan2SingleExpectedResult = 3926.99082f;
+
+ [Benchmark]
+ public static void Atan2SingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ Atan2SingleTest();
+ }
+ }
+ }
+
+ public static void Atan2SingleTest()
+ {
+ var result = 0.0f; var valueX = 1.0f; var valueY = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ valueX += atan2SingleDeltaX; valueY += atan2SingleDeltaY;
+ result += MathF.Atan2(valueY, valueX);
+ }
+
+ var diff = MathF.Abs(atan2SingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {atan2SingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AtanSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AtanSingle.cs
new file mode 100644
index 0000000000..b0bb8959eb
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/AtanSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Atan(float) over 5000 iterations for the domain -1, +1
+
+ private const float atanSingleDelta = 0.0004f;
+ private const float atanSingleExpectedResult = 0.785398163f;
+
+ [Benchmark]
+ public static void AtanSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ AtanSingleTest();
+ }
+ }
+ }
+
+ public static void AtanSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += atanSingleDelta;
+ result += MathF.Atan(value);
+ }
+
+ var diff = MathF.Abs(atanSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {atanSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CeilingSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CeilingSingle.cs
new file mode 100644
index 0000000000..3362271639
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CeilingSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Ceiling(float) over 5000 iterations for the domain -1, +1
+
+ private const float ceilingSingleDelta = 0.0004f;
+ private const float ceilingSingleExpectedResult = 2500.0f;
+
+ [Benchmark]
+ public static void CeilingSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ CeilingSingleTest();
+ }
+ }
+ }
+
+ public static void CeilingSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += ceilingSingleDelta;
+ result += MathF.Ceiling(value);
+ }
+
+ var diff = MathF.Abs(ceilingSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {ceilingSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CosSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CosSingle.cs
new file mode 100644
index 0000000000..67cad3e4e3
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CosSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Cos(float) over 5000 iterations for the domain 0, PI
+
+ private const float cosSingleDelta = 0.000628318531f;
+ private const float cosSingleExpectedResult = -1.00000000f;
+
+ [Benchmark]
+ public static void CosSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ CosSingleTest();
+ }
+ }
+ }
+
+ public static void CosSingleTest()
+ {
+ var result = 0.0f; var value = 0.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += cosSingleDelta;
+ result += MathF.Cos(value);
+ }
+
+ var diff = MathF.Abs(cosSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {cosSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CoshSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CoshSingle.cs
new file mode 100644
index 0000000000..f6cd207445
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/CoshSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Cosh(float) over 5000 iterations for the domain -1, +1
+
+ private const float coshSingleDelta = 0.0004f;
+ private const float coshSingleExpectedResult = 5876.00605f;
+
+ [Benchmark]
+ public static void CoshSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ CoshSingleTest();
+ }
+ }
+ }
+
+ public static void CoshSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += coshSingleDelta;
+ result += MathF.Cosh(value);
+ }
+
+ var diff = MathF.Abs(coshSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {coshSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/ExpSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/ExpSingle.cs
new file mode 100644
index 0000000000..c68812d068
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/ExpSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Exp(float) over 5000 iterations for the domain -1, +1
+
+ private const float expSingleDelta = 0.0004f;
+ private const float expSingleExpectedResult = 5877.18125f;
+
+ [Benchmark]
+ public static void ExpSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ ExpSingleTest();
+ }
+ }
+ }
+
+ public static void ExpSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += expSingleDelta;
+ result += MathF.Exp(value);
+ }
+
+ var diff = MathF.Abs(expSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {expSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/FloorSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/FloorSingle.cs
new file mode 100644
index 0000000000..524e1f3d25
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/FloorSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Floor(float) over 5000 iterations for the domain -1, +1
+
+ private const float floorSingleDelta = 0.0004f;
+ private const float floorSingleExpectedResult = -2500.0f;
+
+ [Benchmark]
+ public static void FloorSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ FloorSingleTest();
+ }
+ }
+ }
+
+ public static void FloorSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += floorSingleDelta;
+ result += MathF.Floor(value);
+ }
+
+ var diff = MathF.Abs(floorSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {floorSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Log10Single.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Log10Single.cs
new file mode 100644
index 0000000000..c600de992c
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/Log10Single.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Log10(float) over 5000 iterations for the domain -1, +1
+
+ private const float log10SingleDelta = 0.0004f;
+ private const float log10SingleExpectedResult = -664.073849f;
+
+ [Benchmark]
+ public static void Log10SingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ Log10SingleTest();
+ }
+ }
+ }
+
+ public static void Log10SingleTest()
+ {
+ var result = 0.0f; var value = 0.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += log10SingleDelta;
+ result += MathF.Log10(value);
+ }
+
+ var diff = MathF.Abs(log10SingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {log10SingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/LogSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/LogSingle.cs
new file mode 100644
index 0000000000..c0de706f42
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/LogSingle.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Log(float) over 5000 iterations for the domain -1, +1
+
+ private const float logSingleDelta = 0.0004f;
+ private const float logSingleExpectedResult = -1529.08655f;
+
+ [Benchmark]
+ public static void LogSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ LogSingleTest();
+ }
+ }
+ }
+
+ public static void LogSingleTest()
+ {
+ var result = 0.0f; var value = 0.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += logSingleDelta;
+ result += MathF.Log(value);
+ }
+
+ var diff = MathF.Abs(logSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {logSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/PowSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/PowSingle.cs
new file mode 100644
index 0000000000..4ece615e1b
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/PowSingle.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Pow(float, float) over 5000 iterations for the domain x: +2, +1; y: -2, -1
+
+ private const float powSingleDeltaX = -0.0004f;
+ private const float powSingleDeltaY = 0.0004f;
+ private const float powSingleExpectedResult = 4659.46274f;
+
+ [Benchmark]
+ public static void PowSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ PowSingleTest();
+ }
+ }
+ }
+
+ public static void PowSingleTest()
+ {
+ var result = 0.0f; var valueX = 2.0f; var valueY = -2.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ valueX += powSingleDeltaX; valueY += powSingleDeltaY;
+ result += MathF.Pow(valueX, valueY);
+ }
+
+ var diff = MathF.Abs(powSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {powSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/RoundSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/RoundSingle.cs
new file mode 100644
index 0000000000..ea503cbe89
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/RoundSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Round(float) over 5000 iterations for the domain -PI/2, +PI/2
+
+ private const float roundSingleDelta = 0.000628318531f;
+ private const float roundSingleExpectedResult = 2.0f;
+
+ [Benchmark]
+ public static void RoundSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ RoundSingleTest();
+ }
+ }
+ }
+
+ public static void RoundSingleTest()
+ {
+ var result = 0.0f; var value = -1.57079633f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += roundSingleDelta;
+ result += MathF.Round(value);
+ }
+
+ var diff = MathF.Abs(roundSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {roundSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinSingle.cs
new file mode 100644
index 0000000000..b38de7f077
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Sin(float) over 5000 iterations for the domain -PI/2, +PI/2
+
+ private const float sinSingleDelta = 0.000628318531f;
+ private const float sinSingleExpectedResult = 1.00000000f;
+
+ [Benchmark]
+ public static void SinSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ SinSingleTest();
+ }
+ }
+ }
+
+ public static void SinSingleTest()
+ {
+ var result = 0.0f; var value = -1.57079633f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += sinSingleDelta;
+ result += MathF.Sin(value);
+ }
+
+ var diff = MathF.Abs(sinSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {sinSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinhSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinhSingle.cs
new file mode 100644
index 0000000000..8ed2cd54df
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SinhSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Sinh(float) over 5000 iterations for the domain -1, +1
+
+ private const float sinhSingleDelta = 0.0004f;
+ private const float sinhSingleExpectedResult = 1.17520119f;
+
+ [Benchmark]
+ public static void SinhSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ SinhSingleTest();
+ }
+ }
+ }
+
+ public static void SinhSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += sinhSingleDelta;
+ result += MathF.Sinh(value);
+ }
+
+ var diff = MathF.Abs(sinhSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {sinhSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SqrtSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SqrtSingle.cs
new file mode 100644
index 0000000000..d34af173a1
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/SqrtSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Sqrt(float) over 5000 iterations for the domain 0, PI
+
+ private const float sqrtSingleDelta = 0.000628318531f;
+ private const float sqrtSingleExpectedResult = 5909.06053f;
+
+ [Benchmark]
+ public static void SqrtSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ SqrtSingleTest();
+ }
+ }
+ }
+
+ public static void SqrtSingleTest()
+ {
+ var result = 0.0f; var value = 0.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += sqrtSingleDelta;
+ result += MathF.Sqrt(value);
+ }
+
+ var diff = MathF.Abs(sqrtSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {sqrtSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanSingle.cs
new file mode 100644
index 0000000000..bffbd49ead
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Tan(float) over 5000 iterations for the domain -PI/2, +PI/2
+
+ private const float tanSingleDelta = 0.0004f;
+ private const float tanSingleExpectedResult = 1.55740772f;
+
+ [Benchmark]
+ public static void TanSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ TanSingleTest();
+ }
+ }
+ }
+
+ public static void TanSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += tanSingleDelta;
+ result += MathF.Tan(value);
+ }
+
+ var diff = MathF.Abs(tanSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {tanSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanhSingle.cs b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanhSingle.cs
new file mode 100644
index 0000000000..d0487fed83
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Math/Functions/Single/TanhSingle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Microsoft.Xunit.Performance;
+
+namespace Functions
+{
+ public static partial class MathTests
+ {
+ // Tests MathF.Tanh(float) over 5000 iterations for the domain -1, +1
+
+ private const float tanhSingleDelta = 0.0004f;
+ private const float tanhSingleExpectedResult = 0.761594156f;
+
+ [Benchmark]
+ public static void TanhSingleBenchmark()
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ TanhSingleTest();
+ }
+ }
+ }
+
+ public static void TanhSingleTest()
+ {
+ var result = 0.0f; var value = -1.0f;
+
+ for (var iteration = 0; iteration < iterations; iteration++)
+ {
+ value += tanhSingleDelta;
+ result += MathF.Tanh(value);
+ }
+
+ var diff = MathF.Abs(tanhSingleExpectedResult - result);
+
+ if (diff > singleEpsilon)
+ {
+ throw new Exception($"Expected Result {tanhSingleExpectedResult}; Actual Result {result}");
+ }
+ }
+ }
+}