Skip to content

Commit 06ac04f

Browse files
authored
JIT: Fix genHWIntrinsic_R_R_RM_I assertion handling when ins is INS_insertps (dotnet#106100)
* Fix genHWIntrinsic_R_R_RM_I assertion handling when ins is INS_insertps * Feedback * Feedback
1 parent c4293b6 commit 06ac04f

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

src/coreclr/jit/hwintrinsiccodegenxarch.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,18 +1090,12 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(
10901090

10911091
assert(targetReg != REG_NA);
10921092

1093-
if (op2->isContained() || op2->isUsedFromSpillTemp())
1094-
{
1095-
assert(HWIntrinsicInfo::SupportsContainment(node->GetHWIntrinsicId()));
1096-
assertIsContainableHWIntrinsicOp(compiler->m_pLowering, node, op2);
1097-
}
1098-
10991093
if (ins == INS_insertps)
11001094
{
1101-
if (op1Reg == REG_NA)
1095+
if (op1->isContained())
11021096
{
11031097
// insertps is special and can contain op1 when it is zero
1104-
assert(op1->isContained() && op1->IsVectorZero());
1098+
assert(op1->IsVectorZero());
11051099
op1Reg = targetReg;
11061100
}
11071101

@@ -1115,6 +1109,12 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(
11151109
}
11161110
}
11171111

1112+
if (op2->isContained() || op2->isUsedFromSpillTemp())
1113+
{
1114+
assert(HWIntrinsicInfo::SupportsContainment(node->GetHWIntrinsicId()));
1115+
assertIsContainableHWIntrinsicOp(compiler->m_pLowering, node, op2);
1116+
}
1117+
11181118
assert(op1Reg != REG_NA);
11191119

11201120
bool isRMW = node->isRMWHWIntrinsic(compiler);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Runtime.CompilerServices;
6+
using System.Numerics;
7+
using System.Runtime.Intrinsics;
8+
using System.Runtime.Intrinsics.X86;
9+
using Xunit;
10+
11+
// Generated by Fuzzlyn v1.7 on 2024-07-25 11:29:20
12+
// Run on X64 Windows
13+
// Seed: 17281006834984098297-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
14+
// Reduced from 159.4 KiB to 0.4 KiB in 00:00:57
15+
// Hits JIT assert in Release:
16+
// Assertion failed 'isContainable || supportsRegOptional' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Generate code' (IL size 47; hash 0xade6b36b; FullOpts)
17+
//
18+
// File: C:\dev\dotnet\runtime4\src\coreclr\jit\hwintrinsiccodegenxarch.cpp Line: 61
19+
//
20+
21+
public class Runtime_105467
22+
{
23+
public static Vector128<float>[] s_6 = new []{ Vector128<float>.Zero };
24+
25+
[Fact]
26+
public static void TestEntryPoint()
27+
{
28+
if (Sse41.IsSupported)
29+
{
30+
var vr3 = s_6[0];
31+
var vr4 = Vector128.Create<float>(0);
32+
s_6[0] = Sse41.Insert(vr3, vr4, 254);
33+
}
34+
}
35+
}
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)