Closed MarkMcCaskey closed 3 months ago
Hey! I think the issue here is that you're using the X
register family (in which number 31 is xzr
), instead of the XSP register family (in which register number 31 is sp
).
It is a bit unfortunate that this distinction isn't handled automatically. When using static register codes it's easy to check if either format allows it, but right now with the setup of the register families they really cannot be substituted.
I've thought about just only allowing number 0 up to 30, and only allowing xzr
/ sp
in their literal forms, but that also rules out a bunch of cases where people might want to use those registers dynamically. So for now, you have to specify the family explicitly if you want to use an instruction that can address the stack pointer.
dynasm!(a
; add XSP(1), XSP(1), 1
);
Closing this as it seems to have been solved.
Hello! Thanks for this crate, it's been pretty useful for me! I noticed that I was unable to use immediate values in aarch64 almost all the time and I think I've narrowed down exactly when they do and do not work.
The simple case of using dynamic registers (either
X
orW
):fails with:
and the error message shows
which implies that it should be accepted.
and the non dynamic form
is accepted.
This affects every instruction I've tried (except
mov
), though some instructions are not affected under certain conditions. For example:fails with
but
is accepted.
This is on the currently published 2.0.0 crate. Notably
mov
is not affected by this, so the work around I've been using is to just use extra registers to move constants into first and do the operations without immediate values.After I finish up what I'm working on, I'd be interested in trying to fix this if no one else has by then. Thanks!