[fpc-pascal] selecting target processor

2005-06-19 Thread Marc Santhoff
Hi,

how can I tell fpc to use only instructions supported on a specific
processor?

I'm compiling on an athlon for running on a geode (restriction has to
define instruction set from x686 to x586, I think).

Sometimes my program crashes on the target machine with signal 4
(illegal instruction).

TIA,
Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] selecting target processor

2005-06-19 Thread Jonas Maebe


On 19 Jun 2005, at 20:48, Marc Santhoff wrote:


how can I tell fpc to use only instructions supported on a specific
processor?

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. Other behaviour indicates a bug.  
Can you figure out which instruction it is that causes this?



Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] selecting target processor

2005-06-19 Thread Florian Klaempfl
Jonas Maebe wrote:

> 
> On 19 Jun 2005, at 20:48, Marc Santhoff wrote:
> 
>> how can I tell fpc to use only instructions supported on a specific
>> processor?
>>
>> 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  code generation options:
  -Cc set default calling convention to 
  -CDcreate also dynamic library (not supported)
  -CeCompilation with emulated floating point opcodes
  -Cf Select fpu instruction set to use, see fpc -i for
possible values
  -CgGenerate PIC code
  -Ch  bytes heap (between 1023 and 67107840)
  -CiIO-checking
  -Cnomit linking stage
  -Cocheck overflow of integer operations
  -Cp select instruction set, see fpc -i for possible values

That is it :)

> Other behaviour indicates a bug. 
> Can you figure out which instruction it is that causes this?
> 
> 
> Jonas
> 
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] selecting target processor

2005-06-19 Thread Tomas Hajny
Date sent:  Sun, 19 Jun 2005 22:49:44 +0200
From:   Florian Klaempfl <[EMAIL PROTECTED]>
To: FPC-Pascal users discussions 

Subject:Re: [fpc-pascal] selecting target processor
Send reply to:  FPC-Pascal users discussions 





> > On 19 Jun 2005, at 20:48, Marc Santhoff wrote:
> > 
> >> how can I tell fpc to use only instructions supported on a specific
> >> processor?
> >>
> >> 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  code generation options:
>   -Cc set default calling convention to 
>   -CDcreate also dynamic library (not supported)
>   -CeCompilation with emulated floating point opcodes
>   -Cf Select fpu instruction set to use, see fpc -i for
> possible values
>   -CgGenerate PIC code
>   -Ch  bytes heap (between 1023 and 67107840)
>   -CiIO-checking
>   -Cnomit linking stage
>   -Cocheck overflow of integer operations
>   -Cp 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...

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] selecting target processor

2005-06-19 Thread Florian Klaempfl
Tomas Hajny wrote:

> Date sent:Sun, 19 Jun 2005 22:49:44 +0200
> From: Florian Klaempfl <[EMAIL PROTECTED]>
> To:   FPC-Pascal users discussions 
> 
> Subject:  Re: [fpc-pascal] selecting target processor
> Send reply to:FPC-Pascal users discussions 
> 
>   
>   
> 
> 
>>>On 19 Jun 2005, at 20:48, Marc Santhoff wrote:
>>>
>>>
how can I tell fpc to use only instructions supported on a specific
processor?

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  code generation options:
>>  -Cc set default calling convention to 
>>  -CDcreate also dynamic library (not supported)
>>  -CeCompilation with emulated floating point opcodes
>>  -Cf Select fpu instruction set to use, see fpc -i for
>>possible values
>>  -CgGenerate PIC code
>>  -Ch  bytes heap (between 1023 and 67107840)
>>  -CiIO-checking
>>  -Cnomit linking stage
>>  -Cocheck overflow of integer operations
>>  -Cp 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() or max if max is inlined:

# [14] i:=length(s);
movlU_P$PROGRAM_S,%eax
testl   %eax,%eax
cmovnel -4(%eax),%eax
movl%eax,U_P$PROGRAM_I
# [15] j:=max(j,k);
movlU_P$PROGRAM_K,%ecx
movlU_P$PROGRAM_J,%edx
cmpl%ecx,%edx
cmovgl  %edx,%eax
.L29:
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@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal