summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2018-06-02 08:29:36 -0700
committerTanner Gooding <tagoo@outlook.com>2018-06-02 14:23:38 -0700
commit565d5be3a5b109bb7dfd245fae3b261e05cc08bb (patch)
treeeb107f8da71cc4d3df8223822509ac628145fec7 /src/jit
parent5d52f8c9f62c87909c62aa35a7db37a551951b8d (diff)
downloadcoreclr-565d5be3a5b109bb7dfd245fae3b261e05cc08bb.tar.gz
coreclr-565d5be3a5b109bb7dfd245fae3b261e05cc08bb.tar.bz2
coreclr-565d5be3a5b109bb7dfd245fae3b261e05cc08bb.zip
Moving the getHWIntrinsicInfo and getHWIntrinsicName methods to be static methods on HWIntrinsicInfo
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/codegenarm64.cpp4
-rw-r--r--src/jit/compiler.h1
-rw-r--r--src/jit/gentree.cpp7
-rw-r--r--src/jit/hwintrinsicArm64.cpp31
-rw-r--r--src/jit/hwintrinsicArm64.h11
-rw-r--r--src/jit/hwintrinsicxarch.cpp21
-rw-r--r--src/jit/hwintrinsicxarch.h11
-rw-r--r--src/jit/lowerarmarch.cpp4
-rw-r--r--src/jit/lsraarm64.cpp2
9 files changed, 60 insertions, 32 deletions
diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp
index 94410517fa..5fa3015cbc 100644
--- a/src/jit/codegenarm64.cpp
+++ b/src/jit/codegenarm64.cpp
@@ -4898,7 +4898,7 @@ instruction CodeGen::getOpForHWIntrinsic(GenTreeHWIntrinsic* node, var_types ins
unsigned int instrTypeIndex = varTypeIsFloating(instrType) ? 0 : varTypeIsUnsigned(instrType) ? 2 : 1;
- instruction ins = compiler->getHWIntrinsicInfo(intrinsicID).instrs[instrTypeIndex];
+ instruction ins = HWIntrinsicInfo::lookup(intrinsicID).instrs[instrTypeIndex];
assert(ins != INS_invalid);
return ins;
@@ -4919,7 +4919,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
{
NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
- switch (compiler->getHWIntrinsicInfo(intrinsicID).form)
+ switch (HWIntrinsicInfo::lookup(intrinsicID).form)
{
case HWIntrinsicInfo::UnaryOp:
genHWIntrinsicUnaryOp(node);
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index ed50fb3344..2b054f6c51 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -3036,7 +3036,6 @@ protected:
InstructionSet lookupHWIntrinsicISA(const char* className);
NamedIntrinsic lookupHWIntrinsic(const char* className, const char* methodName);
bool impCheckImmediate(GenTree* immediateOp, unsigned int max);
- const HWIntrinsicInfo& getHWIntrinsicInfo(NamedIntrinsic);
#endif // _TARGET_ARM64_
#endif // FEATURE_HW_INTRINSICS
GenTree* impArrayAccessIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index 5c0ab71196..90a8dc91bb 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -12,6 +12,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
#include "jitpch.h"
+#include "hwintrinsic.h"
#include "simd.h"
#ifdef _MSC_VER
@@ -10813,10 +10814,6 @@ extern const char* const simdIntrinsicNames[] = {
};
#endif // FEATURE_SIMD
-#ifdef FEATURE_HW_INTRINSICS
-extern const char* getHWIntrinsicName(NamedIntrinsic intrinsic);
-#endif // FEATURE_HW_INTRINSICS
-
/*****************************************************************************/
void Compiler::gtDispTree(GenTree* tree,
@@ -11143,7 +11140,7 @@ void Compiler::gtDispTree(GenTree* tree,
printf(" %s %s",
tree->gtHWIntrinsic.gtSIMDBaseType == TYP_UNKNOWN ? ""
: varTypeName(tree->gtHWIntrinsic.gtSIMDBaseType),
- getHWIntrinsicName(tree->gtHWIntrinsic.gtHWIntrinsicId));
+ HWIntrinsicInfo::lookupName(tree->gtHWIntrinsic.gtHWIntrinsicId));
}
#endif // FEATURE_HW_INTRINSICS
diff --git a/src/jit/hwintrinsicArm64.cpp b/src/jit/hwintrinsicArm64.cpp
index 0a8130e855..c64ff6e464 100644
--- a/src/jit/hwintrinsicArm64.cpp
+++ b/src/jit/hwintrinsicArm64.cpp
@@ -44,17 +44,22 @@ static const HWIntrinsicInfo hwIntrinsicInfoArray[] = {
};
// clang-format on
-extern const char* getHWIntrinsicName(NamedIntrinsic intrinsic)
+//------------------------------------------------------------------------
+// lookup: Gets the HWIntrinsicInfo associated with a given NamedIntrinsic
+//
+// Arguments:
+// id -- The NamedIntrinsic associated with the HWIntrinsic to lookup
+//
+// Return Value:
+// The HWIntrinsicInfo associated with id
+const HWIntrinsicInfo& HWIntrinsicInfo::lookup(NamedIntrinsic id)
{
- return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].intrinsicName;
-}
+ assert(id != NI_Illegal);
-const HWIntrinsicInfo& Compiler::getHWIntrinsicInfo(NamedIntrinsic intrinsic)
-{
- assert(intrinsic > NI_HW_INTRINSIC_START);
- assert(intrinsic < NI_HW_INTRINSIC_END);
+ assert(id > NI_HW_INTRINSIC_START);
+ assert(id < NI_HW_INTRINSIC_END);
- return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1];
+ return hwIntrinsicInfoArray[id - NI_HW_INTRINSIC_START - 1];
}
//------------------------------------------------------------------------
@@ -102,19 +107,19 @@ NamedIntrinsic Compiler::lookupHWIntrinsic(const char* className, const char* me
for (int i = 0; i < NI_HW_INTRINSIC_END - NI_HW_INTRINSIC_START; i++)
{
if ((isaFlag & hwIntrinsicInfoArray[i].isaflags) &&
- strcmp(methodName, hwIntrinsicInfoArray[i].intrinsicName) == 0)
+ strcmp(methodName, hwIntrinsicInfoArray[i].name) == 0)
{
if (compSupports(isa))
{
// Intrinsic is supported on platform
- result = hwIntrinsicInfoArray[i].intrinsicID;
+ result = hwIntrinsicInfoArray[i].id;
}
else
{
// When the intrinsic class is not supported
// Return NI_ARM64_PlatformNotSupported for all intrinsics
// Return NI_ARM64_IsSupported_False for the IsSupported property
- result = (hwIntrinsicInfoArray[i].intrinsicID != NI_ARM64_IsSupported_True)
+ result = (hwIntrinsicInfoArray[i].id != NI_ARM64_IsSupported_True)
? NI_ARM64_PlatformNotSupported
: NI_ARM64_IsSupported_False;
}
@@ -210,7 +215,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
var_types simdBaseType = TYP_UNKNOWN;
unsigned simdSizeBytes = 0;
- switch (getHWIntrinsicInfo(intrinsic).form)
+ switch (HWIntrinsicInfo::lookup(intrinsic).form)
{
case HWIntrinsicInfo::SimdBinaryOp:
case HWIntrinsicInfo::SimdInsertOp:
@@ -243,7 +248,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
simdType = getSIMDTypeForSize(simdSizeBytes);
}
- switch (getHWIntrinsicInfo(intrinsic).form)
+ switch (HWIntrinsicInfo::lookup(intrinsic).form)
{
case HWIntrinsicInfo::IsSupported:
return gtNewIconNode((intrinsic == NI_ARM64_IsSupported_True) ? 1 : 0);
diff --git a/src/jit/hwintrinsicArm64.h b/src/jit/hwintrinsicArm64.h
index b7bc6e7f4c..c0d3ffd360 100644
--- a/src/jit/hwintrinsicArm64.h
+++ b/src/jit/hwintrinsicArm64.h
@@ -44,12 +44,19 @@ struct HWIntrinsicInfo
LowerCmpUZero = (1UL << 0), // Unsigned zero compare form must be lowered
};
- NamedIntrinsic intrinsicID;
- const char* intrinsicName;
+ NamedIntrinsic id;
+ const char* name;
uint64_t isaflags;
Form form;
Flags flags;
instruction instrs[3];
+
+ static const HWIntrinsicInfo& lookup(NamedIntrinsic id);
+
+ static const char* lookupName(NamedIntrinsic id)
+ {
+ return lookup(id).name;
+ }
};
#endif // FEATURE_HW_INTRINSICS
diff --git a/src/jit/hwintrinsicxarch.cpp b/src/jit/hwintrinsicxarch.cpp
index 48b2d6791e..633a853a42 100644
--- a/src/jit/hwintrinsicxarch.cpp
+++ b/src/jit/hwintrinsicxarch.cpp
@@ -15,9 +15,22 @@ static const HWIntrinsicInfo hwIntrinsicInfoArray[] = {
#include "hwintrinsiclistxarch.h"
};
-extern const char* getHWIntrinsicName(NamedIntrinsic intrinsic)
+//------------------------------------------------------------------------
+// lookup: Gets the HWIntrinsicInfo associated with a given NamedIntrinsic
+//
+// Arguments:
+// id -- The NamedIntrinsic associated with the HWIntrinsic to lookup
+//
+// Return Value:
+// The HWIntrinsicInfo associated with id
+const HWIntrinsicInfo& HWIntrinsicInfo::lookup(NamedIntrinsic id)
{
- return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].intrinsicName;
+ assert(id != NI_Illegal);
+
+ assert(id > NI_HW_INTRINSIC_START);
+ assert(id < NI_HW_INTRINSIC_END);
+
+ return hwIntrinsicInfoArray[id - NI_HW_INTRINSIC_START - 1];
}
//------------------------------------------------------------------------
@@ -124,9 +137,9 @@ NamedIntrinsic Compiler::lookupHWIntrinsic(const char* methodName, InstructionSe
{
for (int i = 0; i < NI_HW_INTRINSIC_END - NI_HW_INTRINSIC_START - 1; i++)
{
- if (isa == hwIntrinsicInfoArray[i].isa && strcmp(methodName, hwIntrinsicInfoArray[i].intrinsicName) == 0)
+ if (isa == hwIntrinsicInfoArray[i].isa && strcmp(methodName, hwIntrinsicInfoArray[i].name) == 0)
{
- result = hwIntrinsicInfoArray[i].intrinsicID;
+ result = hwIntrinsicInfoArray[i].id;
break;
}
}
diff --git a/src/jit/hwintrinsicxarch.h b/src/jit/hwintrinsicxarch.h
index 17f5fa8e6e..820f12d1ac 100644
--- a/src/jit/hwintrinsicxarch.h
+++ b/src/jit/hwintrinsicxarch.h
@@ -127,8 +127,8 @@ enum HWIntrinsicFlag : unsigned int
struct HWIntrinsicInfo
{
- NamedIntrinsic intrinsicID;
- const char* intrinsicName;
+ NamedIntrinsic id;
+ const char* name;
InstructionSet isa;
int ival;
unsigned simdSize;
@@ -136,6 +136,13 @@ struct HWIntrinsicInfo
instruction ins[10];
HWIntrinsicCategory category;
HWIntrinsicFlag flags;
+
+ static const HWIntrinsicInfo& lookup(NamedIntrinsic id);
+
+ static const char* lookupName(NamedIntrinsic id)
+ {
+ return lookup(id).name;
+ }
};
#endif // FEATURE_HW_INTRINSICS
diff --git a/src/jit/lowerarmarch.cpp b/src/jit/lowerarmarch.cpp
index 90582c8600..47998fef8e 100644
--- a/src/jit/lowerarmarch.cpp
+++ b/src/jit/lowerarmarch.cpp
@@ -494,7 +494,7 @@ void Lowering::LowerSIMD(GenTreeSIMD* simdNode)
void Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node)
{
auto intrinsicID = node->gtHWIntrinsicId;
- auto intrinsicInfo = comp->getHWIntrinsicInfo(node->gtHWIntrinsicId);
+ auto intrinsicInfo = HWIntrinsicInfo::lookup(node->gtHWIntrinsicId);
//
// Lower unsupported Unsigned Compare Zero intrinsics to their trivial transformations
@@ -876,7 +876,7 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
op2 = argList->Rest()->Current();
}
- switch (comp->getHWIntrinsicInfo(node->gtHWIntrinsicId).form)
+ switch (HWIntrinsicInfo::lookup(node->gtHWIntrinsicId).form)
{
case HWIntrinsicInfo::SimdExtractOp:
if (op2->IsCnsIntOrI())
diff --git a/src/jit/lsraarm64.cpp b/src/jit/lsraarm64.cpp
index b4a540b6c3..fbca9ae901 100644
--- a/src/jit/lsraarm64.cpp
+++ b/src/jit/lsraarm64.cpp
@@ -1051,7 +1051,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
bool op3IsDelayFree = false;
// Create internal temps, and handle any other special requirements.
- switch (compiler->getHWIntrinsicInfo(intrinsicID).form)
+ switch (HWIntrinsicInfo::lookup(intrinsicID).form)
{
case HWIntrinsicInfo::Sha1HashOp:
assert((numArgs == 3) && (op2 != nullptr) && (op3 != nullptr));