[fpc-pascal] selecting target processor

Florian Klaempfl florian at freepascal.org
Sun Jun 19 23:19:43 CEST 2005

Tomas Hajny wrote:

> Date sent:      	Sun, 19 Jun 2005 22:49:44 +0200
> From:           	Florian Klaempfl <florian at freepascal.org>
> To:             	FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> Subject:        	Re: [fpc-pascal] selecting target processor
> Send reply to:  	FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> 	<mailto:fpc-pascal-request at lists.freepascal.org?subject=unsubscribe>
> 	<mailto:fpc-pascal-request at lists.freepascal.org?subject=subscribe>
>>>On 19 Jun 2005, at 20:48, Marc Santhoff wrote:
>>>>how can I tell fpc to use only instructions supported on a specific
>>>>I'm compiling on an athlon for running on a geode (restriction has
>>>>to define instruction set from x686 to x586, I think).
>>>In theory, the code generated by FPC should always run on an i386 
>>>(even if you use e.g. -Op3), unless you use some special command
>>>line switches I cannot find in the help. 
>>  -C<x>  code generation options:
>>      -Cc<x>     set default calling convention to <x>
>>      -CD        create also dynamic library (not supported)
>>      -Ce        Compilation with emulated floating point opcodes
>>      -Cf<x>     Select fpu instruction set to use, see fpc -i for
>>possible values
>>      -Cg        Generate PIC code
>>      -Ch<n>     <n> bytes heap (between 1023 and 67107840)
>>      -Ci        IO-checking
>>      -Cn        omit linking stage
>>      -Co        check overflow of integer operations
>>      -Cp<x>     select instruction set, see fpc -i for possible
>>      values
>>That is it :)
> Nice can of worms I haven't been aware of... ;-) So what is the best -
> Cp option for my Athlon then? ;-))) And what would be correct for AMD 
> K6 and all other non-Intel CPUs > 386? Looks as a lot of work for 
> Michael...

  PENTIUM 	afaik nothing new
  PENTIUM2	mainly cmov and fcmov, cmov creates nice code for
length(<ansistring>) or max if max is inlined:

# [14] i:=length(s);
	movl	U_P$PROGRAM_S,%eax
	testl	%eax,%eax
	cmovnel	-4(%eax),%eax
	movl	%eax,U_P$PROGRAM_I
# [15] j:=max(j,k);
	movl	U_P$PROGRAM_K,%ecx
	movl	U_P$PROGRAM_J,%edx
	cmpl	%ecx,%edx
	cmovgl	%edx,%eax
	cmovngl	%ecx,%eax
	movl	%eax,U_P$PROGRAM_J

  PENTIUM3	sse1 for usual code possible (e.g. prefetch)
  PENTIUM4	sse2 for usual code possible

K6 -> Pentium
Athlon/Duron -> Pentium2
AthlonXP/Sempron -> Pentium3
Athlon64 -> Pentium4

> Tomas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list