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
cmd/internal/obj/x86: automatically fix CMPL argument order #10199
Comments
CMPL is symmetric only if you're using EQ/NE on the result. I think liblink is right, x86 can only compare with a constant in one direction. Try compiling this with gcc (as a .s file): |
Umm, right, thanks. |
Yes, I agree liblink is correct. On ARM, CMP also can only take immediate
in one argument (the first).
|
It cannot be automatically fixed. There is only one position the constant can go in, and if you swap them it screws up later comparisons. The calling code must be careful to put the constant in the right place, and that's all we can do. |
CL 7697 caused doasm failures on 386:
I worked around the problem by reversing the order of the arguments during walk (CL 7810), but that's not the right fix. CMPL is symmetric, so liblink should gracefully generate CMPL BX, $0 instead.
The text was updated successfully, but these errors were encountered: