Skip to content
Merged
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
17 changes: 12 additions & 5 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ GenTree* Lowering::LowerFloatArg(GenTree** pArg, CallArg* callArg)
break;
}
GenTree* node = use.GetNode();
if (varTypeIsFloating(node))
if (varTypeUsesFloatReg(node))
{
GenTree* intNode = LowerFloatArgReg(node, currRegNumber);
assert(intNode != nullptr);
Expand All @@ -1447,7 +1447,7 @@ GenTree* Lowering::LowerFloatArg(GenTree** pArg, CallArg* callArg)
// List fields were replaced in place.
return arg;
}
else if (varTypeIsFloating(arg))
else if (varTypeUsesFloatReg(arg))
{
GenTree* intNode = LowerFloatArgReg(arg, callArg->AbiInfo.GetRegNum());
assert(intNode != nullptr);
Expand All @@ -1470,11 +1470,13 @@ GenTree* Lowering::LowerFloatArg(GenTree** pArg, CallArg* callArg)
//
GenTree* Lowering::LowerFloatArgReg(GenTree* arg, regNumber regNum)
{
assert(varTypeUsesFloatReg(arg));

var_types floatType = arg->TypeGet();
assert(varTypeIsFloating(floatType));
var_types intType = (floatType == TYP_DOUBLE) ? TYP_LONG : TYP_INT;
GenTree* intArg = comp->gtNewBitCastNode(intType, arg);
var_types intType = (floatType == TYP_FLOAT) ? TYP_INT : TYP_LONG;
GenTree* intArg = comp->gtNewBitCastNode(intType, arg);
intArg->SetRegNum(regNum);

#ifdef TARGET_ARM
if (floatType == TYP_DOUBLE)
{
Expand Down Expand Up @@ -3819,6 +3821,11 @@ void Lowering::LowerCallStruct(GenTreeCall* call)
assert(user->TypeIs(origType) || (returnType == user->TypeGet()));
break;

case GT_CALL:
// Argument lowering will deal with register file mismatches if needed.
assert(varTypeIsSIMD(origType));
break;

case GT_STOREIND:
#ifdef FEATURE_SIMD
if (varTypeIsSIMD(user))
Expand Down
82 changes: 82 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_74126/Runtime_74126.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.CompilerServices;

public class Runtime_74126
{
public static int Main()
{
if (GetVtor(GetVtor2()) != GetVtor2())
{
return 101;
}
if (GetVtor(GetVtor3()) != GetVtor3())
{
return 102;
}
if (GetVtor(GetVtor4()) != GetVtor4())
{
return 103;
}
if (GetVtor(GetVtor64()) != GetVtor64())
{
return 104;
}
if (GetVtor(GetVtor128()) != GetVtor128())
{
return 105;
}
if (GetVtor(GetVtor256()) != GetVtor256())
{
return 106;
}

return 100;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector2 GetVtor2()
{
return new Vector2(1, 2);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector3 GetVtor3()
{
return new Vector3(1, 2, 3);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector4 GetVtor4()
{
return new Vector4(1, 2, 3, 4);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector64<int> GetVtor64()
{
return Vector64.Create(1, 2);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector128<int> GetVtor128()
{
return Vector128.Create(1, 2, 3, 4);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector256<int> GetVtor256()
{
return Vector256.Create(1, 2, 3, 4, 5, 6, 7, 8);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static T GetVtor<T>(T vtor)
{
return vtor;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>