Skip to content

Commit 020ed38

Browse files
Ensure that we don't try to get the simdBaseJitType for scalar intrinsics (#61982)
* Ensure that we don't try to get the simdBaseJitType for scalar intrinsics * Update a condition to also check for isScalarIsa
1 parent b84b62c commit 020ed38

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/coreclr/jit/hwintrinsic.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,11 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
747747
CORINFO_SIG_INFO* sig,
748748
bool mustExpand)
749749
{
750-
HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsic);
751-
int numArgs = sig->numArgs;
752-
var_types retType = JITtype2varType(sig->retType);
753-
CorInfoType simdBaseJitType = CORINFO_TYPE_UNDEF;
750+
HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsic);
751+
CORINFO_InstructionSet isa = HWIntrinsicInfo::lookupIsa(intrinsic);
752+
int numArgs = sig->numArgs;
753+
var_types retType = JITtype2varType(sig->retType);
754+
CorInfoType simdBaseJitType = CORINFO_TYPE_UNDEF;
754755

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

772773
if (simdBaseJitType == CORINFO_TYPE_UNDEF)
773774
{
774-
if (category != HW_Category_Scalar)
775+
if ((category == HW_Category_Scalar) || HWIntrinsicInfo::isScalarIsa(isa))
775776
{
776-
unsigned int sizeBytes;
777-
simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
778-
assert((category == HW_Category_Special) || (category == HW_Category_Helper) || (sizeBytes != 0));
777+
simdBaseJitType = sig->retType;
778+
779+
if (simdBaseJitType == CORINFO_TYPE_VOID)
780+
{
781+
simdBaseJitType = CORINFO_TYPE_UNDEF;
782+
}
779783
}
780784
else
781785
{
782-
simdBaseJitType = sig->retType;
786+
assert(featureSIMD);
787+
unsigned int sizeBytes;
788+
789+
simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
790+
assert((category == HW_Category_Special) || (category == HW_Category_Helper) || (sizeBytes != 0));
783791
}
784792
}
785793

786794
// Immediately return if the category is other than scalar/special and this is not a supported base type.
787-
if ((category != HW_Category_Special) && (category != HW_Category_Scalar) &&
795+
if ((category != HW_Category_Special) && (category != HW_Category_Scalar) && !HWIntrinsicInfo::isScalarIsa(isa) &&
788796
!isSupportedBaseType(intrinsic, simdBaseJitType))
789797
{
790798
return nullptr;

0 commit comments

Comments
 (0)