Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15560 from fiigii/simdexp
Browse files Browse the repository at this point in the history
SIMD hardware intrinsics throw PNSE
  • Loading branch information
CarolEidt committed Dec 18, 2017
2 parents 3386dc8 + 0d6880d commit 46dc37a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/jit/compiler.h
Expand Up @@ -2067,7 +2067,7 @@ class Compiler
GenTree* op1,
GenTree* op2,
NamedIntrinsic hwIntrinsicID);
GenTree* gtNewMustThrowException(unsigned helper, var_types type);
GenTree* gtNewMustThrowException(unsigned helper, var_types type, CORINFO_CLASS_HANDLE clsHnd);
CORINFO_CLASS_HANDLE gtGetStructHandleForHWSIMD(var_types simdType, var_types simdBaseType);
#endif // FEATURE_HW_INTRINSICS

Expand Down
16 changes: 12 additions & 4 deletions src/jit/gentree.cpp
Expand Up @@ -17858,15 +17858,23 @@ GenTreeHWIntrinsic* Compiler::gtNewScalarHWIntrinsicNode(var_types type,
// Return Value
// pointer to the throw node
//
GenTree* Compiler::gtNewMustThrowException(unsigned helper, var_types type)
GenTree* Compiler::gtNewMustThrowException(unsigned helper, var_types type, CORINFO_CLASS_HANDLE clsHnd)
{
GenTreeCall* node = gtNewHelperCallNode(helper, TYP_VOID);
node->gtCallMoreFlags |= GTF_CALL_M_DOES_NOT_RETURN;
if (type != TYP_VOID)
{
unsigned dummyTemp = lvaGrabTemp(true DEBUGARG("dummy temp of must thrown exception"));
lvaTable[dummyTemp].lvType = type;
GenTree* dummyNode = gtNewLclvNode(dummyTemp, type);
unsigned dummyTemp = lvaGrabTemp(true DEBUGARG("dummy temp of must thrown exception"));
if (type == TYP_STRUCT)
{
lvaSetStruct(dummyTemp, clsHnd, false);
type = lvaTable[dummyTemp].lvType; // struct type is normalized
}
else
{
lvaTable[dummyTemp].lvType = type;
}
GenTree* dummyNode = gtNewLclvNode(dummyTemp, type);
return gtNewOperNode(GT_COMMA, type, node, dummyNode);
}
return node;
Expand Down
9 changes: 5 additions & 4 deletions src/jit/hwintrinsicxarch.cpp
Expand Up @@ -212,7 +212,8 @@ GenTree* Compiler::impX86HWIntrinsic(NamedIntrinsic intrinsic, CORINFO_METHOD_HA
{
impPopStack();
}
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, JITtype2varType(sig->retType));
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, JITtype2varType(sig->retType),
sig->retTypeClass);
}
switch (isa)
{
Expand Down Expand Up @@ -425,7 +426,7 @@ GenTree* Compiler::impSSE42Intrinsic(NamedIntrinsic intrinsic, CORINFO_METHOD_HA
#ifdef _TARGET_X86_
if (varTypeIsLong(callType))
{
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType);
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType, sig->retTypeClass);
}
#endif
argLst = info.compCompHnd->getArgNext(argLst); // the second argument
Expand Down Expand Up @@ -565,7 +566,7 @@ GenTree* Compiler::impLZCNTIntrinsic(NamedIntrinsic intrinsic, CORINFO_METHOD_HA
#ifdef _TARGET_X86_
if (varTypeIsLong(callType))
{
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType);
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType, sig->retTypeClass);
}
#endif
retNode = gtNewScalarHWIntrinsicNode(callType, op1, NI_LZCNT_LeadingZeroCount);
Expand Down Expand Up @@ -608,7 +609,7 @@ GenTree* Compiler::impPOPCNTIntrinsic(NamedIntrinsic intrinsic, CORINFO_METHOD_H
#ifdef _TARGET_X86_
if (varTypeIsLong(callType))
{
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType);
return gtNewMustThrowException(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, callType, sig->retTypeClass);
}
#endif
retNode = gtNewScalarHWIntrinsicNode(callType, op1, NI_POPCNT_PopCount);
Expand Down

0 comments on commit 46dc37a

Please sign in to comment.