Skip to content

Commit 2a63c9d

Browse files
[release/7.0] Ensure that the shuffle zero mask copies all bits (#86453)
* Ensure that the shuffle zero mask copies all bits * Ensure we don't try to validate Vector512 on .NET 7 as it is a .NET 8 API * Don't remove too many braces from the test * Don't use the xunit based test approach that was introduced in the .NET 8 branch
1 parent a12825a commit 2a63c9d

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

src/coreclr/jit/gentree.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21830,13 +21830,11 @@ GenTree* Compiler::gtNewSimdShuffleNode(var_types type,
2183021830

2183121831
if (needsZero)
2183221832
{
21833-
assert(!compIsaSupportedDebugOnly(InstructionSet_SSSE3));
21833+
assert((simdSize == 32) || !compIsaSupportedDebugOnly(InstructionSet_SSSE3));
2183421834

2183521835
op2 = gtNewVconNode(type, simdBaseJitType);
21836-
op2->AsVecCon()->gtSimd16Val = mskCns.v128[0];
21837-
21838-
GenTree* zero = gtNewZeroConNode(type, simdBaseJitType);
21839-
retNode = gtNewSimdCndSelNode(type, op2, retNode, zero, simdBaseJitType, simdSize, isSimdAsHWIntrinsic);
21836+
op2->AsVecCon()->gtSimd32Val = mskCns;
21837+
retNode = gtNewSimdBinOpNode(GT_AND, type, op2, retNode, simdBaseJitType, simdSize, isSimdAsHWIntrinsic);
2184021838
}
2184121839

2184221840
return retNode;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
using System.Runtime.Intrinsics;
9+
using Xunit;
10+
11+
public class Program_85129
12+
{
13+
public static int Main()
14+
{
15+
Vector256<int> v256Shuffle = Vector256.Create(100, 101, 102, 103, 104, 105, 106, 107);
16+
Vector256<int> v256ShuffleExpectedResult = Vector256.Create(107, 105, 0, 101, 106, 104, 0, 100);
17+
Vector256<int> v256ShuffleActualResult = Vector256Shuffle(v256Shuffle);
18+
if(v256ShuffleExpectedResult != v256ShuffleActualResult)
19+
{
20+
return 1;
21+
}
22+
23+
return 100;
24+
}
25+
26+
27+
[MethodImpl(MethodImplOptions.NoInlining)]
28+
public static Vector256<int> Vector256Shuffle(Vector256<int> v1)
29+
{
30+
return Vector256.Shuffle(v1, Vector256.Create(7, 5, 132, 1, 6, 4, -3, 0));
31+
}
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
<PropertyGroup>
6+
<DebugType>PdbOnly</DebugType>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<Compile Include="$(MSBuildProjectName).cs" />
10+
</ItemGroup>
11+
</Project>

0 commit comments

Comments
 (0)