diff options
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs new file mode 100644 index 0000000000..631175a38e --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs @@ -0,0 +1,49 @@ +// 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 System.Runtime.CompilerServices; + +// This test is a reduced repro case for DevDiv VSO bug 278365. +// The failure mode is that the RyuJIT/x86 backend changed call to ROUND intrinsic +// with double return type to ROUND intrinsic with int return type, that is not supported. + +internal class Program +{ + [MethodImpl(MethodImplOptions.NoInlining)] + public static int Bar() + { + int sum = 0; + for (int i = 0; i < 100; ++i) + { + int v = (int)Math.Round(4.4 + i); + sum += v; + } + sum -= 4 * 100; + if (sum != 100 * 99 / 2) + { + return 0; + } + else + { + return 100; + } + } + + private static int Main(string[] args) + { + try + { + if (Bar() != 100) + return 0; + } + catch (Exception) + { + } + + Console.WriteLine("Pass"); + return 100; + } +} |