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.
else
return;
+ if (avr_mem_memx_p (mem)
+ || avr_load_libgcc_p (mem))
+ return;
+
addr = XEXP (mem, 0);
addr_code = GET_CODE (addr);
--- /dev/null
+/* { 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;
+}