X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=doc%2Frandom-notes.txt;h=fc8f443d24aed5f59b21b5074f917aab48801a4f;hb=615000d5b61a78df5d530c3eda32753ce5503c1e;hp=3df388cf43b8344dcd41cca54c28ec7dd750fd22;hpb=bb757430d461522091e8a41477a0c961a0072e41;p=fw%2Fsdcc diff --git a/doc/random-notes.txt b/doc/random-notes.txt index 3df388cf..fc8f443d 100644 --- a/doc/random-notes.txt +++ b/doc/random-notes.txt @@ -208,3 +208,175 @@ which is more like: First looking in SDCCicode.c for the stuff that generates function calls: Probably a bug in geniCodeParams. Nope, a bug in my stuff :) + +Michael +------- +Comparing the dhrystone code vs Hitech C v7.50 + +cp: + ld hl,__r + ld (_Next_Ptr_Glob),hl +vs: + ld hl,#__r + ld iy,#_Next_Ptr_Glob + ld 0(iy),l + ld 1(iy),h + +cp: + ld a,#<__r + add a,#0x27 + ld iy,#_Ptr_Glob + ld 0(iy),a + ld a,#>__r + adc a,#0x00 + ld 1(iy),a +vs: + ld hl,__r+027h + ld (_Ptr_Glob),hl + +cp: + ld iy,#_Next_Ptr_Glob + ld a,0(iy) + ld (hl),a + inc hl + ld a,1(iy) + ld (hl),a + +vs: + ld bc,(_Next_Ptr_Glob) + ld hl,(_Ptr_Glob) + ld (hl),c + inc hl + ld (hl),b + + +cp: + ld bc,(_Ptr_Glob) + ld l,c + ld h,b + inc hl + inc hl + ld (hl),#0x00 + inc hl + ld (hl),#0x00 +vs: + ld iy,(_Ptr_Glob) + ld (iy+2),0 + ld (iy+3),0 + + +strcpy is inlined as: +u12: + ld a,(hl) + ldi + or a + jp nz,u12 + +cp: + ld a,#<_Arr_2_Glob + add a,#0x2E + ld -80(ix),a + ld a,#>_Arr_2_Glob + adc a,#0x03 + ld -79(ix),a +; genAssign (pointer) +; AOP_STK for _main_sloc1_1_0 + ld l,-80(ix) + ld h,-79(ix) + ld (hl),#0x0A + inc hl + ld (hl),#0x00 +vs: + ld hl,0Ah + ld (_Arr_2_Glob+032Eh),hl + +cp: + ld a,-72(ix) + or a,a + jp nz,00126$ + ld a,-71(ix) + and a,#0x03 +; Rule 4: Changed jp order + jp z,00127$ +00126$: + jp 00102$ +00127$: + +vs: + ld (ix+-7),c + ld (ix+-6),b + ld a,c + ld l,a + ld a,b + and 03h + ld h,a + ld a,l + or h + jp nz,l12 + +cp: + ld a,-82(ix) + or a,-81(ix) + sub a,#0x01 + ld a,#0x00 + rla + ld iy,#_Bool_Glob + ld 0(iy),a + ld 1(iy),#0x00 + +vs: + ld a,l + or h + ld hl,01h + jp z,u42 + dec hl +u42: + ld (_Bool_Glob),hl + +;C:\TEMP\DHRY.C: 173: Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc; +is turned into: + ld l,(ix+-13) + ld h,(ix+-12) + ld d,h + ld e,l + add hl,hl + add hl,hl + add hl,de + +Comapring two types of cmpeq: + ld a,c ; 4 + cp a,#0xFB ; 7 + jp nz,00119$ ; 10 + ld a,b ; 4 + cp a,#0xFF ; 7 +; Rule 5: Changed jump logic + jp z,00101$ ; 10 +00119$: + ; 21 to 42 + +vs: + ld hl,#val ; 10 + or a ; 4 + sbc hl,bc ; 15 + jp z,... ; 10 + ; Always 39 - worse + +Comaring break even point for shift: + ld a,#0x03+1 ; 7 + jp 00114$ ; 10 +00113$: + sra b ; 8 + rr c ; 8 +00114$: + dec a ; 4 + jp nz,00113$ ; 10 + + ; Bytes: 2+3+1+1+1+3 = 11 + ; t-states = 17+n*30 +vs + sra b + rr c ... + ; Bytes: 2*n + ; t-states = 16*n + + Ah, pick 4 \ No newline at end of file