Skip to content
Merged
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
28 changes: 18 additions & 10 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,11 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
CORINFO_SIG_INFO* sig,
bool mustExpand)
{
HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsic);
int numArgs = sig->numArgs;
var_types retType = JITtype2varType(sig->retType);
CorInfoType simdBaseJitType = CORINFO_TYPE_UNDEF;
HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsic);
CORINFO_InstructionSet isa = HWIntrinsicInfo::lookupIsa(intrinsic);
int numArgs = sig->numArgs;
var_types retType = JITtype2varType(sig->retType);
CorInfoType simdBaseJitType = CORINFO_TYPE_UNDEF;

if ((retType == TYP_STRUCT) && featureSIMD)
{
Expand All @@ -771,20 +772,27 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,

if (simdBaseJitType == CORINFO_TYPE_UNDEF)
{
if (category != HW_Category_Scalar)
if ((category == HW_Category_Scalar) || HWIntrinsicInfo::isScalarIsa(isa))
{
unsigned int sizeBytes;
simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
assert((category == HW_Category_Special) || (category == HW_Category_Helper) || (sizeBytes != 0));
simdBaseJitType = sig->retType;

if (simdBaseJitType == CORINFO_TYPE_VOID)
{
simdBaseJitType = CORINFO_TYPE_UNDEF;
}
}
else
{
simdBaseJitType = sig->retType;
assert(featureSIMD);
unsigned int sizeBytes;

simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
assert((category == HW_Category_Special) || (category == HW_Category_Helper) || (sizeBytes != 0));
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add check for !isScalarIsa(isa) below - line 795 in the new version of the file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its probably good to cover that scenario pre-emptively.

Nothing will hit it today, but it fits with the changes already being made.

// Immediately return if the category is other than scalar/special and this is not a supported base type.
if ((category != HW_Category_Special) && (category != HW_Category_Scalar) &&
if ((category != HW_Category_Special) && (category != HW_Category_Scalar) && !HWIntrinsicInfo::isScalarIsa(isa) &&
!isSupportedBaseType(intrinsic, simdBaseJitType))
{
return nullptr;
Expand Down