New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add powerpc64le Linux support #979
Conversation
Is |
Yes, powerpc64 is big endian. We hope to get big endian working, but for now are concentrating on the little endian port (powerpc64le). |
@@ -919,7 +919,7 @@ static const uintptr_t ObjCReservedBitsMask = | |||
static const unsigned ObjCReservedLowBits = | |||
SWIFT_ABI_X86_64_OBJC_NUM_RESERVED_LOW_BITS; | |||
|
|||
#elif defined(__arm64__) | |||
#elif defined(__arm64__) || defined(__powerpc64__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is __powerpc64__
defined on BE, LE or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is defined on both BE and LE targets:
$ uname -m
ppc64le
$ cpp -dM < /dev/null | grep __powerpc64__
#define __powerpc64__ 1
$ uname -m
ppc64
$ cpp -dM < /dev/null | grep __powerpc64__
#define __powerpc64__ 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above this block says that lib/IRGen/SwiftTargetInfo.cpp
needs adjustments (you need to add a configurePowerPC
function there).
How far does this patch allows the port to go? Does the standard library build? Does hello world work? Do the tests run? |
The powerpc64le port builds and runs the test suite with a few failures:
And hello world works:
|
@antonblanchard I'm really impressed! |
Did you try the validation test suite |
Thanks, that's given me a few more failing tests to sort out:
|
Again, very impressed it is just 8 tests in total! |
Yes, I'm surprised by how clean the port is. Having the compiler written in c++ (vs the target language), and pulling in clang to get the ABI parameter passing rules helps. Other LLVM based languages have required a lot more work. Big endian still requires work, but we can attack that once the little endian port is solid. |
I'm not sure of the preferred workflow, but I'm happy to rebase and squash these commits. |
self = ${Self}(Builtin.int_bswap_${BuiltinName}(value._value) ) | ||
#else | ||
_UnsupportedArchitectureError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the unsupported error so that we get a loud error for new architectures. Just add an explicit #elseif arch(powerpc64)
for BE (here and below).
Yes, we prefer rebasing/squashing. |
1e3c7fb
to
8ce2507
Compare
break; | ||
case llvm::Triple::ArchType::ppc64le: | ||
addTargetConfigOption("arch", "powerpc64le"); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part needs a test like test/BuildConfigurations/x64LinuxTarget.swift
for each supported triple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will add these tests
@antonblanchard Thank you! Looks good, but I have two more comments. |
Very cool, thank you for working on adding this! |
This patch adds powerpc64le Linux support. While the patch also adds the matching powerpc64 bits, there are endian issues that need to be sorted out. The PowerPC LLVM changes for the swift ABI (eg returning three element non-homogeneous aggregates) are still in the works, but a simple LLVM fix to allow those aggregates results in swift passing all but 8 test cases.
8ce2507
to
b1827d8
Compare
@antonblanchard The ObjC values should be dynamically dead as far as I understand. If you find they are also statically unused -- feel free to remove them! |
I ran tests on Ubuntu 14.04 x86_64 and OS X, and see no regressions. Merging. Thank you! |
Add powerpc64le Linux support
Thanks for your help @gribozavr! |
This patch adds powerpc64le Linux support. While the patch also adds
the matching powerpc64 bits, there are endian issues that need to be
sorted out.
The PowerPC LLVM changes for the swift ABI (eg returning three element
non-homogeneous aggregates) are still in the works, but a simple LLVM
fix to allow those aggregates results in swift passing all but 8
test cases.
Note: It would be nice if swift had conditional compilation based on pointer size, a
number of the test cases only care if the target is 32 or 64 bit.