diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index dad1df9ffcfb76..8f3150e7e7b18e 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -8292,7 +8292,7 @@ bool Lowering::IsContainableHWIntrinsicOp(GenTreeHWIntrinsic* parentNode, GenTre return false; } - return parentNode->OperIsEmbBroadcastCompatible(); + return parentNode->OperIsEmbBroadcastCompatible() && comp->canUseEvexEncoding(); } default: diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.cs b/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.cs new file mode 100644 index 00000000000000..15fe1b0f93842b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.cs @@ -0,0 +1,34 @@ +// 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.Intrinsics; +using System.Runtime.Intrinsics.X86; +using System.Runtime.CompilerServices; +using Xunit; + +public class Runtime_96156 +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private unsafe static Vector128 BroadcastScalarToVector128(float value) + { + return Avx.BroadcastScalarToVector128(&value); + } + + [Fact] + public static void TestEntryPoint() + { + if (Avx.IsSupported) + { + Vector128 c = Vector128.Create(1.0f); + Vector128 r = Problem(2.0f, 0.5f, c); + Assert.Equal(Vector128.Create(4.0f), r); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static Vector128 Problem(float a, float b, Vector128 c) + { + return Avx.Multiply(c, BroadcastScalarToVector128(a / b)); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.csproj new file mode 100644 index 00000000000000..37d1a42b02dbe1 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_96156/Runtime_96156.csproj @@ -0,0 +1,13 @@ + + + True + True + + + + + + + + +