Hi, Here is my first fix to the 68k codegenerator. Hope it's ok. It's needed because the original codegenerator sometimes generated instructions like lsl.l #10,d2 which is definitely not a really good idea, and GNU AS screamed... :)
Example code: Program Bug2; Var BigArray : Array[0..64,0..255] Of DWord; Counter,Counter2 : DWord; Begin For Counter:=0 To 64 Do Begin For Counter2:=0 To 255 Do Begin BigArray[Counter,Counter2]:=1; End; End; End. Compiled (without my patch): movel #0,_COUNTER .L5: movel #0,_COUNTER2 .L10: movel _COUNTER,%d2 lea _BIGARRAY,%a2 lsll #10,%d2 <--- WHOOPS!!! movel _COUNTER2,%d3 lea (%a2,%d2.l),%a3 lsll #2,%d3 movel #1,(%a3,%d3.l) cmpl #255,_COUNTER2 bcc .L9 addql #1,_COUNTER2 jmp .L10 .L9: cmpl #64,_COUNTER bcc .L4 addql #1,_COUNTER jmp .L5 .L4: Same code compiled, with my patch: movel #0,_COUNTER .L5: movel #0,_COUNTER2 .L10: movel _COUNTER,%d2 lea _BIGARRAY,%a2 moveql #10,%d0 <- better huh? :) lsll %d0,%d2 <- movel _COUNTER2,%d3 lea (%a2,%d2.l),%a3 lsll #2,%d3 movel #1,(%a3,%d3.l) cmpl #255,_COUNTER2 bcc .L9 addql #1,_COUNTER2 jmp .L10 .L9: cmpl #64,_COUNTER bcc .L4 addql #1,_COUNTER jmp .L5 .L4: Patch attached. Should be applied to /compiler/m68k/cgmem.pas in the fixes branch. Bye, -- Charlie/iNQ .:%[ Cybernetic Hydraulic Android Responsible for ]%:. .:%[ Logical Infiltration and Exploration ]%:. .:%[ Member of TeamOS/2 Hungary ]%:. .:%[ Member of Hungarian Amiga User Group ]%:.
362c362,371 < emit_const_reg(A_LSL,S_L,l2,ind); --- > if l2 < 9 then > emit_const_reg(A_LSL,S_L,l2,ind) > else begin > getexplicitregister32(R_D0); > > emit_const_reg(A_MOVEQ,S_L,l2,R_D0); > emit_reg_reg(A_LSL,S_L,R_D0,ind); > > ungetregister(R_D0); > end;