From 2d5b3b3727d1cbec30a31643f8f0335e7a3c3a4d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:10:54 -0700 Subject: [PATCH] JIT: Skip Create(ToScalar(Dot(...))) transformation on mismatched types (#91089) Fix #91062 Co-authored-by: Jakob Botsch Nielsen --- src/coreclr/jit/morph.cpp | 6 ++++++ .../JitBlue/Runtime_91062/Runtime_91062.cs | 22 ++++++++++++++++++++++ .../JitBlue/Runtime_91062/Runtime_91062.csproj | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.csproj diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index f29d6a5..52454b0 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -10770,6 +10770,12 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node) break; } + // Must be working with the same types of vectors. + if (hwop1->TypeGet() != node->TypeGet()) + { + break; + } + if (toScalar != nullptr) { DEBUG_DESTROY_NODE(toScalar); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.cs b/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.cs new file mode 100644 index 0000000..8886bd2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license.aa + +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Numerics; +using Xunit; + +public class Runtime_91062 +{ + [Fact] + public static void TestEntryPoint() + { + Foo(default, default); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static Vector2 Foo(Vector128 v1, Vector128 v2) + { + return Vector2.Lerp(default, default, Vector128.Dot(v1, v2)); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.csproj new file mode 100644 index 0000000..de6d5e0 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_91062/Runtime_91062.csproj @@ -0,0 +1,8 @@ + + + True + + + + + -- 2.7.4