Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-06

selecting target processor

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

Jonas Maebe
to Marc Santhoff
Marc Santhoff wrote 5 lines
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

Florian Klaempfl
to Jonas Maebe
Jonas Maebe wrote 13 lines
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 :)

Show quoted text 10 lines
Other behaviour indicates a bug. Can you figure out which instruction it is that causes this? Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Tomas Hajny
to Florian Klaempfl

Date sent: Sun, 19 Jun 2005 22:49:44 +0200
From: Florian Klaempfl
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] selecting target processor Send reply to: FPC-Pascal users discussions

Show quoted text 27 lines
> 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

Florian Klaempfl
to Tomas Hajny
Tomas Hajny wrote 43 lines
Date sent: Sun, 19 Jun 2005 22:49:44 +0200 From: Florian Klaempfl 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<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

Show quoted text 6 lines
Tomas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marc Santhoff
to Jonas Maebe: In theory, the code generated by FPC should always run on an i386 (even if you use e.g.…
Jonas Maebe wrote 11 lines
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

Jonas Maebe
to Marc Santhoff
Marc Santhoff wrote 5 lines
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

Eduardo
to Jonas Maebe
you wrote 17 lines
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.

Marc Santhoff
to Eduardo

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