Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm64: Always use SIMD features #66411

Merged
merged 2 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8856,8 +8856,10 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

#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.
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ||
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -805,7 +805,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
}
else
{
assert(featureSIMD);
assert(supportSIMDTypes());
unsigned int sizeBytes;

simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/hwintrinsicarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5260,7 +5260,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.
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/simd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/simdashwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down