diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index 3adeccf516fd1..83d67383da264 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -3901,7 +3901,7 @@ GenTree* Lowering::LowerHWIntrinsicTernaryLogic(GenTreeHWIntrinsic* node) std::swap(node->Op(1), node->Op(2)); // Make sure we also fixup the control byte - control = TernaryLogicInfo::GetTernaryControlByte(info, C, A, B); + control = TernaryLogicInfo::GetTernaryControlByte(info, B, C, A); op4->AsIntCon()->SetIconValue(control); useFlags = TernaryLogicUseFlags::BC; diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.cs b/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.cs new file mode 100644 index 0000000000000..e9efb711716fe --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Found by Antigen +// Reduced from 20.86 KB to 1.7 KB. +// JIT assert failed: +// Assertion failed 'unreached' in 'Runtime_107587:Method0():this' during 'Lowering nodeinfo' (IL size 133; hash 0x46e9aa75; FullOpts) + + // File: D:\a\_work\1\s\src\coreclr\jit\lowerxarch.cpp Line: 11752 + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.Arm; +using System.Runtime.Intrinsics.X86; +using System.Numerics; +using Xunit; + +public class Runtime_107587 +{ + static Vector512 s_v512_sbyte_42 = Vector512.Create((sbyte)92); + public Vector512 Method0() + { + byte byte_152 = 3; + return Avx512F.TernaryLogic(s_v512_sbyte_42, s_v512_sbyte_42, s_v512_sbyte_42, byte_152); + } + + [Fact] + public static void TestEntryPoint() + { + if (Avx512F.IsSupported) + { + new Runtime_107587().Method0(); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.csproj new file mode 100644 index 0000000000000..de6d5e08882e8 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_107587/Runtime_107587.csproj @@ -0,0 +1,8 @@ + + + True + + + + +