Arm64: Always use SIMD features (#66411)
authorKunal Pathak <Kunal.Pathak@microsoft.com>
Sat, 12 Mar 2022 04:35:06 +0000 (20:35 -0800)
committerGitHub <noreply@github.com>
Sat, 12 Mar 2022 04:35:06 +0000 (20:35 -0800)
* Use supportSIMDTypes() throughout

* Make featureSIMD only for non-arm64

src/coreclr/jit/compiler.cpp
src/coreclr/jit/compiler.h
src/coreclr/jit/hwintrinsic.cpp
src/coreclr/jit/hwintrinsicarm64.cpp
src/coreclr/jit/importer.cpp
src/coreclr/jit/morph.cpp
src/coreclr/jit/simd.cpp
src/coreclr/jit/simdashwintrinsic.cpp

index 3271e9d..883f065 100644 (file)
@@ -2666,8 +2666,12 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
 #endif // DEBUG
 
 #ifdef FEATURE_SIMD
+
+#ifndef TARGET_ARM64
     // Minimum bar for availing SIMD benefits is SSE2 on AMD64/x86.
     featureSIMD = jitFlags->IsSet(JitFlags::JIT_FLAG_FEATURE_SIMD);
+#endif
+
     setUsesSIMDTypes(false);
 #endif // FEATURE_SIMD
 
index 12992dd..2b87e7c 100644 (file)
@@ -8878,8 +8878,10 @@ private:
 
 #ifdef FEATURE_SIMD
 
+#ifndef TARGET_ARM64
     // Should we support SIMD intrinsics?
     bool featureSIMD;
+#endif
 
     // Should we recognize SIMD types?
     // We always do this on ARM64 to support HVA types.
index 9e158de..2f97389 100644 (file)
@@ -574,7 +574,7 @@ GenTree* Compiler::addRangeCheckForHWIntrinsic(GenTree* immOp, int immLowerBound
 //    true iff the given instruction set is enabled via configuration (environment variables, etc.).
 bool Compiler::compSupportsHWIntrinsic(CORINFO_InstructionSet isa)
 {
-    return compHWIntrinsicDependsOn(isa) && (featureSIMD || HWIntrinsicInfo::isScalarIsa(isa)) &&
+    return compHWIntrinsicDependsOn(isa) && (supportSIMDTypes() || HWIntrinsicInfo::isScalarIsa(isa)) &&
            (
 #ifdef DEBUG
                JitConfig.EnableIncompleteISAClass() ||
@@ -766,7 +766,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic        intrinsic,
     var_types              retType         = JITtype2varType(sig->retType);
     CorInfoType            simdBaseJitType = CORINFO_TYPE_UNDEF;
 
-    if ((retType == TYP_STRUCT) && featureSIMD)
+    if ((retType == TYP_STRUCT) && supportSIMDTypes())
     {
         unsigned int sizeBytes;
         simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(sig->retTypeSigClass, &sizeBytes);
@@ -805,7 +805,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic        intrinsic,
         }
         else
         {
-            assert(featureSIMD);
+            assert(supportSIMDTypes());
             unsigned int sizeBytes;
 
             simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
index f1ac376..d51cbc0 100644 (file)
@@ -325,7 +325,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic        intrinsic,
     assert(category != HW_Category_Scalar);
     assert(!HWIntrinsicInfo::isScalarIsa(HWIntrinsicInfo::lookupIsa(intrinsic)));
 
-    if (!featureSIMD || !IsBaselineSimdIsaSupported())
+    if (!supportSIMDTypes() || !IsBaselineSimdIsaSupported())
     {
         return nullptr;
     }
index 54ad01e..63e727d 100644 (file)
@@ -8916,7 +8916,7 @@ var_types Compiler::impImportCall(OPCODE                  opcode,
         }
 
 #ifdef FEATURE_SIMD
-        if (featureSIMD)
+        if (supportSIMDTypes())
         {
             call = impSIMDIntrinsic(opcode, newobjThis, clsHnd, methHnd, sig, mflags, pResolvedToken->token);
             if (call != nullptr)
index db19e8f..02c9df2 100644 (file)
@@ -5254,7 +5254,7 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree)
     }
 
 #ifdef FEATURE_SIMD
-    if (featureSIMD && varTypeIsStruct(elemTyp) && structSizeMightRepresentSIMDType(elemSize))
+    if (supportSIMDTypes() && varTypeIsStruct(elemTyp) && structSizeMightRepresentSIMDType(elemSize))
     {
         // If this is a SIMD type, this is the point at which we lose the type information,
         // so we need to set the correct type on the GT_IND.
index 5bf3b20..3f2d377 100644 (file)
@@ -950,7 +950,7 @@ const SIMDIntrinsicInfo* Compiler::getSIMDIntrinsicInfo(CORINFO_CLASS_HANDLE* in
                                                         CorInfoType*          simdBaseJitType,
                                                         unsigned*             sizeBytes)
 {
-    assert(featureSIMD);
+    assert(supportSIMDTypes());
     assert(simdBaseJitType != nullptr);
     assert(sizeBytes != nullptr);
 
@@ -1798,7 +1798,7 @@ GenTree* Compiler::createAddressNodeForSIMDInit(GenTree* tree, unsigned simdSize
 
 void Compiler::impMarkContiguousSIMDFieldAssignments(Statement* stmt)
 {
-    if (!featureSIMD || opts.OptimizationDisabled())
+    if (!supportSIMDTypes() || opts.OptimizationDisabled())
     {
         return;
     }
@@ -1891,7 +1891,7 @@ GenTree* Compiler::impSIMDIntrinsic(OPCODE                opcode,
                                     unsigned              methodFlags,
                                     int                   memberRef)
 {
-    assert(featureSIMD);
+    assert(supportSIMDTypes());
 
     // Exit early if we are not in one of the SIMD types.
     if (!isSIMDClass(clsHnd))
index 32a1ce5..d7a6d96 100644 (file)
@@ -170,7 +170,7 @@ GenTree* Compiler::impSimdAsHWIntrinsic(NamedIntrinsic        intrinsic,
                                         CORINFO_SIG_INFO*     sig,
                                         GenTree*              newobjThis)
 {
-    if (!featureSIMD)
+    if (!supportSIMDTypes())
     {
         // We can't support SIMD intrinsics if the JIT doesn't support the feature
         return nullptr;
@@ -356,7 +356,7 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic       intrinsic,
 {
     var_types simdBaseType = JitType2PreciseVarType(simdBaseJitType);
 
-    assert(featureSIMD);
+    assert(supportSIMDTypes());
     assert(retType != TYP_UNKNOWN);
     assert(varTypeIsArithmetic(simdBaseType));
     assert(simdSize != 0);