| Issue |
52880
|
| Summary |
[AVR] illegal "LPM Rx, Z+" is generated on avr2 family devices
|
| Labels |
backend:AVR
|
| Assignees |
|
| Reporter |
benshi001
|
LPMX is not avaliable on avr, but for the following C code
```
void foo(int *p, int a) {
static __flash const int arr[] = {123, 234, 456, 67};
p[0] = arr[a];
}
```
Build it with command
```
clang a.c -O3 -Wall --target=avr -mmcu=at90s8515 -S
```
The following assembly is generated
```
foo: ; @foo
; %bb.0: ; %entry
lsl r22
rol r23
subi r22, -lo8(foo.arr)
sbci r23, -hi8(foo.arr)
mov r30, r22
mov r31, r23
lpm r18, Z+
lpm r19, Z
mov r30, r24
mov r31, r25
st Z, r18
std Z+1, r19
ret
```
However the `lpm r19, Z` belongs to feature LPMX and is illegal on AVR2 family.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs