Skip to content

Commit 2dc19e2

Browse files
authored
[RyuJIT] Propagate gtFlags in Vector.Create (#43578)
Propagate GTF_CALL if needed in GT_LIST. Use gtNewListNode. Ignore test for Mono
1 parent 247212f commit 2dc19e2

File tree

5 files changed

+93
-6
lines changed

5 files changed

+93
-6
lines changed

src/coreclr/src/jit/hwintrinsicarm64.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,10 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
396396

397397
for (unsigned i = 0; i < sig->numArgs; i++)
398398
{
399-
tmp = gtNewArgList(impPopStack().val);
400-
tmp->gtOp2 = op1;
401-
op1 = tmp;
399+
tmp = gtNewListNode(impPopStack().val, tmp);
402400
}
403401

402+
op1 = tmp;
404403
retNode = gtNewSimdHWIntrinsicNode(retType, op1, intrinsic, baseType, simdSize);
405404
}
406405
break;

src/coreclr/src/jit/hwintrinsicxarch.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,11 +774,10 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic,
774774

775775
for (unsigned i = 0; i < sig->numArgs; i++)
776776
{
777-
tmp = gtNewArgList(impPopStack().val);
778-
tmp->gtOp2 = op1;
779-
op1 = tmp;
777+
tmp = gtNewListNode(impPopStack().val, tmp);
780778
}
781779

780+
op1 = tmp;
782781
retNode = gtNewSimdHWIntrinsicNode(retType, op1, intrinsic, baseType, simdSize);
783782
}
784783
break;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
using System.Runtime.CompilerServices;
5+
using System.Runtime.Intrinsics;
6+
7+
namespace GitHub_43569
8+
{
9+
class Program
10+
{
11+
public static int Main()
12+
{
13+
if ((int)Vector64_Create_short(100) != 100)
14+
return 1;
15+
if ((int)Vector128_Create_float(100) != 100)
16+
return 2;
17+
if ((int)Vector128_Create_byte(100) != 100)
18+
return 3;
19+
if ((int)Vector256_Create_float(100) != 100)
20+
return 4;
21+
if ((int)Vector256_Create_double(100) != 100)
22+
return 5;
23+
return 100;
24+
}
25+
26+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
27+
public static T Inline<T>(T t) => t;
28+
29+
[MethodImpl(MethodImplOptions.NoInlining)]
30+
public static short Vector64_Create_short(short a)
31+
{
32+
Vector64<short> x = default;
33+
for (int i = 0; i < 1; i++)
34+
x = Vector64.Create(1, 2, 3, Inline(a));
35+
return x.GetElement(3);
36+
}
37+
38+
[MethodImpl(MethodImplOptions.NoInlining)]
39+
public static float Vector128_Create_float(float a)
40+
{
41+
Vector128<float> x = default;
42+
for (int i = 0; i < 1; i++)
43+
x = Vector128.Create(1, 2, 3, Inline(a));
44+
return x.GetElement(3);
45+
}
46+
47+
[MethodImpl(MethodImplOptions.NoInlining)]
48+
public static byte Vector128_Create_byte(byte a)
49+
{
50+
Vector128<byte> x = default;
51+
for (int i = 0; i < 1; i++)
52+
x = Vector128.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, Inline(a));
53+
return x.GetElement(15);
54+
}
55+
56+
[MethodImpl(MethodImplOptions.NoInlining)]
57+
public static float Vector256_Create_float(float a)
58+
{
59+
Vector256<float> x = default;
60+
for (int i = 0; i < 1; i++)
61+
x = Vector256.Create(1, 2, 3, 4, 5, 6, 7, Inline(a));
62+
return x.GetElement(7);
63+
}
64+
65+
[MethodImpl(MethodImplOptions.NoInlining)]
66+
public static double Vector256_Create_double(double a)
67+
{
68+
Vector256<double> x = default;
69+
for (int i = 0; i < 1; i++)
70+
x = Vector256.Create(1, 2, 3, Inline(a));
71+
return x.GetElement(3);
72+
}
73+
}
74+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
<PropertyGroup>
6+
<DebugType>Embedded</DebugType>
7+
<Optimize>True</Optimize>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<Compile Include="GitHub_43569.cs" />
11+
</ItemGroup>
12+
</Project>

src/tests/issues.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,9 @@
11751175

11761176
<!-- Known failures for mono runtime on *all* architectures/operating systems -->
11771177
<ItemGroup Condition="'$(RuntimeFlavor)' == 'mono'" >
1178+
<ExcludeList Include="$(XunitTestBinBase)/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/**">
1179+
<Issue>https://github.com/dotnet/runtime/issues/43676</Issue>
1180+
</ExcludeList>
11781181
<ExcludeList Include="$(XunitTestBinBase)/baseservices/TieredCompilation/BasicTestWithMcj/*">
11791182
<Issue>Tests features specific to coreclr</Issue>
11801183
</ExcludeList>

0 commit comments

Comments
 (0)