diff --git a/src/coreclr/src/jit/hwintrinsicarm64.cpp b/src/coreclr/src/jit/hwintrinsicarm64.cpp index c572f9bf0888a..0d0021b0b8c65 100644 --- a/src/coreclr/src/jit/hwintrinsicarm64.cpp +++ b/src/coreclr/src/jit/hwintrinsicarm64.cpp @@ -396,11 +396,10 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, for (unsigned i = 0; i < sig->numArgs; i++) { - tmp = gtNewArgList(impPopStack().val); - tmp->gtOp2 = op1; - op1 = tmp; + tmp = gtNewListNode(impPopStack().val, tmp); } + op1 = tmp; retNode = gtNewSimdHWIntrinsicNode(retType, op1, intrinsic, baseType, simdSize); } break; diff --git a/src/coreclr/src/jit/hwintrinsicxarch.cpp b/src/coreclr/src/jit/hwintrinsicxarch.cpp index e624f18e713f9..141daafa04c98 100644 --- a/src/coreclr/src/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/src/jit/hwintrinsicxarch.cpp @@ -774,11 +774,10 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, for (unsigned i = 0; i < sig->numArgs; i++) { - tmp = gtNewArgList(impPopStack().val); - tmp->gtOp2 = op1; - op1 = tmp; + tmp = gtNewListNode(impPopStack().val, tmp); } + op1 = tmp; retNode = gtNewSimdHWIntrinsicNode(retType, op1, intrinsic, baseType, simdSize); } break; diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index 93e41277711a0..fb858164cb405 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -955,6 +955,12 @@ + + https://github.com/dotnet/runtime/issues/43676 + + + Tests features specific to coreclr + https://github.com/dotnet/runtime/issues/40394 diff --git a/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.cs b/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.cs new file mode 100644 index 0000000000000..c0602c46385c7 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; + +namespace GitHub_43569 +{ + class Program + { + public static int Main() + { + if ((int)Vector64_Create_short(100) != 100) + return 1; + if ((int)Vector128_Create_float(100) != 100) + return 2; + if ((int)Vector128_Create_byte(100) != 100) + return 3; + if ((int)Vector256_Create_float(100) != 100) + return 4; + if ((int)Vector256_Create_double(100) != 100) + return 5; + return 100; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T Inline(T t) => t; + + [MethodImpl(MethodImplOptions.NoInlining)] + public static short Vector64_Create_short(short a) + { + Vector64 x = default; + for (int i = 0; i < 1; i++) + x = Vector64.Create(1, 2, 3, Inline(a)); + return x.GetElement(3); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static float Vector128_Create_float(float a) + { + Vector128 x = default; + for (int i = 0; i < 1; i++) + x = Vector128.Create(1, 2, 3, Inline(a)); + return x.GetElement(3); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static byte Vector128_Create_byte(byte a) + { + Vector128 x = default; + for (int i = 0; i < 1; i++) + x = Vector128.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, Inline(a)); + return x.GetElement(15); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static float Vector256_Create_float(float a) + { + Vector256 x = default; + for (int i = 0; i < 1; i++) + x = Vector256.Create(1, 2, 3, 4, 5, 6, 7, Inline(a)); + return x.GetElement(7); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static double Vector256_Create_double(double a) + { + Vector256 x = default; + for (int i = 0; i < 1; i++) + x = Vector256.Create(1, 2, 3, Inline(a)); + return x.GetElement(3); + } + } +} diff --git a/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.csproj b/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.csproj new file mode 100644 index 0000000000000..86679f8163912 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/General/Regression/GitHub_43569/GitHub_43569.csproj @@ -0,0 +1,12 @@ + + + Exe + + + Embedded + True + + + + +