Skip to content

Commit 248d6f4

Browse files
authored
JIT: Fix containment check for decomposed long halves in CreateScalar (#114654)
* fix containment check for decomposed long halves in CreateScalar * add IsSupported check to test
1 parent 01108e8 commit 248d6f4

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

src/coreclr/jit/lowerxarch.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9893,7 +9893,8 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
98939893

98949894
for (GenTree* longOp : op1->Operands())
98959895
{
9896-
if (IsContainableMemoryOp(longOp) && IsSafeToContainMem(node, longOp))
9896+
if (!varTypeIsSmall(longOp) && IsContainableMemoryOp(longOp) &&
9897+
IsSafeToContainMem(node, longOp))
98979898
{
98989899
MakeSrcContained(node, longOp);
98999900
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
// Generated by Fuzzlyn v2.5 on 2025-04-11 19:36:22
5+
// Run on X86 Windows
6+
// Seed: 2880609996874211534-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base
7+
// Reduced from 130.6 KiB to 0.9 KiB in 00:04:12
8+
// Hits JIT assert in Release:
9+
// Assertion failed 'isContainable || supportsRegOptional' in 'Program:M8():System.Runtime.Intrinsics.Vector128`1[ulong]' during 'Generate code' (IL size 39; hash 0x72979674; FullOpts)
10+
using System;
11+
using System.Runtime.Intrinsics;
12+
using System.Runtime.Intrinsics.X86;
13+
using Xunit;
14+
15+
public class Runtime_114570
16+
{
17+
public static IRuntime s_rt = new Runtime();
18+
public static byte s_1;
19+
public static Vector128<sbyte> s_17;
20+
public static uint s_22;
21+
22+
[Fact]
23+
public static void Problem()
24+
{
25+
if (Bmi1.IsSupported)
26+
{
27+
var vr17 = M8();
28+
}
29+
}
30+
31+
public static Vector128<ulong> M8()
32+
{
33+
var vr6 = Vector128.Create(0, 0, s_22, 0);
34+
var vr3 = (ulong)Bmi1.AndNot(0, M23(vr6, ref s_17));
35+
return Vector128.CreateScalar(vr3);
36+
}
37+
38+
public static ref byte M23(Vector128<uint> arg0, ref Vector128<sbyte> arg1)
39+
{
40+
s_rt.WriteLine(arg0);
41+
return ref s_1;
42+
}
43+
}
44+
45+
public interface IRuntime
46+
{
47+
void WriteLine<T>(T value);
48+
}
49+
50+
public class Runtime : IRuntime
51+
{
52+
public void WriteLine<T>(T value) => Console.WriteLine(value);
53+
}
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)