AVR: target/116295 - Fix unrecognizable insn with __flash read.
Some loads from non-generic address-spaces are performed by libgcc calls, and they don't have a POST_INC form. Don't consider such insns when running -mfuse-add. PR target/116295 gcc/ * config/avr/avr.cc (Mem_Insn::Mem_Insn): Don't consider MEMs that are avr_mem_memx_p or avr_load_libgcc_p. gcc/testsuite/ * gcc.target/avr/torture/pr116295.c: New test.
This commit is contained in:
parent
f6a41ebb5b
commit
c4d3dba253
2 changed files with 26 additions and 0 deletions
|
@ -2121,6 +2121,10 @@ avr_pass_fuse_add::Mem_Insn::Mem_Insn (rtx_insn *insn)
|
|||
else
|
||||
return;
|
||||
|
||||
if (avr_mem_memx_p (mem)
|
||||
|| avr_load_libgcc_p (mem))
|
||||
return;
|
||||
|
||||
addr = XEXP (mem, 0);
|
||||
addr_code = GET_CODE (addr);
|
||||
|
||||
|
|
22
gcc/testsuite/gcc.target/avr/torture/pr116295.c
Normal file
22
gcc/testsuite/gcc.target/avr/torture/pr116295.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* { dg-do link } */
|
||||
/* { dg-additional-options "-std=gnu99" } */
|
||||
|
||||
#ifdef __FLASH
|
||||
|
||||
long val;
|
||||
|
||||
__attribute__((used))
|
||||
const __flash long*
|
||||
load4_flash (const __flash long *p)
|
||||
{
|
||||
val += *p++;
|
||||
val += *p++;
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int main (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue