Adding basic containment analysis support for hardware intrinsics.
authorTanner Gooding <tagoo@outlook.com>
Wed, 27 Dec 2017 01:15:37 +0000 (17:15 -0800)
committerTanner Gooding <tagoo@outlook.com>
Wed, 27 Dec 2017 17:00:02 +0000 (09:00 -0800)
src/jit/lower.cpp
src/jit/lower.h
src/jit/lowerxarch.cpp

index 11a751c80b0b407c8a9243ffe95dcfeeeca41a59..f2118bf5a9319519174b6d01190b413053268990 100644 (file)
@@ -262,6 +262,12 @@ GenTree* Lowering::LowerNode(GenTree* node)
             break;
 #endif //
 
+#ifdef FEATURE_HW_INTRINSICS
+        case GT_HWIntrinsic:
+            LowerHWIntrinsic(node->AsHWIntrinsic());
+            break;
+#endif // FEATURE_HW_INTRINSICS
+
         case GT_LCL_VAR:
             WidenSIMD12IfNecessary(node->AsLclVarCommon());
             break;
@@ -5857,6 +5863,11 @@ void Lowering::ContainCheckNode(GenTree* node)
             ContainCheckSIMD(node->AsSIMD());
             break;
 #endif // FEATURE_SIMD
+#ifdef FEATURE_HW_INTRINSICS
+        case GT_HWIntrinsic:
+            ContainCheckHWIntrinsic(node->AsHWIntrinsic());
+            break;
+#endif // FEATURE_HW_INTRINSICS
         default:
             break;
     }
index 22c9a9d800ebefd4b92caf7feaf254a6b2c2400f..75cccc4b85d6f1654a9478c3b9fa89d65dd395fa 100644 (file)
@@ -120,6 +120,9 @@ private:
 #ifdef FEATURE_SIMD
     void ContainCheckSIMD(GenTreeSIMD* simdNode);
 #endif // FEATURE_SIMD
+#ifdef FEATURE_HW_INTRINSICS
+    void ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node);
+#endif // FEATURE_HW_INTRINSICS
 
 #ifdef DEBUG
     static void CheckCallArg(GenTree* arg);
@@ -306,6 +309,9 @@ private:
 #ifdef FEATURE_SIMD
     void LowerSIMD(GenTreeSIMD* simdNode);
 #endif // FEATURE_SIMD
+#ifdef FEATURE_HW_INTRINSICS
+    void LowerHWIntrinsic(GenTreeHWIntrinsic* node);
+#endif // FEATURE_HW_INTRINSICS
 
     // Utility functions
     void MorphBlkIntoHelperCall(GenTreePtr pTree, GenTreePtr treeStmt);
index 08b3d00fdf2b1ca95cd4417f0e86519843d01e7f..38cfed63e2c08a51857916e1bbd370f94741ee53 100644 (file)
@@ -867,6 +867,19 @@ void Lowering::LowerSIMD(GenTreeSIMD* simdNode)
 }
 #endif // FEATURE_SIMD
 
+#ifdef FEATURE_HW_INTRINSICS
+//----------------------------------------------------------------------------------------------
+// Lowering::LowerHWIntrinsic: Perform containment analysis for a hardware intrinsic node.
+//
+//  Arguments:
+//     node - The hardware intrinsic node.
+//
+void Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node)
+{
+    ContainCheckHWIntrinsic(node);
+}
+#endif // FEATURE_HW_INTRINSICS
+
 //----------------------------------------------------------------------------------------------
 // Lowering::IsRMWIndirCandidate:
 //    Returns true if the given operand is a candidate indirection for a read-modify-write
@@ -2278,6 +2291,28 @@ void Lowering::ContainCheckSIMD(GenTreeSIMD* simdNode)
 }
 #endif // FEATURE_SIMD
 
+#ifdef FEATURE_HW_INTRINSICS
+//----------------------------------------------------------------------------------------------
+// ContainCheckHWIntrinsic: Perform containment analysis for a hardware intrinsic node.
+//
+//  Arguments:
+//     node - The hardware intrinsic node.
+//
+void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
+{
+    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    GenTree*       op1         = node->gtOp.gtOp1;
+    GenTree*       op2         = node->gtOp.gtOp2;
+
+    switch (node->gtHWIntrinsicId)
+    {
+        default:
+            assert((intrinsicID > NI_HW_INTRINSIC_START) && (intrinsicID < NI_HW_INTRINSIC_END));
+            break;
+    }
+}
+#endif // FEATURE_HW_INTRINSICS
+
 //------------------------------------------------------------------------
 // ContainCheckFloatBinary: determine whether the sources of a floating point binary node should be contained.
 //