Skip to content

Commit

Permalink
Clean up in importervectorization.cpp (#108818)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Oct 18, 2024
1 parent be013ed commit 8734660
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 318 deletions.
50 changes: 35 additions & 15 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4602,11 +4602,6 @@ class Compiler
Ordinal = 4,
OrdinalIgnoreCase = 5
};
enum class StringComparisonJoint
{
Eq, // (d1 == cns1) && (s2 == cns2)
Xor, // (d1 ^ cns1) | (s2 ^ cns2)
};
enum class StringComparisonKind
{
Equals,
Expand All @@ -4623,15 +4618,7 @@ class Compiler
int len,
int dataOffset,
StringComparison cmpMode);
GenTree* impCreateCompareInd(GenTreeLclVarCommon* obj,
var_types type,
ssize_t offset,
ssize_t value,
StringComparison ignoreCase,
StringComparisonJoint joint = StringComparisonJoint::Eq);
GenTree* impExpandHalfConstEqualsSWAR(
GenTreeLclVarCommon* data, WCHAR* cns, int len, int dataOffset, StringComparison cmpMode);
GenTree* impExpandHalfConstEqualsSIMD(
GenTree* impExpandHalfConstEquals(
GenTreeLclVarCommon* data, WCHAR* cns, int len, int dataOffset, StringComparison cmpMode);
GenTreeStrCon* impGetStrConFromSpan(GenTree* span);

Expand Down Expand Up @@ -9456,13 +9443,31 @@ class Compiler
{
return 8;
}
else if (size > 2)
if (size > 2)
{
return 4;
}
return size; // 2, 1, 0
}

// Similar to roundUpGPRSize, but returns var_types (zero-extendable) instead
var_types roundUpGPRType(unsigned size)
{
switch (roundUpGPRSize(size))
{
case 1:
return TYP_UBYTE;
case 2:
return TYP_USHORT;
case 4:
return TYP_INT;
case 8:
return TYP_LONG;
default:
unreached();
}
}

var_types roundDownMaxType(unsigned size)
{
assert(size > 0);
Expand Down Expand Up @@ -9490,6 +9495,21 @@ class Compiler
}
}

// Same as roundDownMaxType, but with an additional parameter to be more conservative
// around available ISAs, e.g. if AVX2 is not supported while AVX is -> downgrade to SIMD16.
var_types roundDownMaxType(unsigned size, bool conservative)
{
var_types result = roundDownMaxType(size);
#if defined(FEATURE_SIMD) && defined(TARGET_XARCH)
if (conservative && (result == TYP_SIMD32))
{
// Downgrade to SIMD16 if AVX2 is not supported
return compOpportunisticallyDependsOn(InstructionSet_AVX2) ? result : TYP_SIMD16;
}
#endif
return result;
}

enum UnrollKind
{
Memset,
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ enum GenTreeFlags : unsigned int
GTF_IND_ALLOW_NON_ATOMIC = 0x00100000, // GT_IND -- this memory access does not need to be atomic

GTF_IND_COPYABLE_FLAGS = GTF_IND_VOLATILE | GTF_IND_NONFAULTING | GTF_IND_UNALIGNED | GTF_IND_INITCLASS,
GTF_IND_FLAGS = GTF_IND_COPYABLE_FLAGS | GTF_IND_NONNULL | GTF_IND_TGT_NOT_HEAP | GTF_IND_TGT_HEAP | GTF_IND_INVARIANT,
GTF_IND_FLAGS = GTF_IND_COPYABLE_FLAGS | GTF_IND_NONNULL | GTF_IND_TGT_NOT_HEAP | GTF_IND_TGT_HEAP | GTF_IND_INVARIANT | GTF_IND_ALLOW_NON_ATOMIC,

GTF_ADDRMODE_NO_CSE = 0x80000000, // GT_ADD/GT_MUL/GT_LSH -- Do not CSE this node only, forms complex
// addressing mode
Expand Down
Loading

0 comments on commit 8734660

Please sign in to comment.