Skip to content

Commit

Permalink
Add high to all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalspathak committed May 29, 2024
1 parent 53c29d1 commit b4b08fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
21 changes: 13 additions & 8 deletions src/coreclr/jit/lsrabuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2825,19 +2825,24 @@ void LinearScan::buildIntervals()
availableRegCount = REG_INT_COUNT;
}

#ifdef HAS_MORE_THAN_64_REGISTERS
actualRegistersMask = regMaskTP(~RBM_NONE);
#else
if (availableRegCount < (sizeof(regMaskTP) * 8))
static_assert(sizeof(regMaskTP) == 2 * sizeof(regMaskSmall));

if (availableRegCount < (sizeof(regMaskSmall) * 8))
{
// Mask out the bits that are between 64 ~ availableRegCount
actualRegistersMask = (1ULL << availableRegCount) - 1;
// Mask out the bits that are between (8 * regMaskSmall) ~ availableRegCount
actualRegistersMask = regMaskTP((1ULL << availableRegCount) - 1);
}
else if (availableRegCount < (sizeof(regMaskTP) * 8))
{
// Mask out the bits that are between (8 * regMaskTP) ~ availableRegCount
// Subtract one extra for stack.
unsigned topRegCount = availableRegCount - sizeof(regMaskSmall) * 8 - 1;
actualRegistersMask = regMaskTP(~RBM_NONE, (1ULL << topRegCount) - 1);
}
else
{
actualRegistersMask = ~RBM_NONE;
actualRegistersMask = regMaskTP(~RBM_NONE, ~RBM_NONE);
}
#endif

#ifdef DEBUG
// Make sure we don't have any blocks that were not visited
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,6 @@ typedef uint64_t regMaskSmall;
#define REG_MASK_ALL_FMT "%016llX"
#endif

#ifdef TARGET_ARM64
#define HAS_MORE_THAN_64_REGISTERS 1
#define MORE_THAN_64_REGISTERS(x) x
#else
#define MORE_THAN_64_REGISTERS(x)
#endif // TARGET_ARM64

typedef regMaskSmall SingleTypeRegSet;
inline SingleTypeRegSet genRegMask(regNumber reg);
inline SingleTypeRegSet genRegMaskFloat(regNumber reg ARM_ARG(var_types type = TYP_DOUBLE));
Expand All @@ -244,9 +237,16 @@ struct regMaskTP
{
private:
regMaskSmall low;
MORE_THAN_64_REGISTERS(regMaskSmall high);
regMaskSmall high;

public:

regMaskTP(regMaskSmall lowMask, regMaskSmall highMask)
: low(lowMask)
, high(highMask)
{
}

regMaskTP(regMaskSmall regMask)
: low(regMask)
{
Expand Down

0 comments on commit b4b08fa

Please sign in to comment.