https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70677

            Bug ID: 70677
           Summary: Suboptimal cond on AVR: unneeded stack frame
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: night_ghost at ykoctpa dot ru
  Target Milestone: ---

here a lot of commands to deal with stack frame for only one byte

//(out of scope:
struct Point {
    byte x;
    byte y;
};

static boolean inline is_alt(point p){
    return (p.y & 0x40);
}
//)

static void panVel(point p){
    1e14:       cf 93           push    r28
    1e16:       df 93           push    r29
    1e18:       1f 92           push    r1
    1e1a:       cd b7           in      r28, 0x3d       ; 61
    1e1c:       de b7           in      r29, 0x3e       ; 62

    printSpeed(cnvGroundSpeed(),is_alt(p));
    1e1e:       96 fb           bst     r25, 6
    1e20:       22 27           eor     r18, r18
    1e22:       20 f9           bld     r18, 0
    1e24:       29 83           std     Y+1, r18        ; 0x01
    1e26:       0e 94 33 09     call    0x1266; 0x1266 <_ZL14cnvGroundSpeedv>
    1e2a:       ab 01           movw    r20, r22
    1e2c:       bc 01           movw    r22, r24
}

    1e2e:       29 81           ldd     r18, Y+1        ; 0x01
    1e30:       87 e8           ldi     r24, 0x87       ; 135
    1e32:       92 e0           ldi     r25, 0x02       ; 2
    1e34:       0e 94 c6 0e     call    0x1d8c; 0x1d8c <_ZL10printSpeedPKcfh>

    1e38:       0f 90           pop     r0
    1e3a:       df 91           pop     r29
    1e3c:       cf 91           pop     r28
    1e3e:       08 95           ret

R18 can be PUSH'ed, moved to r28 or even calculated after call to x1266

Reply via email to