Hello,

I find a redundant stm8 code serial, that with the following c code

int ss(int s)
{
        s += 1;
        return s + 0x2030;
}

the following asms are generated

;       a.c: 2: int ss(int s)
;       -----------------------------------------
;        function ss
;       -----------------------------------------
_ss:
;       a.c: 4: s += 1;
        ldw     x, (0x03, sp)
        incw    x
        ldw     (0x03, sp), x
;       a.c: 5: return s + 0x2030;
        ldw     x, (0x03, sp)
        addw    x, #0x2030
        ret

I thougth the "ldw x, (0x03, sp)" is unnecessary here, can there be adding a rule to the peeph.def? like

replace restart {
    ldw %1, %2
    ldw %2, %1
} by {
    ldw %1, %2
}

Ben