Skip to content
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

stage2: Fix softfloat support for PPC64(LE) #13100

Merged
merged 14 commits into from Oct 15, 2022

Conversation

topolarity
Copy link
Contributor

@topolarity topolarity commented Oct 7, 2022

With any luck, this is enough to get PPC64 compiling again.

@topolarity topolarity force-pushed the powerpc64le branch 3 times, most recently from a6fba9a to 6ae9546 Compare October 7, 2022 16:41
@topolarity
Copy link
Contributor Author

topolarity commented Oct 7, 2022

With these changes, I can now do:

$ zig build --prefix $(pwd)/ppc64le -Dtarget=powerpc64le-linux
$ qemu-ppc64le ./ppc64le/bin/zig version
0.10.0-dev.4250+6ed73720a
$ qemu-ppc64le ./ppc64le/bin/zig test test/behavior.zig -I . -I test -target x86_64-linux
853 passed; 562 skipped; 0 failed.

The behavior tests also pass (cross-compiling from x86-64):

$ zig test test/behavior.zig -I . -I test -target powerpc64le-linux --test-cmd qemu-ppc64le --test-cmd-bin
...
1331 passed; 100 skipped; 0 failed.

I haven't gone through the Zig bootstrap process for PPC, so I have not tested the LLVM backend on PowerPC. Likely there are still problems there due to the C ABI being incorrect/unimplemented for PPC.

} else if (common.want_aeabi) {
@export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = common.linkage });
} else {
@export(__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = common.linkage });
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This exports the "standard compiler-rt" symbol names on all targets, since this is what stage2 calls for softfloat in the backend.

Let me know if this is wrong - We can make the softfloat calls to the arch-specific ABI instead of re-exporting.

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

Looks great. Do you want to try enabling PPC64 in test/tests.zig (test_targets)?

@topolarity
Copy link
Contributor Author

All good here. Let's see what the CI thinks.

P.S. I almost regressed stage1 on accident with this PR - Might be worth re-enabling behavior tests on CI for stage1 until stage1 is gone, at least for one target.

@topolarity topolarity force-pushed the powerpc64le branch 3 times, most recently from 954b28e to d2a4edf Compare October 12, 2022 19:02
@topolarity topolarity mentioned this pull request Oct 13, 2022
This gets the behavior tests passing for stage1 again.
Stage 2's softfloat support still had a couple of gaps, which were
preventing us from lowering `f16` on this target. With any luck,
this is enough to get PPC64 working as a Tier 2 target again.
This change also exposes some of the existing functions under both the
PPC-style names symbols and the compiler-rt-style names, since Zig
currently lowers softfloat calls to the latter.
Also, f16 is not supported on this backend.
This instruction is not supported on this backend, so should
just be a noop.
@topolarity topolarity linked an issue Oct 14, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

powerpcle build fails
2 participants