Skip to content

Commit c2da91e

Browse files
github-actions[bot]kunalspathakjeffschwMSFT
authored
[release/9.0] Arm64: Use TYP_SIMD8 for AddAcross (#108805)
* Use TYP_SIMD8 for AddAcross intrinsics * add test cases * Mark non interesting method private * Remove method params * wrap test code in try-catch --------- Co-authored-by: Kunal Pathak <[email protected]> Co-authored-by: Jeff Schwartz <[email protected]>
1 parent b030c4d commit c2da91e

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

src/coreclr/jit/gentree.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -25595,7 +25595,7 @@ GenTree* Compiler::gtNewSimdSumNode(var_types type, GenTree* op1, CorInfoType si
2559525595
case TYP_SHORT:
2559625596
case TYP_USHORT:
2559725597
{
25598-
tmp = gtNewSimdHWIntrinsicNode(simdType, op1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, simdSize);
25598+
tmp = gtNewSimdHWIntrinsicNode(TYP_SIMD8, op1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, simdSize);
2559925599
return gtNewSimdToScalarNode(type, tmp, simdBaseJitType, 8);
2560025600
}
2560125601

@@ -25609,7 +25609,7 @@ GenTree* Compiler::gtNewSimdSumNode(var_types type, GenTree* op1, CorInfoType si
2560925609
}
2561025610
else
2561125611
{
25612-
tmp = gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, 16);
25612+
tmp = gtNewSimdHWIntrinsicNode(TYP_SIMD8, op1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, 16);
2561325613
}
2561425614
return gtNewSimdToScalarNode(type, tmp, simdBaseJitType, 8);
2561525615
}

src/coreclr/jit/lowerarmarch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,7 @@ GenTree* Lowering::LowerHWIntrinsicDot(GenTreeHWIntrinsic* node)
26112611
// ...
26122612

26132613
tmp2 =
2614-
comp->gtNewSimdHWIntrinsicNode(simdType, tmp1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, simdSize);
2614+
comp->gtNewSimdHWIntrinsicNode(TYP_SIMD8, tmp1, NI_AdvSimd_Arm64_AddAcross, simdBaseJitType, simdSize);
26152615
BlockRange().InsertAfter(tmp1, tmp2);
26162616
LowerNode(tmp2);
26172617
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
// Found by Antigen
5+
// Reduced from 18.05 KB to 1.2 KB.
6+
// JIT assert failed:
7+
// Assertion failed 'm_store->TypeGet() == m_src->TypeGet()' in 'TestClass:Method0():this' during 'Assertion prop' (IL size 91; hash 0x46e9aa75; FullOpts)
8+
//
9+
// File: /Users/runner/work/1/s/src/coreclr/jit/morphblock.cpp Line: 665
10+
11+
12+
using System;
13+
using System.Collections.Generic;
14+
using System.Runtime.CompilerServices;
15+
using System.Runtime.Intrinsics;
16+
using System.Runtime.Intrinsics.Arm;
17+
using System.Runtime.Intrinsics.X86;
18+
using System.Numerics;
19+
using Xunit;
20+
21+
public class Runtime_108612
22+
{
23+
static Vector128<byte> s_v128_byte_27 = Vector128.CreateScalar((byte)0);
24+
static Vector128<int> s_v128_int_31 = Vector128<int>.Zero;
25+
static Vector128<uint> s_v128_uint_32 = Vector128.CreateScalar((uint)5);
26+
Vector64<byte> v64_byte_67 = Vector64.CreateScalar((byte)5);
27+
Vector128<int> v128_int_81 = Vector128.Create(-1, 6, 2, 1);
28+
private static List<string> toPrint = new List<string>();
29+
private void Method0()
30+
{
31+
unchecked
32+
{
33+
v128_int_81 = AdvSimd.NegateSaturate(s_v128_int_31 *= 15|4);
34+
s_v128_uint_32 = AdvSimd.ShiftRightLogicalRounded(s_v128_uint_32, Vector128.Sum(s_v128_byte_27 | s_v128_byte_27));
35+
v64_byte_67 = AdvSimd.Arm64.AddAcross(s_v128_byte_27 | s_v128_byte_27);
36+
return;
37+
}
38+
}
39+
40+
[Fact]
41+
public static void TestEntryPoint()
42+
{
43+
if (AdvSimd.IsSupported)
44+
{
45+
Antigen();
46+
}
47+
}
48+
49+
private static int Antigen()
50+
{
51+
try
52+
{
53+
new Runtime_108612().Method0();
54+
}
55+
catch (Exception e) { }
56+
return string.Join(Environment.NewLine, toPrint).GetHashCode();
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<Optimize>True</Optimize>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<Compile Include="$(MSBuildProjectName).cs" />
7+
</ItemGroup>
8+
</Project>

0 commit comments

Comments
 (0)