summaryrefslogtreecommitdiff
path: root/src/jit/hwintrinsicArm64.cpp
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-05-23 07:39:43 -0700
committerGitHub <noreply@github.com>2018-05-23 07:39:43 -0700
commitb39a5b2cfad4620ae23cda84186a36ffb463cd5a (patch)
treeb378e05aca980b231d8e9f45a00beaeca73405e2 /src/jit/hwintrinsicArm64.cpp
parent74d0196fe5b36bf04848f2cf84d20c8b6e999b62 (diff)
downloadcoreclr-b39a5b2cfad4620ae23cda84186a36ffb463cd5a.tar.gz
coreclr-b39a5b2cfad4620ae23cda84186a36ffb463cd5a.tar.bz2
coreclr-b39a5b2cfad4620ae23cda84186a36ffb463cd5a.zip
Create RefPositions without TreeNodeInfo (#16517)
* Create RefPositions without TreeNodeInfo * Remove all references to TreeNodeInfo * Fix function header comments
Diffstat (limited to 'src/jit/hwintrinsicArm64.cpp')
-rw-r--r--src/jit/hwintrinsicArm64.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/jit/hwintrinsicArm64.cpp b/src/jit/hwintrinsicArm64.cpp
index 7f5f53220c..b9038f10ec 100644
--- a/src/jit/hwintrinsicArm64.cpp
+++ b/src/jit/hwintrinsicArm64.cpp
@@ -134,6 +134,57 @@ bool Compiler::impCheckImmediate(GenTree* immediateOp, unsigned int max)
}
//------------------------------------------------------------------------
+// numArgsOfHWIntrinsic: gets the number of arguments for the hardware intrinsic.
+// This attempts to do a table based lookup but will fallback to the number
+// of operands in 'node' if the table entry is -1.
+//
+// Arguments:
+// node -- GenTreeHWIntrinsic* node with nullptr default value
+//
+// Return Value:
+// number of arguments
+//
+int Compiler::numArgsOfHWIntrinsic(GenTreeHWIntrinsic* node)
+{
+ NamedIntrinsic intrinsic = node->gtHWIntrinsicId;
+
+ assert(intrinsic != NI_Illegal);
+ assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
+
+ GenTree* op1 = node->gtGetOp1();
+ GenTree* op2 = node->gtGetOp2();
+ int numArgs = 0;
+
+ if (op1 == nullptr)
+ {
+ return 0;
+ }
+
+ if (op1->OperIsList())
+ {
+ numArgs = 0;
+ GenTreeArgList* list = op1->AsArgList();
+
+ while (list != nullptr)
+ {
+ numArgs++;
+ list = list->Rest();
+ }
+
+ // We should only use a list if we have 3 operands.
+ assert(numArgs >= 3);
+ return numArgs;
+ }
+
+ if (op2 == nullptr)
+ {
+ return 1;
+ }
+
+ return 2;
+}
+
+//------------------------------------------------------------------------
// impHWIntrinsic: dispatch hardware intrinsics to their own implementation
// function
//