selecting target processor

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

selecting target processor

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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Florian Klämpfl
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<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 :)

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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Tomas Hajny
Date sent:       Sun, 19 Jun 2005 22:49:44 +0200
From:           Florian Klaempfl <[hidden email]>
To:             FPC-Pascal users discussions <[hidden email]>
Subject:         Re: [fpc-pascal] selecting target processor
Send reply to:   FPC-Pascal users discussions <[hidden email]>
        <mailto:[hidden email]?subject=unsubscribe>
        <mailto:[hidden email]?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
> >> 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<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...

Tomas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Florian Klämpfl
Tomas Hajny wrote:

> Date sent:       Sun, 19 Jun 2005 22:49:44 +0200
> From:           Florian Klaempfl <[hidden email]>
> To:             FPC-Pascal users discussions <[hidden email]>
> Subject:         Re: [fpc-pascal] selecting target processor
> Send reply to:   FPC-Pascal users discussions <[hidden email]>
> <mailto:[hidden email]?subject=unsubscribe>
> <mailto:[hidden email]?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
>>>>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<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
.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  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Marc Santhoff
In reply to this post by Jonas Maebe
Am Sonntag, den 19.06.2005, 22:26 +0200 schrieb 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.  

So it should work:

I'm using "-dRELEASE" for releasing and my fpg.cfg has standard "-OG2p3"
and "-Xs". Testing is done with "-XX -B".

> Can you figure out which instruction it is that causes this?

How would I do that? Would a saved core dump do? It seems to occur on
when redirecting stdout to a file, but I'm not sure yet.

Thanks,
Marc


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Jonas Maebe-2

On 20 jun 2005, at 09:59, Marc Santhoff wrote:

> So it should work:
>
> I'm using "-dRELEASE" for releasing and my fpg.cfg has standard "-
> OG2p3"
> and "-Xs". Testing is done with "-XX -B".

Yes, it should.

>> Can you figure out which instruction it is that causes this?
>
> How would I do that? Would a saved core dump do? It seems to occur on
> when redirecting stdout to a file, but I'm not sure yet.

Normally, you'd do this by running the program under gdb and checking  
what the faulting instruction is. A coredump should contain the  
necessary information as well, yes.


Jonas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Eduardo Morras
At 15:36 20/06/2005, you wrote:

>On 20 jun 2005, at 09:59, Marc Santhoff wrote:
>
>>So it should work:
>>
>>I'm using "-dRELEASE" for releasing and my fpg.cfg has standard "- OG2p3"
>>and "-Xs". Testing is done with "-XX -B".
>
>Yes, it should.
>
>>>Can you figure out which instruction it is that causes this?
>>
>>How would I do that? Would a saved core dump do? It seems to occur on
>>when redirecting stdout to a file, but I'm not sure yet.
>
>Normally, you'd do this by running the program under gdb and checking
>what the faulting instruction is. A coredump should contain the
>necessary information as well, yes.

Are you using any dll or lib.so :? Perhaps the external code is compiled
for a specific processor.


**************************************************************************************************************************************************
This document represent my ideas. They are original from me. It's forbidden
think the same than me, without previous payment.
If you agree me, PAY.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: selecting target processor

Marc Santhoff
Am Montag, den 20.06.2005, 17:19 +0200 schrieb Eduardo:
[...]
> Are you using any dll or lib.so :? Perhaps the external code is compiled
> for a specific processor.

This in fact seems to be tha cause. The error happens inside the GTK
library which i'll try to recompile and check again.

Thanks to you all so far,
Marc


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal