AVR [patch] Invalid code generated for avrtiny
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
When assigning a local 16 bit value to a 16 bit IO register the compiler generates an LDD instruction which is not supported on this subarch. When the example below is compiled, the following instructions are generated for the assignment:
# [7] OCR0A := x;
ldi r30,lo8(2)
ldi r31,hi8(2)
add r30,r28
adc r31,r29
ldd r16,Z+1 <<<< Invalid instruction for avrtiny
out 39,r16
ld r16,Z+
out 38,r16
The attached patch fix the code generation sequence to only use the LD instruction.
Steps to reproduce:
program test16bitreg;
procedure t;
var x: word;
begin
OCR0A := x;
end;
begin
t;
end.
Mantis conversion info:
- Mantis ID: 38958
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 49473 (#9d6ceda5)