]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: target/114100 - Factor in -mtiny-stack in frame pointer adjustments
authorGeorg-Johann Lay <avr@gjlay.de>
Sat, 2 Mar 2024 09:03:06 +0000 (10:03 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Sat, 2 Mar 2024 09:14:21 +0000 (10:14 +0100)
gcc/
PR target/114100
* config/avr/avr.cc (avr_out_plus_1) [-mtiny-stack]: Only adjust
the low part of the frame pointer with 8-bit stack pointer.

gcc/config/avr/avr.cc

index 94ef7c591a9ffaf081f814e0f50c985bcea64f30..d39d6707c97749e743354dce07e92e80370cf41d 100644 (file)
@@ -8983,14 +8983,17 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc,
          && frame_pointer_needed
          && REGNO (xop[0]) == FRAME_POINTER_REGNUM)
        {
-         rtx xval16 = simplify_gen_subreg (HImode, xval, imode, i);
-         if (xval16 == const1_rtx || xval16 == constm1_rtx)
+         if (AVR_HAVE_8BIT_SP)
+           {
+             avr_asm_len ("subi %A0,%n2", xop, plen, 1);
+             return;
+           }
+         else if (xop[2] == const1_rtx || xop[2] == constm1_rtx)
            {
-             avr_asm_len ((code == PLUS) == (xval16 == const1_rtx)
+             avr_asm_len (xop[2] == const1_rtx
                           ? "ld __tmp_reg__,%a0+"
                           : "ld __tmp_reg__,-%a0", xop, plen, 1);
-             i++;
-             continue;
+             return;
            }
        }