Consider the following snippet:
int f(
long x0, long x1, long x2, long x3,
long x4, long x5, long x6, long x7,
char c, short s
) {
return c + s;
}
int g() {
return f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
}When compiled with: --target=aarch64-none-eabi -mbig-endian -O2 -fno-inline -S
The following assembly is produced:
f: // @f
;...
ldrb w8, [sp, #4] ; @@@ should be '#7'
ldrsh w9, [sp, #12] ; @@@ should be '#14'
;...
g: // @g
; ...
strh w8, [sp, #12] ; @@@ should be '#14'
strb w9, [sp, #4] ; @@@ should be '#7'
bl f
; ...The actual argument positions on the stack should be as in the comments (as per aarch64_pcs - C14, C15). The attached patch fixes this issue.