Skip to content

Commit

Permalink
Add check for 128-bit pointers
Browse files Browse the repository at this point in the history
Thanks to Andy Polyakov
  • Loading branch information
noloader committed Nov 6, 2023
1 parent c0e15c0 commit 3e3b8af
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions validat3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,43 @@ bool TestSettings()
pass = false;
}

// Machine word size does not agree with pointer size on Morello. Also see
// https://developer.arm.com/documentation/den0133/0100/Morello-prototype-architecture/Pointers-and-capabilities
if (sizeof(size_t) == 16)
{
std::cout << "passed: Your machine has 128-bit words.\n";
}
else if (sizeof(size_t) == 8)
{
std::cout << "passed: Your machine has 64-bit words.\n";
}
else if (sizeof(size_t) == 4)
{
std::cout << "passed: Your machine has 32-bit words.\n";
}
else
{
std::cout << "FAILED: Your machine uses unknown word size.\n";
pass = false;
}

// Morello uses 129-bit pointers. Also see
// https://developer.arm.com/documentation/den0133/0100/Morello-prototype-architecture/Pointers-and-capabilities
if (sizeof(void*) == 16)
{
std::cout << "passed: Your machine is 128-bit.\n";
std::cout << "passed: Your machine has 128-bit pointers.\n";
}
else if (sizeof(void*) == 8)
{
std::cout << "passed: Your machine is 64-bit.\n";
std::cout << "passed: Your machine has 64-bit pointers.\n";
}
else if (sizeof(void*) == 4)
{
std::cout << "passed: Your machine is 32-bit.\n";
std::cout << "passed: Your machine has 32-bit pointers.\n";
}
else
{
std::cout << "FAILED: Your machine is neither 32-bit nor 64-bit.\n";
std::cout << "FAILED: Your machine uses unknown pointer size.\n";
pass = false;
}

Expand Down

1 comment on commit 3e3b8af

@noloader
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also see ARM Morello Program. The Compile Farm has a machine with the Morello arch at cfarm240.cfarm.net.

Please sign in to comment.