diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2015-01-30 14:14:42 -0800 |
---|---|---|
committer | dotnet-bot <dotnet-bot@microsoft.com> | 2015-01-30 14:14:42 -0800 |
commit | ef1e2ab328087c61a6878c1e84f4fc5d710aebce (patch) | |
tree | dee1bbb89e9d722e16b0d1485e3cdd1b6c8e2cfa /tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs | |
download | coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.tar.gz coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.tar.bz2 coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.zip |
Initial commit to populate CoreCLR repo
[tfs-changeset: 1407945]
Diffstat (limited to 'tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs')
-rw-r--r-- | tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs b/tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs new file mode 100644 index 0000000000..acdc27094e --- /dev/null +++ b/tests/src/JIT/CodeGenBringUpTests/FPFillArray.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + + +using System; +using System.Runtime.CompilerServices; +public class BringUpTest +{ + const int Pass = 100; + const int Fail = -1; + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static float FPArray(float []x) + { + float sum = 0; + for (int i=0; i < x.Length; ++i) + sum += x[i]; + + return sum / x.Length; + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static int FPFillArray(float []x, int start, int end, float y) + { + for (int i=start; i< end; ++i) + x[i] = y++; + + return end-start; + } + + public static int Main() + { + float []arr = new float[5]; + if (FPFillArray(arr, 0, arr.Length, 1f) != arr.Length) return Fail; + float y = FPArray(arr); + Console.WriteLine(y); + if (System.Math.Abs(y-3f) <= Single.Epsilon) return Pass; + else return Fail; + } +} |