Skip to content

Commit

Permalink
[release/9.0] Fix embedded broadcasts for MaybeIMM instructions (#106802
Browse files Browse the repository at this point in the history
)

* Fix embedded broadcasts for MaybeIMM instructions

* Update gentree.cpp

* Update Runtime_106355.cs

---------

Co-authored-by: EgorBo <egorbo@gmail.com>
Co-authored-by: Jeff Schwartz <jeffschw@microsoft.com>
  • Loading branch information
3 people authored Aug 22, 2024
1 parent 562efd6 commit f284a31
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27008,6 +27008,13 @@ bool GenTreeHWIntrinsic::OperIsEmbBroadcastCompatible() const
NamedIntrinsic intrinsicId = GetHWIntrinsicId();
var_types simdBaseType = GetSimdBaseType();

// MaybeImm intrinsics support embedded broadcasts only for their IMM variants (e.g. PSLLQ)
if (HWIntrinsicInfo::MaybeImm(intrinsicId) &&
!HWIntrinsicInfo::isImmOp(intrinsicId, GetOperandArray()[GetOperandCount() - 1]))
{
return false;
}

switch (intrinsicId)
{
case NI_AVX512F_ConvertToVector256Int32:
Expand Down
33 changes: 33 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// Generated by Fuzzlyn v2.2 on 2024-08-13 16:48:33
// Run on X64 Windows
// Seed: 4942966914089696094-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 83.3 KiB to 0.4 KiB in 00:12:10
// Exits with error:
// Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
// at Program.Main(Fuzzlyn.ExecutionServer.IRuntime)
// at Fuzzlyn.ExecutionServer.Program.<RunPairAsync>g__RunAndGetResultAsync|1_0(Byte[], <>c__DisplayClass1_0 ByRef)
// at Fuzzlyn.ExecutionServer.Program.RunPairAsync(System.Runtime.Loader.AssemblyLoadContext, Fuzzlyn.ExecutionServer.ProgramPair)
// at Fuzzlyn.ExecutionServer.Program+<>c__DisplayClass0_0.<Main>b__0()
//
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using Xunit;

public class Runtime_106355
{
private static ulong s_3;
private static Vector128<ulong> s_5;

[Fact]
public static void TestEntrypoint()
{
if (Sse2.IsSupported)
{
s_5 = Sse2.ShiftLeftLogical(s_5, Vector128.Create<ulong>(s_3));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>

0 comments on commit f284a31

Please sign in to comment.