Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/coreclr/jit/morphblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ void MorphInitBlockHelper::TryPrimitiveInit()
if (varTypeIsSIMD(lclVarType))
{
m_src = m_compiler->gtNewZeroConNode(lclVarType);
m_src->SetMorphed(m_compiler);
m_store->Data() = m_src;
}
else
{
Expand Down
64 changes: 64 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_133085/Runtime_133085.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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;
using Xunit;

public class Runtime_133085
{
private struct Struct128
{
public ulong U0;
public ulong U1;
}

private struct Struct256
{
public ulong U0;
public ulong U1;
public ulong U2;
public ulong U3;
}

[Fact]
public static void TestEntryPoint()
{
Assert.Equal(Vector128<ulong>.Zero, ZeroVector128FullOpts());
Assert.Equal(Vector256<ulong>.Zero, ZeroVector256FullOpts());
Assert.Equal(Vector128<ulong>.Zero, ZeroVector128Tier0());
Assert.Equal(Vector256<ulong>.Zero, ZeroVector256Tier0());
}

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static Vector128<ulong> ZeroVector128FullOpts()
{
Unsafe.SkipInit(out Vector128<ulong> result);
Unsafe.As<Vector128<ulong>, Struct128>(ref result) = default;
return result;
}

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static Vector256<ulong> ZeroVector256FullOpts()
{
Unsafe.SkipInit(out Vector256<ulong> result);
Unsafe.As<Vector256<ulong>, Struct256>(ref result) = default;
return result;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector128<ulong> ZeroVector128Tier0()
{
Unsafe.SkipInit(out Vector128<ulong> result);
Unsafe.As<Vector128<ulong>, Struct128>(ref result) = default;
return result;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector256<ulong> ZeroVector256Tier0()
{
Unsafe.SkipInit(out Vector256<ulong> result);
Unsafe.As<Vector256<ulong>, Struct256>(ref result) = default;
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
<CLRTestPriority>1</CLRTestPriority>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />

<CLRTestEnvironmentVariable Include="DOTNET_TieredCompilation" Value="1" />
</ItemGroup>
</Project>
Loading