mirror of
https://codeberg.org/wownero/RandomWOW
synced 2026-03-05 06:07:33 -05:00
@@ -112,11 +112,6 @@ namespace randomx {
|
||||
double hi;
|
||||
};
|
||||
|
||||
struct RegisterUsage {
|
||||
int32_t lastUsed;
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
constexpr uint32_t ScratchpadL1 = RANDOMX_SCRATCHPAD_L1 / sizeof(int_reg_t);
|
||||
constexpr uint32_t ScratchpadL2 = RANDOMX_SCRATCHPAD_L2 / sizeof(int_reg_t);
|
||||
constexpr uint32_t ScratchpadL3 = RANDOMX_SCRATCHPAD_L3 / sizeof(int_reg_t);
|
||||
@@ -131,21 +126,6 @@ namespace randomx {
|
||||
constexpr int RegisterNeedsDisplacement = 5; //x86 r13 register
|
||||
constexpr int RegisterNeedsSib = 4; //x86 r12 register
|
||||
|
||||
inline int getConditionRegister(RegisterUsage(®isterUsage)[RegistersCount]) {
|
||||
int min = INT_MAX;
|
||||
int minCount = 0;
|
||||
int minIndex;
|
||||
//prefer registers that have been used as a condition register fewer times
|
||||
for (unsigned i = 0; i < RegistersCount; ++i) {
|
||||
if (registerUsage[i].lastUsed < min || (registerUsage[i].lastUsed == min && registerUsage[i].count < minCount)) {
|
||||
min = registerUsage[i].lastUsed;
|
||||
minCount = registerUsage[i].count;
|
||||
minIndex = i;
|
||||
}
|
||||
}
|
||||
return minIndex;
|
||||
}
|
||||
|
||||
inline bool isPowerOf2(uint64_t x) {
|
||||
return (x & (x - 1)) == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user