Skip to content
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
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4185,7 +4185,7 @@ void CodeGen::genCreateAndStoreGCInfo(unsigned codeSize,
// -all callee-preserved registers in case of varargs
// -saved bool for synchronized methods

int preservedAreaSize = (2 + genCountBits(RBM_ENC_CALLEE_SAVED)) * REGSIZE_BYTES;
int preservedAreaSize = (2 + genCountBits((uint64_t)RBM_ENC_CALLEE_SAVED)) * REGSIZE_BYTES;

if (compiler->info.compIsVarArgs)
{
Expand Down
19 changes: 10 additions & 9 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,19 @@ inline regMaskTP genFindLowestReg(regMaskTP value)
* A rather simple routine that counts the number of bits in a given number.
*/

template <typename T>
inline unsigned genCountBits(T bits)
inline unsigned genCountBits(uint64_t bits)
{
unsigned cnt = 0;
return BitOperations::PopCount(bits);
}

while (bits)
{
cnt++;
bits -= genFindLowestBit(bits);
}
/*****************************************************************************
*
* A rather simple routine that counts the number of bits in a given number.
*/

return cnt;
inline unsigned genCountBits(uint32_t bits)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not just use BitOperations::PopCount directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting some compilation errors but didn't explore other options. I will double check before merging.

{
return BitOperations::PopCount(bits);
}

/*****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1741,10 +1741,10 @@ void emitter::emitCheckIGList()
}

// An IG can have at most one of the prolog and epilog flags set.
assert(genCountBits(currIG->igFlags & (IGF_FUNCLET_PROLOG | IGF_FUNCLET_EPILOG | IGF_EPILOG)) <= 1);
assert(genCountBits((unsigned)currIG->igFlags & (IGF_FUNCLET_PROLOG | IGF_FUNCLET_EPILOG | IGF_EPILOG)) <= 1);

// An IG can't have both IGF_HAS_ALIGN and IGF_REMOVED_ALIGN.
assert(genCountBits(currIG->igFlags & (IGF_HAS_ALIGN | IGF_REMOVED_ALIGN)) <= 1);
assert(genCountBits((unsigned)currIG->igFlags & (IGF_HAS_ALIGN | IGF_REMOVED_ALIGN)) <= 1);

if (currIG->igFlags & IGF_EXTEND)
{
Expand Down