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/FPConvI2F.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/FPConvI2F.cs')
-rw-r--r-- | tests/src/JIT/CodeGenBringUpTests/FPConvI2F.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/src/JIT/CodeGenBringUpTests/FPConvI2F.cs b/tests/src/JIT/CodeGenBringUpTests/FPConvI2F.cs new file mode 100644 index 0000000000..4c1cae73e8 --- /dev/null +++ b/tests/src/JIT/CodeGenBringUpTests/FPConvI2F.cs @@ -0,0 +1,67 @@ +// 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 FPConvI2F(int x) { return (float) x; } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static double FPConvI2F(UInt32 x) { return (double) x; } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static double FPConvI2F(long x) { return (double)x; } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static double FPConvI2F(UInt64 x) { return (double)x; } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static float FPConvI2F(byte x) { return (float)x; } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static float FPConvI2F(Int16 x) { return (float)x; } + + public static int Main() + { + int result = Fail; + float x = FPConvI2F((int)3); + Console.WriteLine(x); + if (Math.Abs(x-3f) <= Single.Epsilon) result = Pass; + + int result2 = Fail; + double y = FPConvI2F((UInt32)5); + Console.WriteLine(y); + if (Math.Abs(y-5d) <= Double.Epsilon) result2 = Pass; + + int result3 = Fail; + y = FPConvI2F(12345L); + Console.WriteLine(y); + if (Math.Abs(y - 12345d) <= Double.Epsilon) result3 = Pass; + + int result4 = Fail; + x = FPConvI2F((byte)3); + Console.WriteLine(x); + if (Math.Abs(x - 3f) <= Single.Epsilon) result4 = Pass; + + int result5 = Fail; + x = FPConvI2F((Int16)3); + Console.WriteLine(x); + if (Math.Abs(x - 3f) <= Single.Epsilon) result5 = Pass; + + int result6 = Fail; + y = FPConvI2F(12345UL); + Console.WriteLine(y); + if (Math.Abs(y - 12345d) <= Double.Epsilon) result6 = Pass; + + if (result == Pass && result2 == Pass && result3 == Pass && result4 == Pass && result5 == Pass && result6 == Pass) return Pass; + return Fail; + + } +} |