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
pass: register allocation failure involving X0, Y0 #65
Comments
I hit this again, recently. I was trying to write my own abstraction around register allocation with some basic automatic stack spills, and so it was handing out physical YMM registers. Unfortunately, I can't use YMM and XMM registers at the same time, even if I do something like It turns out that quite a bit of patterns use the XMM registers to read the lower halves of YMM registers. |
@zeebo turns out the register allocator has a fundamental flaw in the way it handles aliased registers, see #100. I assume your issue may have the same root cause, and if so the PR #121 might help you. Would you be able to try that and report back if it resolves your problem? Either way, it would be great if you could share some code, both to help debug and to serve as a regression test. |
Thanks for the pointer to that PR. It seems to do significantly better, but it's not quite fixed yet. Here's a simple reproducer: func TestAsX(c ctx) {
TEXT("test", NOSPLIT, "func()")
VINSERTI128(Imm(1), Y0.AsX(), Y1, Y2)
RET()
} This fails with |
Thanks! That's with the PR applied? If so I'm pretty sure I know what the problem is. |
Yeah, I'm running on a27b743. |
Test for casting a physical register. Updates #65
Using #6 on this example we see that liveness analysis is reporting many registers live in their top 128-bits:
|
Okay the problem is caused by the following:
The result of these two problems is that Fixing either of the two problems would be enough. |
Adds a regression test based on klauspost/compress#186. This necessitated some related changes: * Mark "RET" as a terminal instruction * printer refactor to maintain compatibility with asmfmt * Tweaks to other regression tests to ensure they are run correctly in CI Updates #100 #65 #8
@zeebo reports that:
fails with an impossible register allocation. This is a direct translation from
Also
Full example: https://play.golang.org/p/NwsVZI9CVef (fails with 16 loop iterations). Note it was possible to work around the problem by lifting the allocations out of the loop.
Slack discussion https://gophers.slack.com/archives/C0VP8EF3R/p1552876283318100
The text was updated successfully, but these errors were encountered: