Moving various x86 HWIntrinsicInfo lookup methods to be static methods on HWIntrinsicInfo
authorTanner Gooding <tagoo@outlook.com>
Sat, 2 Jun 2018 16:29:47 +0000 (09:29 -0700)
committerTanner Gooding <tagoo@outlook.com>
Sat, 2 Jun 2018 21:23:38 +0000 (14:23 -0700)
src/jit/compiler.h
src/jit/gentree.cpp
src/jit/hwintrinsiccodegenxarch.cpp
src/jit/hwintrinsicxarch.cpp
src/jit/hwintrinsicxarch.h
src/jit/lowerxarch.cpp
src/jit/lsraxarch.cpp

index b3b55741b443fa9713b668e533431e6fa72101cb..a5dc916cf446a2522f3876ea22910ac52a4fc493 100644 (file)
@@ -2964,7 +2964,6 @@ public:
 
 protected:
 #ifdef _TARGET_XARCH_
-    static InstructionSet isaOfHWIntrinsic(NamedIntrinsic intrinsic);
     static bool isIntrinsicAnIsSupportedPropertyGetter(NamedIntrinsic intrinsic);
     static bool isFullyImplmentedISAClass(InstructionSet isa);
     GenTree* impSSEIntrinsic(NamedIntrinsic        intrinsic,
@@ -3013,16 +3012,10 @@ protected:
                                 bool                  mustExpand);
     bool compSupportsHWIntrinsic(InstructionSet isa);
     bool isScalarISA(InstructionSet isa);
-    static int ivalOfHWIntrinsic(NamedIntrinsic intrinsic);
     unsigned simdSizeOfHWIntrinsic(NamedIntrinsic intrinsic, CORINFO_SIG_INFO* sig);
     static GenTree* lastOpOfHWIntrinsic(GenTreeHWIntrinsic* node, int numArgs);
-    static instruction insOfHWIntrinsic(NamedIntrinsic intrinsic, var_types type);
-
-public:
-    static HWIntrinsicCategory categoryOfHWIntrinsic(NamedIntrinsic intrinsic);
 
 protected:
-    static HWIntrinsicFlag flagsOfHWIntrinsic(NamedIntrinsic intrinsic);
     GenTree* getArgForHWIntrinsic(var_types argType, CORINFO_CLASS_HANDLE argClass);
     static int immUpperBoundOfHWIntrinsic(NamedIntrinsic intrinsic);
     GenTree* impNonConstFallback(NamedIntrinsic intrinsic, var_types simdType, var_types baseType);
index 90a8dc91bb4c043b2f506e5bac98d8f55156fba9..fce62b70050f6bc20f4b9d585907da475bf8c2c6 100644 (file)
@@ -17384,7 +17384,7 @@ bool GenTree::isCommutativeHWIntrinsic() const
     assert(gtOper == GT_HWIntrinsic);
 
 #ifdef _TARGET_XARCH_
-    HWIntrinsicFlag flags = Compiler::flagsOfHWIntrinsic(AsHWIntrinsic()->gtHWIntrinsicId);
+    HWIntrinsicFlag flags = HWIntrinsicInfo::lookupFlags(AsHWIntrinsic()->gtHWIntrinsicId);
     return ((flags & HW_Flag_Commutative) != 0);
 #else
     return false;
@@ -17428,7 +17428,7 @@ bool GenTree::isRMWHWIntrinsic(Compiler* comp)
 #ifdef _TARGET_XARCH_
     if (!comp->canUseVexEncoding())
     {
-        HWIntrinsicFlag flags = Compiler::flagsOfHWIntrinsic(AsHWIntrinsic()->gtHWIntrinsicId);
+        HWIntrinsicFlag flags = HWIntrinsicInfo::lookupFlags(AsHWIntrinsic()->gtHWIntrinsicId);
         return ((flags & HW_Flag_NoRMWSemantics) == 0);
     }
 
@@ -17573,7 +17573,7 @@ bool GenTreeHWIntrinsic::OperIsMemoryLoad()
 {
 #ifdef _TARGET_XARCH_
     // Some xarch instructions have MemoryLoad sematics
-    HWIntrinsicCategory category = Compiler::categoryOfHWIntrinsic(gtHWIntrinsicId);
+    HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(gtHWIntrinsicId);
     if (category == HW_Category_MemoryLoad)
     {
         return true;
@@ -17608,7 +17608,7 @@ bool GenTreeHWIntrinsic::OperIsMemoryStore()
 {
 #ifdef _TARGET_XARCH_
     // Some xarch instructions have MemoryStore sematics
-    HWIntrinsicCategory category = Compiler::categoryOfHWIntrinsic(gtHWIntrinsicId);
+    HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(gtHWIntrinsicId);
     if (category == HW_Category_MemoryStore)
     {
         return true;
@@ -17640,7 +17640,7 @@ bool GenTreeHWIntrinsic::OperIsMemoryLoadOrStore()
 {
 #ifdef _TARGET_XARCH_
     // Some xarch instructions have MemoryLoad sematics
-    HWIntrinsicCategory category = Compiler::categoryOfHWIntrinsic(gtHWIntrinsicId);
+    HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(gtHWIntrinsicId);
     if ((category == HW_Category_MemoryLoad) || (category == HW_Category_MemoryStore))
     {
         return true;
index 7012a7ac5fe297896ba203fdb6185d5388ba8d7e..fddf16233cce7b157b40c685a8417cfa99f8b7e1 100644 (file)
@@ -51,11 +51,11 @@ static bool genIsTableDrivenHWIntrinsic(HWIntrinsicCategory category, HWIntrinsi
 //
 void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic      intrinsicID = node->gtHWIntrinsicId;
-    InstructionSet      isa         = Compiler::isaOfHWIntrinsic(intrinsicID);
-    HWIntrinsicCategory category    = Compiler::categoryOfHWIntrinsic(intrinsicID);
-    HWIntrinsicFlag     flags       = Compiler::flagsOfHWIntrinsic(intrinsicID);
-    int                 ival        = Compiler::ivalOfHWIntrinsic(intrinsicID);
+    NamedIntrinsic      intrinsicId = node->gtHWIntrinsicId;
+    InstructionSet      isa         = HWIntrinsicInfo::lookupIsa(intrinsicId);
+    HWIntrinsicCategory category    = HWIntrinsicInfo::lookupCategory(intrinsicId);
+    HWIntrinsicFlag     flags       = HWIntrinsicInfo::lookupFlags(intrinsicId);
+    int                 ival        = HWIntrinsicInfo::lookupIval(intrinsicId);
     int                 numArgs     = Compiler::numArgsOfHWIntrinsic(node);
 
     assert((flags & HW_Flag_NoCodeGen) == 0);
@@ -73,7 +73,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
         emitter*  emit   = getEmitter();
 
         assert(numArgs >= 0);
-        instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+        instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
         assert(ins != INS_invalid);
         emitAttr simdSize = EA_ATTR(node->gtSIMDSize);
         assert(simdSize != 0);
@@ -136,7 +136,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
                 }
                 else if (category == HW_Category_MemoryLoad)
                 {
-                    if (intrinsicID == NI_AVX_MaskLoad)
+                    if (intrinsicId == NI_AVX_MaskLoad)
                     {
                         emit->emitIns_SIMD_R_R_AR(ins, simdSize, targetReg, op2Reg, op1Reg);
                     }
@@ -145,11 +145,11 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
                         emit->emitIns_SIMD_R_R_AR(ins, simdSize, targetReg, op1Reg, op2Reg);
                     }
                 }
-                else if (Compiler::isImmHWIntrinsic(intrinsicID, op2))
+                else if (Compiler::isImmHWIntrinsic(intrinsicId, op2))
                 {
                     assert(ival == -1);
 
-                    if (intrinsicID == NI_SSE2_Extract)
+                    if (intrinsicId == NI_SSE2_Extract)
                     {
                         // extract instructions return to GP-registers, so it needs int size as the emitsize
                         simdSize = emitTypeSize(TYP_INT);
@@ -170,7 +170,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
                         // can also occur if the consumer calls it directly and just doesn't pass a constant value.
                         regNumber baseReg = node->ExtractTempReg();
                         regNumber offsReg = node->GetSingleTempReg();
-                        genHWIntrinsicJumpTableFallback(intrinsicID, op2Reg, baseReg, offsReg, emitSwCase);
+                        genHWIntrinsicJumpTableFallback(intrinsicId, op2Reg, baseReg, offsReg, emitSwCase);
                     }
                 }
                 else
@@ -201,7 +201,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
                 genConsumeRegs(op3);
                 regNumber op3Reg = op3->gtRegNum;
 
-                if (Compiler::isImmHWIntrinsic(intrinsicID, op3))
+                if (Compiler::isImmHWIntrinsic(intrinsicId, op3))
                 {
                     assert(ival == -1);
 
@@ -222,12 +222,12 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
                         // can also occur if the consumer calls it directly and just doesn't pass a constant value.
                         regNumber baseReg = node->ExtractTempReg();
                         regNumber offsReg = node->GetSingleTempReg();
-                        genHWIntrinsicJumpTableFallback(intrinsicID, op3Reg, baseReg, offsReg, emitSwCase);
+                        genHWIntrinsicJumpTableFallback(intrinsicId, op3Reg, baseReg, offsReg, emitSwCase);
                     }
                 }
                 else if (category == HW_Category_MemoryStore)
                 {
-                    assert(intrinsicID == NI_SSE2_MaskMove);
+                    assert(intrinsicId == NI_SSE2_MaskMove);
                     assert(targetReg == REG_NA);
 
                     // SSE2 MaskMove hardcodes the destination (op3) in DI/EDI/RDI
@@ -324,7 +324,7 @@ void CodeGen::genHWIntrinsic_R_R_RM(GenTreeHWIntrinsic* node, instruction ins)
 
     if (op2->isContained() || op2->isUsedFromSpillTemp())
     {
-        assert((Compiler::flagsOfHWIntrinsic(node->gtHWIntrinsicId) & HW_Flag_NoContainment) == 0);
+        assert((HWIntrinsicInfo::lookupFlags(node->gtHWIntrinsicId) & HW_Flag_NoContainment) == 0);
 
 #if DEBUG
         bool supportsRegOptional = false;
@@ -458,7 +458,7 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(GenTreeHWIntrinsic* node, instruction ins)
     emitAttr  simdSize   = EA_ATTR(node->gtSIMDSize);
     emitter*  emit       = getEmitter();
 
-    int ival = Compiler::ivalOfHWIntrinsic(node->gtHWIntrinsicId);
+    int ival = HWIntrinsicInfo::lookupIval(node->gtHWIntrinsicId);
     assert((ival >= 0) && (ival <= 127));
 
     // TODO-XArch-CQ: Commutative operations can have op1 be contained
@@ -471,7 +471,7 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(GenTreeHWIntrinsic* node, instruction ins)
 
     if (op2->isContained() || op2->isUsedFromSpillTemp())
     {
-        assert((Compiler::flagsOfHWIntrinsic(node->gtHWIntrinsicId) & HW_Flag_NoContainment) == 0);
+        assert((HWIntrinsicInfo::lookupFlags(node->gtHWIntrinsicId) & HW_Flag_NoContainment) == 0);
 
 #if DEBUG
         bool supportsRegOptional = false;
@@ -783,7 +783,7 @@ void CodeGen::genHWIntrinsicJumpTableFallback(NamedIntrinsic            intrinsi
 //
 void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     GenTree*       op2         = node->gtGetOp2();
     GenTree*       op3         = nullptr;
@@ -804,7 +804,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
         genConsumeOperands(node);
     }
 
-    switch (intrinsicID)
+    switch (intrinsicId)
     {
         case NI_SSE_CompareEqualOrderedScalar:
         case NI_SSE_CompareEqualUnorderedScalar:
@@ -812,7 +812,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg             = op2->gtRegNum;
             regNumber   tmpReg = node->GetSingleTempReg();
-            instruction ins    = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins    = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
 
             // Ensure we aren't overwriting targetReg
             assert(tmpReg != targetReg);
@@ -831,7 +831,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg = op2->gtRegNum;
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op1Reg, op2Reg);
             emit->emitIns_R(INS_seta, EA_1BYTE, targetReg);
             emit->emitIns_R_R(INS_movzx, EA_1BYTE, targetReg, targetReg);
@@ -844,7 +844,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg = op2->gtRegNum;
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op1Reg, op2Reg);
             emit->emitIns_R(INS_setae, EA_1BYTE, targetReg);
             emit->emitIns_R_R(INS_movzx, EA_1BYTE, targetReg, targetReg);
@@ -857,7 +857,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg = op2->gtRegNum;
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op2Reg, op1Reg);
             emit->emitIns_R(INS_seta, EA_1BYTE, targetReg);
             emit->emitIns_R_R(INS_movzx, EA_1BYTE, targetReg, targetReg);
@@ -870,7 +870,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg = op2->gtRegNum;
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op2Reg, op1Reg);
             emit->emitIns_R(INS_setae, EA_1BYTE, targetReg);
             emit->emitIns_R_R(INS_movzx, EA_1BYTE, targetReg, targetReg);
@@ -883,7 +883,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             op2Reg             = op2->gtRegNum;
             regNumber   tmpReg = node->GetSingleTempReg();
-            instruction ins    = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins    = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
 
             // Ensure we aren't overwriting targetReg
             assert(tmpReg != targetReg);
@@ -902,7 +902,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(op2 == nullptr);
             if (op1Reg != targetReg)
             {
-                instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+                instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
                 emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), targetReg, op1Reg);
             }
             break;
@@ -913,7 +913,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_FLOAT);
             assert(op2 == nullptr);
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_INT), targetReg, op1Reg);
             break;
         }
@@ -926,7 +926,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_UBYTE);
             assert(op2 == nullptr);
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             emit->emitIns_AR(ins, emitTypeSize(baseType), op1Reg, 0);
             break;
         }
@@ -986,7 +986,7 @@ void CodeGen::genSSEIntrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     GenTree*       op2         = node->gtGetOp2();
     regNumber      targetReg   = node->gtRegNum;
@@ -1002,7 +1002,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         genConsumeOperands(node);
     }
 
-    switch (intrinsicID)
+    switch (intrinsicId)
     {
         // All integer overloads are handled by table codegen
         case NI_SSE2_CompareLessThan:
@@ -1012,10 +1012,10 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
 
             assert(baseType == TYP_DOUBLE);
 
-            int ival = Compiler::ivalOfHWIntrinsic(intrinsicID);
+            int ival = HWIntrinsicInfo::lookupIval(intrinsicId);
             assert((ival >= 0) && (ival <= 127));
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             op2Reg          = op2->gtRegNum;
             emit->emitIns_SIMD_R_R_R_I(ins, emitTypeSize(TYP_SIMD16), targetReg, op1Reg, op2Reg, ival);
 
@@ -1028,7 +1028,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_DOUBLE);
             op2Reg             = op2->gtRegNum;
             regNumber   tmpReg = node->GetSingleTempReg();
-            instruction ins    = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins    = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
 
             // Ensure we aren't overwriting targetReg
             assert(tmpReg != targetReg);
@@ -1046,7 +1046,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         {
             assert(baseType == TYP_DOUBLE);
             op2Reg          = op2->gtRegNum;
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
 
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op1Reg, op2Reg);
             emit->emitIns_R(INS_seta, EA_1BYTE, targetReg);
@@ -1059,7 +1059,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         {
             assert(baseType == TYP_DOUBLE);
             op2Reg          = op2->gtRegNum;
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
 
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op1Reg, op2Reg);
             emit->emitIns_R(INS_setae, EA_1BYTE, targetReg);
@@ -1072,7 +1072,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         {
             assert(baseType == TYP_DOUBLE);
             op2Reg          = op2->gtRegNum;
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
 
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op2Reg, op1Reg);
             emit->emitIns_R(INS_seta, EA_1BYTE, targetReg);
@@ -1085,7 +1085,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         {
             assert(baseType == TYP_DOUBLE);
             op2Reg          = op2->gtRegNum;
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
 
             emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), op2Reg, op1Reg);
             emit->emitIns_R(INS_setae, EA_1BYTE, targetReg);
@@ -1098,7 +1098,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
         {
             assert(baseType == TYP_DOUBLE);
             op2Reg             = op2->gtRegNum;
-            instruction ins    = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins    = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             regNumber   tmpReg = node->GetSingleTempReg();
 
             // Ensure we aren't overwriting targetReg
@@ -1118,7 +1118,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_INT || baseType == TYP_LONG || baseType == TYP_FLOAT || baseType == TYP_DOUBLE);
             assert(op1 != nullptr);
             assert(op2 != nullptr);
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             genHWIntrinsic_R_R_RM(node, ins);
             break;
         }
@@ -1129,7 +1129,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_LONG || baseType == TYP_ULONG);
             assert(op1 != nullptr);
             assert(op2 == nullptr);
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             emit->emitIns_R_R(ins, emitTypeSize(baseType), targetReg, op1Reg);
             break;
         }
@@ -1139,7 +1139,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(op2 == nullptr);
             if (op1Reg != targetReg)
             {
-                instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+                instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
                 emit->emitIns_R_R(ins, emitTypeSize(targetType), targetReg, op1Reg);
             }
             break;
@@ -1154,7 +1154,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(op2 == nullptr);
             assert(baseType == TYP_DOUBLE || baseType == TYP_FLOAT || baseType == TYP_INT || baseType == TYP_UINT ||
                    baseType == TYP_LONG || baseType == TYP_ULONG);
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             if (baseType == TYP_DOUBLE || baseType == TYP_FLOAT)
             {
                 emit->emitIns_R_R(ins, emitTypeSize(targetType), targetReg, op1Reg);
@@ -1189,7 +1189,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(op2 == nullptr);
             assert(baseType == TYP_BYTE || baseType == TYP_UBYTE || baseType == TYP_DOUBLE);
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             emit->emitIns_R_R(ins, emitTypeSize(TYP_INT), targetReg, op1Reg);
             break;
         }
@@ -1199,7 +1199,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(baseType == TYP_DOUBLE);
             assert(op2 == nullptr);
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType);
             if (op1Reg == targetReg)
             {
                 regNumber tmpReg = node->GetSingleTempReg();
@@ -1223,7 +1223,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(op1 == nullptr);
             assert(op2 == nullptr);
 
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             emit->emitIns_SIMD_R_R_R(ins, emitTypeSize(TYP_SIMD16), targetReg, targetReg, targetReg);
             break;
         }
@@ -1235,7 +1235,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
             assert(op2 != nullptr);
 
             op2Reg          = op2->gtRegNum;
-            instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             emit->emitIns_AR_R(ins, emitTypeSize(baseType), op2Reg, op1Reg, 0);
             break;
         }
@@ -1256,7 +1256,7 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     GenTree*       op2         = node->gtGetOp2();
     GenTree*       op3         = nullptr;
@@ -1277,12 +1277,12 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
         genConsumeOperands(node);
     }
 
-    switch (intrinsicID)
+    switch (intrinsicId)
     {
         case NI_SSE41_TestAllOnes:
         {
             regNumber tmpReg = node->GetSingleTempReg();
-            assert(Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType) == INS_ptest);
+            assert(HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType) == INS_ptest);
             emit->emitIns_SIMD_R_R_R(INS_pcmpeqd, emitTypeSize(TYP_SIMD16), tmpReg, tmpReg, tmpReg);
             emit->emitIns_R_R(INS_xor, EA_4BYTE, targetReg, targetReg);
             emit->emitIns_R_R(INS_ptest, emitTypeSize(TYP_SIMD16), op1Reg, tmpReg);
@@ -1293,7 +1293,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
         case NI_SSE41_TestAllZeros:
         case NI_SSE41_TestZ:
         {
-            assert(Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType) == INS_ptest);
+            assert(HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType) == INS_ptest);
             emit->emitIns_R_R(INS_xor, EA_4BYTE, targetReg, targetReg);
             emit->emitIns_R_R(INS_ptest, emitTypeSize(TYP_SIMD16), op1Reg, op2->gtRegNum);
             emit->emitIns_R(INS_sete, EA_1BYTE, targetReg);
@@ -1302,7 +1302,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
 
         case NI_SSE41_TestC:
         {
-            assert(Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType) == INS_ptest);
+            assert(HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType) == INS_ptest);
             emit->emitIns_R_R(INS_xor, EA_4BYTE, targetReg, targetReg);
             emit->emitIns_R_R(INS_ptest, emitTypeSize(TYP_SIMD16), op1Reg, op2->gtRegNum);
             emit->emitIns_R(INS_setb, EA_1BYTE, targetReg);
@@ -1312,7 +1312,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
         case NI_SSE41_TestMixOnesZeros:
         case NI_SSE41_TestNotZAndNotC:
         {
-            assert(Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType) == INS_ptest);
+            assert(HWIntrinsicInfo::lookupIns(intrinsicId, node->gtSIMDBaseType) == INS_ptest);
             emit->emitIns_R_R(INS_xor, EA_4BYTE, targetReg, targetReg);
             emit->emitIns_R_R(INS_ptest, emitTypeSize(TYP_SIMD16), op1Reg, op2->gtRegNum);
             emit->emitIns_R(INS_seta, EA_1BYTE, targetReg);
@@ -1322,7 +1322,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
         case NI_SSE41_Extract:
         {
             regNumber   tmpTargetReg = REG_NA;
-            instruction ins          = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+            instruction ins          = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
             if (baseType == TYP_FLOAT)
             {
                 tmpTargetReg = node->ExtractTempReg();
@@ -1354,7 +1354,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
                 // can also occur if the consumer calls it directly and just doesn't pass a constant value.
                 regNumber baseReg = node->ExtractTempReg();
                 regNumber offsReg = node->GetSingleTempReg();
-                genHWIntrinsicJumpTableFallback(intrinsicID, op2->gtRegNum, baseReg, offsReg, emitSwCase);
+                genHWIntrinsicJumpTableFallback(intrinsicId, op2->gtRegNum, baseReg, offsReg, emitSwCase);
             }
             break;
         }
@@ -1375,7 +1375,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genSSE42Intrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     GenTree*       op2         = node->gtGetOp2();
     regNumber      targetReg   = node->gtRegNum;
@@ -1387,7 +1387,7 @@ void CodeGen::genSSE42Intrinsic(GenTreeHWIntrinsic* node)
     regNumber op2Reg = op2->gtRegNum;
     genConsumeOperands(node);
 
-    switch (intrinsicID)
+    switch (intrinsicId)
     {
         case NI_SSE42_Crc32:
             if (op1Reg != targetReg)
@@ -1424,11 +1424,11 @@ void CodeGen::genSSE42Intrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     var_types      baseType    = node->gtSIMDBaseType;
     emitAttr       attr        = EA_ATTR(node->gtSIMDSize);
     var_types      targetType  = node->TypeGet();
-    instruction    ins         = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+    instruction    ins         = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
     int            numArgs     = Compiler::numArgsOfHWIntrinsic(node);
     GenTree*       op1         = node->gtGetOp1();
     GenTree*       op2         = node->gtGetOp2();
@@ -1442,7 +1442,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
         genConsumeOperands(node);
     }
 
-    switch (intrinsicID)
+    switch (intrinsicId)
     {
         case NI_AVX_SetZeroVector256:
         {
@@ -1579,7 +1579,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
             GenTree* lastOp = nullptr;
             if (numArgs == 2)
             {
-                assert(intrinsicID == NI_AVX_ExtractVector128 || NI_AVX_ExtractVector128);
+                assert(intrinsicId == NI_AVX_ExtractVector128 || NI_AVX_ExtractVector128);
                 op1Reg = op1->gtRegNum;
                 op2Reg = op2->gtRegNum;
                 lastOp = op2;
@@ -1611,7 +1611,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
             auto emitSwCase = [&](int8_t i) {
                 if (numArgs == 3)
                 {
-                    if (intrinsicID == NI_AVX_ExtractVector128 || intrinsicID == NI_AVX2_ExtractVector128)
+                    if (intrinsicId == NI_AVX_ExtractVector128 || intrinsicId == NI_AVX2_ExtractVector128)
                     {
                         emit->emitIns_AR_R_I(ins, attr, op1Reg, 0, op2Reg, i);
                     }
@@ -1628,7 +1628,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
                 else
                 {
                     assert(numArgs == 2);
-                    assert(intrinsicID == NI_AVX_ExtractVector128 || intrinsicID == NI_AVX2_ExtractVector128);
+                    assert(intrinsicId == NI_AVX_ExtractVector128 || intrinsicId == NI_AVX2_ExtractVector128);
                     emit->emitIns_SIMD_R_R_I(ins, attr, targetReg, op1Reg, i);
                 }
             };
@@ -1646,7 +1646,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
                 // can also occur if the consumer calls it directly and just doesn't pass a constant value.
                 regNumber baseReg = node->ExtractTempReg();
                 regNumber offsReg = node->GetSingleTempReg();
-                genHWIntrinsicJumpTableFallback(intrinsicID, op3Reg, baseReg, offsReg, emitSwCase);
+                genHWIntrinsicJumpTableFallback(intrinsicId, op3Reg, baseReg, offsReg, emitSwCase);
             }
             break;
         }
@@ -1700,11 +1700,11 @@ void CodeGen::genBMI2Intrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genFMAIntrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic  intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic  intrinsicId = node->gtHWIntrinsicId;
     var_types       baseType    = node->gtSIMDBaseType;
-    HWIntrinsicFlag flags       = Compiler::flagsOfHWIntrinsic(intrinsicID);
+    HWIntrinsicFlag flags       = HWIntrinsicInfo::lookupFlags(intrinsicId);
     emitAttr        attr        = EA_ATTR(node->gtSIMDSize);
-    instruction     ins         = Compiler::insOfHWIntrinsic(intrinsicID, baseType);
+    instruction     ins         = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
     GenTree*        op1         = node->gtGetOp1();
     regNumber       targetReg   = node->gtRegNum;
 
@@ -1799,7 +1799,7 @@ void CodeGen::genFMAIntrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genLZCNTIntrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     regNumber      targetReg   = node->gtRegNum;
     assert(targetReg != REG_NA);
@@ -1807,7 +1807,7 @@ void CodeGen::genLZCNTIntrinsic(GenTreeHWIntrinsic* node)
     regNumber op1Reg     = op1->gtRegNum;
     genConsumeOperands(node);
 
-    assert(intrinsicID == NI_LZCNT_LeadingZeroCount);
+    assert(intrinsicId == NI_LZCNT_LeadingZeroCount);
 
     inst_RV_RV(INS_lzcnt, targetReg, op1Reg, targetType, emitTypeSize(targetType));
 
@@ -1833,7 +1833,7 @@ void CodeGen::genPCLMULQDQIntrinsic(GenTreeHWIntrinsic* node)
 //
 void CodeGen::genPOPCNTIntrinsic(GenTreeHWIntrinsic* node)
 {
-    NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
+    NamedIntrinsic intrinsicId = node->gtHWIntrinsicId;
     GenTree*       op1         = node->gtGetOp1();
     regNumber      targetReg   = node->gtRegNum;
     assert(targetReg != REG_NA);
@@ -1841,7 +1841,7 @@ void CodeGen::genPOPCNTIntrinsic(GenTreeHWIntrinsic* node)
     regNumber op1Reg     = op1->gtRegNum;
     genConsumeOperands(node);
 
-    assert(intrinsicID == NI_POPCNT_PopCount);
+    assert(intrinsicId == NI_POPCNT_PopCount);
 
     inst_RV_RV(INS_popcnt, targetReg, op1Reg, targetType, emitTypeSize(targetType));
 
index 84b54896e1cabc73e9313cd619d7b3c3c9aa6478..b8e6deca07efa4a827f9d1a4e272bbb5ef3ad285 100644 (file)
@@ -157,39 +157,6 @@ InstructionSet HWIntrinsicInfo::lookupIsa(const char* className)
     return InstructionSet_ILLEGAL;
 }
 
-//------------------------------------------------------------------------
-// isaOfHWIntrinsic: map named intrinsic value to its instruction set
-//
-// Arguments:
-//    intrinsic -- id of the intrinsic function.
-//
-// Return Value:
-//    instruction set of the intrinsic.
-//
-InstructionSet Compiler::isaOfHWIntrinsic(NamedIntrinsic intrinsic)
-{
-    assert(intrinsic != NI_Illegal);
-    assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
-    return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].isa;
-}
-
-//------------------------------------------------------------------------
-// ivalOfHWIntrinsic: get the imm8 value of this intrinsic from the hwIntrinsicInfoArray table
-//
-// Arguments:
-//    intrinsic -- id of the intrinsic function.
-//
-// Return Value:
-//     The imm8 value that is implicit for this intrinsic, or -1 for intrinsics that do not take an immediate, or for
-//     which the immediate is an explicit argument.
-//
-int Compiler::ivalOfHWIntrinsic(NamedIntrinsic intrinsic)
-{
-    assert(intrinsic != NI_Illegal);
-    assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
-    return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].ival;
-}
-
 //------------------------------------------------------------------------
 // simdSizeOfHWIntrinsic: get the SIMD size of this intrinsic
 //
@@ -207,7 +174,7 @@ unsigned Compiler::simdSizeOfHWIntrinsic(NamedIntrinsic intrinsic, CORINFO_SIG_I
 {
     assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
 
-    HWIntrinsicFlag flags = flagsOfHWIntrinsic(intrinsic);
+    HWIntrinsicFlag flags = HWIntrinsicInfo::lookupFlags(intrinsic);
 
     if ((flags & HW_Flag_UnfixedSIMDSize) == 0)
     {
@@ -327,57 +294,6 @@ GenTree* Compiler::lastOpOfHWIntrinsic(GenTreeHWIntrinsic* node, int numArgs)
     }
 }
 
-//------------------------------------------------------------------------
-// insOfHWIntrinsic: get the instruction of the given intrinsic
-//
-// Arguments:
-//    intrinsic -- id of the intrinsic function.
-//    type      -- vector base type of this intrinsic
-//
-// Return Value:
-//     the instruction of the given intrinsic on the base type
-//     return INS_invalid for unsupported base types
-//
-instruction Compiler::insOfHWIntrinsic(NamedIntrinsic intrinsic, var_types type)
-{
-    assert(intrinsic != NI_Illegal);
-    assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
-    assert(type >= TYP_BYTE && type <= TYP_DOUBLE);
-    return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].ins[type - TYP_BYTE];
-}
-
-//------------------------------------------------------------------------
-// categoryOfHWIntrinsic: get the category of the given intrinsic
-//
-// Arguments:
-//    intrinsic -- id of the intrinsic function.
-//
-// Return Value:
-//     the category of the given intrinsic
-//
-HWIntrinsicCategory Compiler::categoryOfHWIntrinsic(NamedIntrinsic intrinsic)
-{
-    assert(intrinsic != NI_Illegal);
-    assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
-    return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].category;
-}
-
-//------------------------------------------------------------------------
-// HWIntrinsicFlag: get the flags of the given intrinsic
-//
-// Arguments:
-//    intrinsic -- id of the intrinsic function.
-//
-// Return Value:
-//     the flags of the given intrinsic
-//
-HWIntrinsicFlag Compiler::flagsOfHWIntrinsic(NamedIntrinsic intrinsic)
-{
-    assert(intrinsic != NI_Illegal);
-    assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);
-    return hwIntrinsicInfoArray[intrinsic - NI_HW_INTRINSIC_START - 1].flags;
-}
-
 //------------------------------------------------------------------------
 // getArgForHWIntrinsic: get the argument from the stack and match  the signature
 //
@@ -421,7 +337,7 @@ GenTree* Compiler::getArgForHWIntrinsic(var_types argType, CORINFO_CLASS_HANDLE
 //
 int Compiler::immUpperBoundOfHWIntrinsic(NamedIntrinsic intrinsic)
 {
-    assert(categoryOfHWIntrinsic(intrinsic) == HW_Category_IMM);
+    assert(HWIntrinsicInfo::lookupCategory(intrinsic) == HW_Category_IMM);
     switch (intrinsic)
     {
         case NI_AVX_Compare:
@@ -429,7 +345,7 @@ int Compiler::immUpperBoundOfHWIntrinsic(NamedIntrinsic intrinsic)
             return 31; // enum FloatComparisonMode has 32 values
 
         default:
-            assert((flagsOfHWIntrinsic(intrinsic) & HW_Flag_FullRangeIMM) != 0);
+            assert((HWIntrinsicInfo::lookupFlags(intrinsic) & HW_Flag_FullRangeIMM) != 0);
             return 255;
     }
 }
@@ -448,7 +364,7 @@ int Compiler::immUpperBoundOfHWIntrinsic(NamedIntrinsic intrinsic)
 //
 GenTree* Compiler::impNonConstFallback(NamedIntrinsic intrinsic, var_types simdType, var_types baseType)
 {
-    assert((flagsOfHWIntrinsic(intrinsic) & HW_Flag_NoJmpTableIMM) != 0);
+    assert((HWIntrinsicInfo::lookupFlags(intrinsic) & HW_Flag_NoJmpTableIMM) != 0);
     switch (intrinsic)
     {
         case NI_SSE2_ShiftLeftLogical:
@@ -485,12 +401,12 @@ GenTree* Compiler::impNonConstFallback(NamedIntrinsic intrinsic, var_types simdT
 //
 bool Compiler::isImmHWIntrinsic(NamedIntrinsic intrinsic, GenTree* lastOp)
 {
-    if (categoryOfHWIntrinsic(intrinsic) != HW_Category_IMM)
+    if (HWIntrinsicInfo::lookupCategory(intrinsic) != HW_Category_IMM)
     {
         return false;
     }
 
-    if ((flagsOfHWIntrinsic(intrinsic) & HW_Flag_MaybeIMM) != 0 && genActualType(lastOp->TypeGet()) != TYP_INT)
+    if ((HWIntrinsicInfo::lookupFlags(intrinsic) & HW_Flag_MaybeIMM) != 0 && genActualType(lastOp->TypeGet()) != TYP_INT)
     {
         return false;
     }
@@ -515,7 +431,7 @@ GenTree* Compiler::addRangeCheckIfNeeded(NamedIntrinsic intrinsic, GenTree* last
     assert(lastOp != nullptr);
     // Full-range imm-intrinsics do not need the range-check
     // because the imm-parameter of the intrinsic method is a byte.
-    if (mustExpand && ((flagsOfHWIntrinsic(intrinsic) & HW_Flag_FullRangeIMM) == 0) &&
+    if (mustExpand && ((HWIntrinsicInfo::lookupFlags(intrinsic) & HW_Flag_FullRangeIMM) == 0) &&
         isImmHWIntrinsic(intrinsic, lastOp))
     {
         assert(!lastOp->IsCnsIntOrI());
@@ -693,9 +609,9 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic        intrinsic,
                                   CORINFO_SIG_INFO*     sig,
                                   bool                  mustExpand)
 {
-    InstructionSet      isa      = isaOfHWIntrinsic(intrinsic);
-    HWIntrinsicCategory category = categoryOfHWIntrinsic(intrinsic);
-    HWIntrinsicFlag     flags    = flagsOfHWIntrinsic(intrinsic);
+    InstructionSet      isa      = HWIntrinsicInfo::lookupIsa(intrinsic);
+    HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsic);
+    HWIntrinsicFlag     flags    = HWIntrinsicInfo::lookupFlags(intrinsic);
     int                 numArgs  = sig->numArgs;
     var_types           retType  = JITtype2varType(sig->retType);
     var_types           baseType = TYP_UNKNOWN;
@@ -818,7 +734,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic        intrinsic,
         var_types               argType = TYP_UNKNOWN;
 
         assert(numArgs >= 0);
-        assert(insOfHWIntrinsic(intrinsic, baseType) != INS_invalid);
+        assert(HWIntrinsicInfo::lookupIns(intrinsic, baseType) != INS_invalid);
         assert(simdSize == 32 || simdSize == 16);
 
         GenTreeHWIntrinsic* retNode = nullptr;
index 67e2526ef2adc116d9520e15ebf01ee8c02218c6..2935057b3512850910fa12b1eac3914f7fe733bd 100644 (file)
@@ -141,10 +141,53 @@ struct HWIntrinsicInfo
     static NamedIntrinsic lookupId(const char* className, const char* methodName);
     static InstructionSet lookupIsa(const char* className);
 
+    // Member lookup
+
+    static NamedIntrinsic lookupId(NamedIntrinsic id)
+    {
+        return lookup(id).id;
+    }
+
     static const char* lookupName(NamedIntrinsic id)
     {
         return lookup(id).name;
     }
+
+    static InstructionSet lookupIsa(NamedIntrinsic id)
+    {
+        return lookup(id).isa;
+    }
+
+    static int lookupIval(NamedIntrinsic id)
+    {
+        return lookup(id).ival;
+    }
+
+    static unsigned lookupSimdSize(NamedIntrinsic id)
+    {
+        return lookup(id).simdSize;
+    }
+
+    static int lookupNumArgs(NamedIntrinsic id)
+    {
+        return lookup(id).numArgs;
+    }
+
+    static instruction lookupIns(NamedIntrinsic id, var_types type)
+    {
+        assert((type >= TYP_BYTE) && (type <= TYP_DOUBLE));
+        return lookup(id).ins[type - TYP_BYTE];
+    }
+
+    static HWIntrinsicCategory lookupCategory(NamedIntrinsic id)
+    {
+        return lookup(id).category;
+    }
+
+    static HWIntrinsicFlag lookupFlags(NamedIntrinsic id)
+    {
+        return lookup(id).flags;
+    }
 };
 
 #endif // FEATURE_HW_INTRINSICS
index 3945ba53c6e4948ba2b376529ef6df2dbffaba36..11066becc768f96435714c2584e74bcb59c426b0 100644 (file)
@@ -2309,10 +2309,10 @@ void Lowering::ContainCheckSIMD(GenTreeSIMD* simdNode)
 bool Lowering::IsContainableHWIntrinsicOp(GenTreeHWIntrinsic* containingNode, GenTree* node, bool* supportsRegOptional)
 {
     NamedIntrinsic      containingIntrinsicID = containingNode->gtHWIntrinsicId;
-    HWIntrinsicCategory category              = Compiler::categoryOfHWIntrinsic(containingIntrinsicID);
+    HWIntrinsicCategory category              = HWIntrinsicInfo::lookupCategory(containingIntrinsicID);
 
     // We shouldn't have called in here if containingNode doesn't support containment
-    assert((Compiler::flagsOfHWIntrinsic(containingIntrinsicID) & HW_Flag_NoContainment) == 0);
+    assert((HWIntrinsicInfo::lookupFlags(containingIntrinsicID) & HW_Flag_NoContainment) == 0);
 
     // containingNode supports nodes that read from an aligned memory address
     //
@@ -2503,8 +2503,8 @@ bool Lowering::IsContainableHWIntrinsicOp(GenTreeHWIntrinsic* containingNode, Ge
 void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
 {
     NamedIntrinsic      intrinsicID = node->gtHWIntrinsicId;
-    HWIntrinsicCategory category    = Compiler::categoryOfHWIntrinsic(intrinsicID);
-    HWIntrinsicFlag     flags       = Compiler::flagsOfHWIntrinsic(intrinsicID);
+    HWIntrinsicCategory category    = HWIntrinsicInfo::lookupCategory(intrinsicID);
+    HWIntrinsicFlag     flags       = HWIntrinsicInfo::lookupFlags(intrinsicID);
     int                 numArgs     = Compiler::numArgsOfHWIntrinsic(node);
     var_types           baseType    = node->gtSIMDBaseType;
 
@@ -2638,7 +2638,7 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
             unreached();
         }
 
-        if (Compiler::categoryOfHWIntrinsic(intrinsicID) == HW_Category_IMM)
+        if (HWIntrinsicInfo::lookupCategory(intrinsicID) == HW_Category_IMM)
         {
             GenTree* lastOp = Compiler::lastOpOfHWIntrinsic(node, numArgs);
             assert(lastOp != nullptr);
index 96af2f6d8a8c6d438b01d0dee0e7236bce2fc14f..15103100a4cbe75fd4d999b0ae369b273d85a0d6 100644 (file)
@@ -2290,11 +2290,11 @@ int LinearScan::BuildSIMD(GenTreeSIMD* simdTree)
 //
 int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
 {
-    NamedIntrinsic      intrinsicID = intrinsicTree->gtHWIntrinsicId;
+    NamedIntrinsic      intrinsicId = intrinsicTree->gtHWIntrinsicId;
     var_types           baseType    = intrinsicTree->gtSIMDBaseType;
-    InstructionSet      isa         = Compiler::isaOfHWIntrinsic(intrinsicID);
-    HWIntrinsicCategory category    = Compiler::categoryOfHWIntrinsic(intrinsicID);
-    HWIntrinsicFlag     flags       = Compiler::flagsOfHWIntrinsic(intrinsicID);
+    InstructionSet      isa         = HWIntrinsicInfo::lookupIsa(intrinsicId);
+    HWIntrinsicCategory category    = HWIntrinsicInfo::lookupCategory(intrinsicId);
+    HWIntrinsicFlag     flags       = HWIntrinsicInfo::lookupFlags(intrinsicId);
     int                 numArgs     = Compiler::numArgsOfHWIntrinsic(intrinsicTree);
 
     if ((isa == InstructionSet_AVX) || (isa == InstructionSet_AVX2))
@@ -2355,7 +2355,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
 
         if ((category == HW_Category_IMM) && ((flags & HW_Flag_NoJmpTableIMM) == 0))
         {
-            if (Compiler::isImmHWIntrinsic(intrinsicID, lastOp) && !lastOp->isContainedIntOrIImmed())
+            if (Compiler::isImmHWIntrinsic(intrinsicId, lastOp) && !lastOp->isContainedIntOrIImmed())
             {
                 assert(!lastOp->IsCnsIntOrI());
 
@@ -2375,7 +2375,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
         // Note that the default case for building uses will handle the RMW flag, but if the uses
         // are built in the individual cases, buildUses is set to false, and any RMW handling (delayFree)
         // must be handled within the case.
-        switch (intrinsicID)
+        switch (intrinsicId)
         {
             case NI_SSE_CompareEqualOrderedScalar:
             case NI_SSE_CompareEqualUnorderedScalar:
@@ -2598,7 +2598,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
 
             default:
             {
-                assert((intrinsicID > NI_HW_INTRINSIC_START) && (intrinsicID < NI_HW_INTRINSIC_END));
+                assert((intrinsicId > NI_HW_INTRINSIC_START) && (intrinsicId < NI_HW_INTRINSIC_END));
                 break;
             }
         }