diff --git a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp index fdf6e0b0058a06..cb6d1821e3f034 100644 --- a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp @@ -1090,18 +1090,12 @@ void CodeGen::genHWIntrinsic_R_R_RM_I( assert(targetReg != REG_NA); - if (op2->isContained() || op2->isUsedFromSpillTemp()) - { - assert(HWIntrinsicInfo::SupportsContainment(node->GetHWIntrinsicId())); - assertIsContainableHWIntrinsicOp(compiler->m_pLowering, node, op2); - } - if (ins == INS_insertps) { - if (op1Reg == REG_NA) + if (op1->isContained()) { // insertps is special and can contain op1 when it is zero - assert(op1->isContained() && op1->IsVectorZero()); + assert(op1->IsVectorZero()); op1Reg = targetReg; } @@ -1115,6 +1109,12 @@ void CodeGen::genHWIntrinsic_R_R_RM_I( } } + if (op2->isContained() || op2->isUsedFromSpillTemp()) + { + assert(HWIntrinsicInfo::SupportsContainment(node->GetHWIntrinsicId())); + assertIsContainableHWIntrinsicOp(compiler->m_pLowering, node, op2); + } + assert(op1Reg != REG_NA); bool isRMW = node->isRMWHWIntrinsic(compiler); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.cs b/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.cs new file mode 100644 index 00000000000000..909de7fc3e2640 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; +using System.Numerics; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +// Generated by Fuzzlyn v1.7 on 2024-07-25 11:29:20 +// Run on X64 Windows +// 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 +// Reduced from 159.4 KiB to 0.4 KiB in 00:00:57 +// Hits JIT assert in Release: +// Assertion failed 'isContainable || supportsRegOptional' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Generate code' (IL size 47; hash 0xade6b36b; FullOpts) +// +// File: C:\dev\dotnet\runtime4\src\coreclr\jit\hwintrinsiccodegenxarch.cpp Line: 61 +// + +public class Runtime_105467 +{ + public static Vector128[] s_6 = new []{ Vector128.Zero }; + + [Fact] + public static void TestEntryPoint() + { + if (Sse41.IsSupported) + { + var vr3 = s_6[0]; + var vr4 = Vector128.Create(0); + s_6[0] = Sse41.Insert(vr3, vr4, 254); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_105467/Runtime_105467.csproj @@ -0,0 +1,8 @@ + + + True + + + + +