diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 5d02763c28..6fd83b6eb3 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -139,11 +139,19 @@ unit cgx86; S_NO,S_NO,S_NO,S_MD,S_XMM,S_YMM, S_NO,S_NO,S_NO,S_NO,S_XMM,S_YMM); {$else x86_64} + {$ifdef i386} TCGSize2OpSize: Array[tcgsize] of topsize = (S_NO,S_B,S_W,S_L,S_L,S_T,S_B,S_W,S_L,S_L,S_L, S_FS,S_FL,S_FX,S_IQ,S_FXX, S_NO,S_NO,S_NO,S_MD,S_XMM,S_YMM, S_NO,S_NO,S_NO,S_NO,S_XMM,S_YMM); + {$else i386} + TCGSize2OpSize: Array[tcgsize] of topsize = + (S_NO,S_B,S_W,S_W,S_W,S_T,S_B,S_W,S_W,S_W,S_W, + S_FS,S_FL,S_FX,S_IQ,S_FXX, + S_NO,S_NO,S_NO,S_MD,S_XMM,S_YMM, + S_NO,S_NO,S_NO,S_NO,S_XMM,S_YMM); + {$endif i386} {$endif x86_64} {$ifndef NOTARGETWIN} @@ -1810,9 +1818,15 @@ unit cgx86; REGSI=NR_RSI; REGDI=NR_RDI; {$else cpu64bitalu} + {$ifdef cpu32bitalu} REGCX=NR_ECX; REGSI=NR_ESI; REGDI=NR_EDI; + {$else cpu32bitalu} + REGCX=NR_CX; + REGSI=NR_SI; + REGDI=NR_DI; + {$endif cpu32bitalu} {$endif cpu64bitalu} type copymode=(copy_move,copy_mmx,copy_string); @@ -1837,7 +1851,7 @@ unit cgx86; cm:=copy_string; if (cs_opt_size in current_settings.optimizerswitches) and not((len<=16) and (cm=copy_mmx)) and - not(len in [1,2,4{$ifdef x86_64},8{$endif x86_64}]) then + not(len in [1,2{$ifndef i8086},4{$endif i8086}{$ifdef x86_64},8{$endif x86_64}]) then cm:=copy_string; if (source.segment<>NR_NO) or (dest.segment<>NR_NO) then @@ -1861,11 +1875,13 @@ unit cgx86; copysize:=2; cgsize:=OS_16; end +{$ifndef cpu16bitalu} else if len<8 then begin copysize:=4; cgsize:=OS_32; end +{$endif} {$ifdef cpu64bitalu} else if len<16 then begin @@ -1951,6 +1967,9 @@ unit cgx86; end; getcpuregister(list,REGCX); +{$ifdef i8086} + list.concat(Taicpu.op_none(A_CLD,S_NO)); +{$endif i8086} {$ifdef i386} list.concat(Taicpu.op_none(A_CLD,S_NO)); {$endif i386} @@ -1975,7 +1994,11 @@ unit cgx86; {$ifdef cpu64bitalu} list.concat(Taicpu.op_none(A_MOVSQ,S_NO)) {$else} + {$ifdef cpu32bitalu} list.concat(Taicpu.op_none(A_MOVSD,S_NO)); + {$else} + list.concat(Taicpu.op_none(A_MOVSW,S_NO)); + {$endif} {$endif cpu64bitalu} end; if len>=4 then