From 140e519ef8fe494ac794f4d050dd87c23dc85f22 Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Tue, 5 Mar 2019 17:32:13 -0800 Subject: Correctly type SIMD stack values When `impSIMDPopStack` pops a struct value, it needs to retype the `OBJ` if it exists and doesn't match. Fix #22850 --- .../JitBlue/GitHub_22850/GitHub_22850.cs | 43 ++++++++++++++++++++++ .../JitBlue/GitHub_22850/GitHub_22850.csproj | 34 +++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.cs create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.csproj (limited to 'tests') diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.cs b/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.cs new file mode 100644 index 0000000000..664d1c1943 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.cs @@ -0,0 +1,43 @@ +// 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; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; + +public static class GitHub_22850 +{ + static int Main(string[] args) + { + return test128((byte)90) ? 100 : -1; + } + + static unsafe bool test128(int i) + { + Vector128 v = Vector128.Create(i); + return MyEquals(ref v, Vector128.Create(i)); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static bool MyEquals(ref Vector128 left, Vector128 right) + { + if (Sse2.IsSupported) + { + Vector128 result = MyCompareEqual(left.AsByte(), right.AsByte()); + return Sse2.MoveMask(result) == 0b1111_1111_1111_1111; // We have one bit per element + } + + return true; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static Vector128 MyCompareEqual(this Vector128 left, Vector128 right) + { + return Sse2.CompareEqual(left, right); + } +} + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.csproj new file mode 100644 index 0000000000..5b28be0c3a --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_22850/GitHub_22850.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {2649FAFE-07BF-4F93-8120-BA9A69285ABB} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + None + False + True + + + + False + + + + + + + + + + + -- cgit v1.2.3