Skip to content

Commit 2d5b3b3

Browse files
JIT: Skip Create(ToScalar(Dot(...))) transformation on mismatched types (#91089)
Fix #91062 Co-authored-by: Jakob Botsch Nielsen <[email protected]>
1 parent 562a16a commit 2d5b3b3

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/coreclr/jit/morph.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10770,6 +10770,12 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node)
1077010770
break;
1077110771
}
1077210772

10773+
// Must be working with the same types of vectors.
10774+
if (hwop1->TypeGet() != node->TypeGet())
10775+
{
10776+
break;
10777+
}
10778+
1077310779
if (toScalar != nullptr)
1077410780
{
1077510781
DEBUG_DESTROY_NODE(toScalar);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.aa
3+
4+
using System.Runtime.CompilerServices;
5+
using System.Runtime.Intrinsics;
6+
using System.Numerics;
7+
using Xunit;
8+
9+
public class Runtime_91062
10+
{
11+
[Fact]
12+
public static void TestEntryPoint()
13+
{
14+
Foo(default, default);
15+
}
16+
17+
[MethodImpl(MethodImplOptions.NoInlining)]
18+
private static Vector2 Foo(Vector128<float> v1, Vector128<float> v2)
19+
{
20+
return Vector2.Lerp(default, default, Vector128.Dot(v1, v2));
21+
}
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<Optimize>True</Optimize>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<Compile Include="$(MSBuildProjectName).cs" />
7+
</ItemGroup>
8+
</Project>

0 commit comments

Comments
 (0)