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
21 changes: 14 additions & 7 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9583,17 +9583,24 @@ class Compiler
return XMM_REGSIZE_BYTES;
}
#elif defined(TARGET_ARM64)
if (compExactlyDependsOn(InstructionSet_VectorT128))
#if defined(DEBUG)
if (JitConfig.JitUseScalableVectorT() && compOpportunisticallyDependsOn(InstructionSet_Sve))
{
return FP_REGSIZE_BYTES;
return SIZE_UNKNOWN;
}
else
{
// TODO: We should be returning 0 here, but there are a number of
// places that don't quite get handled correctly in that scenario
#endif // DEBUG
if (compExactlyDependsOn(InstructionSet_VectorT128))
{
return FP_REGSIZE_BYTES;
}
else
{
// TODO: We should be returning 0 here, but there are a number of
// places that don't quite get handled correctly in that scenario

return FP_REGSIZE_BYTES;
}
return FP_REGSIZE_BYTES;
}
#else
assert(!"getVectorTByteLength() unimplemented on target arch");
unreached();
Expand Down
13 changes: 11 additions & 2 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = {
{ NI_Illegal, NI_Illegal }, // Atomics
{ FIRST_NI_Vector64, LAST_NI_Vector64 }, // Vector64
{ FIRST_NI_Vector128, LAST_NI_Vector128 }, // Vector128
{ NI_Illegal, NI_Illegal }, // VectorT
{ FIRST_NI_VectorT, LAST_NI_VectorT }, // VectorT
{ NI_Illegal, NI_Illegal }, // Dczva
{ NI_Illegal, NI_Illegal }, // Rcpc
{ NI_Illegal, NI_Illegal }, // VectorT128
Expand Down Expand Up @@ -1369,6 +1369,15 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
return NI_Illegal;
}
}
else if (isa == InstructionSet_VectorT)
{
// This instruction set should only be set when SVE is enabled.
// Baseline Vector<T> will use InstructionSet_VectorT128.
if (!comp->compOpportunisticallyDependsOn(InstructionSet_Sve))
{
return NI_Illegal;
}
}
#endif

#if defined(TARGET_XARCH)
Expand Down Expand Up @@ -2234,7 +2243,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
}

#if defined(TARGET_ARM64)
if ((simdSize != 8) && (simdSize != 16))
if ((simdSize != 8) && (simdSize != 16) && (simdSize != SIZE_UNKNOWN))
#elif defined(TARGET_XARCH)
if ((simdSize != 16) && (simdSize != 32) && (simdSize != 64))
#endif // TARGET_*
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/hwintrinsic.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,14 @@ struct HWIntrinsicInfo
*pSimdSize = lookup(id).simdSize;
succeeded = true;
}
#if defined(TARGET_ARM64) && defined(DEBUG)
else if (JitConfig.JitUseScalableVectorT() && HWIntrinsicInfo::IsScalable(id))
{
*pSimdSize = SIZE_UNKNOWN;
succeeded = true;
}
#endif

return succeeded;
}

Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/hwintrinsicarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ CORINFO_InstructionSet Compiler::lookupInstructionSet(const char* className)
{
return InstructionSet_Vector128;
}
else if (strcmp(className, "VectorT") == 0)
{
return InstructionSet_VectorT;
}
}

return InstructionSet_ILLEGAL;
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/hwintrinsiclistarm64sve.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ HARDWARE_INTRINSIC(Sve, TransposeEven_Predicates,
HARDWARE_INTRINSIC(Sve, TransposeOdd_Predicates, -1, 2, {INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2, INS_sve_trn2}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_ReturnsPerElementMask)
HARDWARE_INTRINSIC(Sve, ReverseElement_Predicates, -1, 1, {INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev, INS_sve_rev}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_ReturnsPerElementMask)

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// SVE Implementation of VectorT Intrinsics
#define FIRST_NI_VectorT NI_Illegal
#define LAST_NI_VectorT NI_Illegal

#endif // FEATURE_HW_INTRINSIC

#undef HARDWARE_INTRINSIC
Expand Down
16 changes: 14 additions & 2 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10751,8 +10751,9 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
{
#ifdef FEATURE_HW_INTRINSICS
bool isVectorT = strcmp(className, "Vector`1") == 0;
bool isVector = strcmp(className, "Vector") == 0;

if (isVectorT || (strcmp(className, "Vector") == 0))
if (isVectorT || isVector)
{
if (strncmp(methodName, "System.Runtime.Intrinsics.ISimdVector<System.Numerics.Vector",
60) == 0)
Expand All @@ -10768,7 +10769,11 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
}

uint32_t size = getVectorTByteLength();
#ifdef TARGET_ARM64
assert((size == 16) || (size == 32) || (size == 64) || (size == SIZE_UNKNOWN));
#else
assert((size == 16) || (size == 32) || (size == 64));
#endif

const char* lookupClassName = className;

Expand All @@ -10791,7 +10796,14 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
lookupClassName = isVectorT ? "Vector512`1" : "Vector512";
break;
}

#ifdef TARGET_ARM64
case SIZE_UNKNOWN:
{
assert(isVectorT || isVector);
lookupClassName = "VectorT";
break;
}
#endif
default:
{
unreached();
Expand Down
Loading