[llvm] [AVR] Support stack realignment (PR #187129)
Ben Shi via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 07:08:44 PDT 2026
benshi001 wrote:
I also prefer current implementation to the previous one in March, but besides the above two failures, I also find some wrong assembly is generated.
```c++
void g(void *, void *);
void f() {
int a = 22;
_Alignas(8) int d = 55;
g(&a, &d);
}
```
The following assembly is gnererated
```
f: ; @f
; %bb.0: ; %entry
push r28
push r29
in r28, 61
in r29, 62
sbiw r28, 11
in r0, 63
cli
out 62, r29
out 63, r0
out 61, r28
movw r24, r28
adiw r24, 10
andi r24, 248
ldi r18, 22
ldi r19, 0
std Y+2, r19
std Y+1, r18
ldi r18, 55
ldi r19, 0
movw r22, r24
movw r30, r22
std Z+1, r19
st Z, r18
movw r24, r28
adiw r24, 1
call g
adiw r28, 11
in r0, 63
cli
out 62, r29
out 63, r0
out 61, r28
pop r29
pop r28
ret
```
The initial value `22` is stored to (Y+2):(Y+1), but avr-gcc stores `22` to (Y+11):(Y+10).
https://github.com/llvm/llvm-project/pull/187129
More information about the llvm-commits
mailing list