On 8/9/23 07:15, senthilkumar.selva...@microchip.com wrote:
Hi,

   After turning on FP -> SP elimination after Vlad fixed
   an elimination issue in 
https://gcc.gnu.org/git?p=gcc.git;a=commit;h=2971ff7b1d564ac04b537d907c70e6093af70832,
   I'm now running into reload failure if arithmetic is done on SP.

   For a call to a vararg functions, the avr target pushes args into the stack,
   calls the function, and then adjusts the SP back to where it was before the
   arg pushing occurred.

   So for code like

extern int foo(int, ...);
int bar(void) {
   long double l = 1.2345E6;
   foo(0, l);
   return 0;
}
With some efforts, I reproduced this problem.
   and

$ avr-gcc -mmcu=avr51 -Os ../20031208-1.c
...


   I guess the condition exists to ensure sp_off is always correct? Considering 
LRA already
   handles post_dec of SP just fine, perhaps it can allow RTX like

It is a very old code when LRA elimination was pretty constraint.

(set (reg/f:HI 32 __SP_L__)
      (plus:HI (reg/f:HI 32 __SP_L__)
               (const_int 10 [0xa]))) "../20031208-1.c":5:10 discrim 1 165 
{*addhi3_split}

   as long as the PLUS/MINUS is by a constant, and update sp_off accordingly?

   Or is there something the avr target has to do differently?

I think we can permit to stack pointer output reloads.  The only thing we need to update sp offset accurately for the original and reload insns.  I'll try to make the patch on this week.


Reply via email to