X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=doc%2Fchoices.txt;h=1442eca452e5bed8306897b5062f5c87fce84d0b;hb=d08e6df2202ed3f19b681221b502dedb3c6c8a28;hp=fd6cbab859d01cca36a164247512711ee00c6bab;hpb=57781964418caea528f9018cace1acb4a789d71c;p=fw%2Fsdcc diff --git a/doc/choices.txt b/doc/choices.txt index fd6cbab8..1442eca4 100644 --- a/doc/choices.txt +++ b/doc/choices.txt @@ -192,3 +192,51 @@ Pending optimisations: ... push iTemp4 +Swaps: + ld hl,bc ; 8 + ld bc,de ; 8 + ld de,hl ; 8 + +vs + push bc ; 11 + ld bc,de ; 8 + pop de ; 11 + +Swaps 2: + ld a,h + ld h,b + ld b,a + ld a,l + ld l,c + ld c,aq ; 6*4 = 24 + +Cleaning up the arguments to a call: + ld iy,#n ; 14 + add iy,sp ; 15 + ld sp,iy ; 10 = 39 + + pop af ; 5/byte + + +So for 8 bytes and above use the first form. + +Pointer assign: + ld hl,bc ; 4+4 + ld e,(hl) ; 7 + inc hl ; 6 + ld d,(hl) ; 7 + +vs: + ld a,(bc) ; 7 + ld e,a ; 4 + inc bc ; 6 + ld a,(bc) ; 7 + ld d,a ; 4 + +Same cost. Not worth it, although is does free up HL. + +Shift left signed on HL + sla l + rl h ; 8+8 = 16 + + add hl,hl ; 11