SSe2 with FPC

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

SSe2 with FPC

pianoman-3
    Hello everyone, I have got interesting results from my test of SSE2
switch.
I tested a small code fragment with and without SSE2 swith and I Saw no
difference.
Why is this?
Iused FPC 2.0 on WIN 32 to compile it with Best optimization
Code fragment follows:
{$fputype sse2}
program divide;
uses windows;
var time1,time2:dword;
a,b,c:double;
i,j:dword;
begin
a:=123456789.1234567;
b:=1.987654587;
for i:=1 to 3 do
begin
time1:=gettickcount;
for j:=1 to 100000000 do c:=a/b;
time2:=gettickcount;
writeln('time ',i,' ',(time2-time1)/1000:0:3);
end;
end.

The Time I measured was from 3 sec to 1,6 sec. I didn't use very exact
method of measurement but...
Any help or idea would be appreciated.
Pianoman
P.S. program was ran on P4 with SSE
----- Original Message ----- 2 2,4g
Hz.
From: <[hidden email]>
To: <[hidden email]>
Sent: Thursday, June 02, 2005 12:00 PM
Subject: fpc-pascal Digest, Vol 10, Issue 2


> Send fpc-pascal mailing list submissions to
> [hidden email]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> or, via email, send a message with subject or body 'help' to
> [hidden email]
>
> You can reach the person managing the list at
> [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fpc-pascal digest..."
>
>
> Today's Topics:
>
>    1. Re:  Past list archives (Gerhard Scholz)
>    2. Re:  Past list archives (Vincent Snijders)
>    3. Re:  Optimizer in 2.0 (Florian Klaempfl)
>    4. Re:  Optimizer in 2.0 (Adrian Veith)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 1 Jun 2005 12:51:40 +0200
> From: "Gerhard Scholz" <[hidden email]>
> Subject: Re: [fpc-pascal] Past list archives
> To: "FPC-Pascal users discussions" <[hidden email]>
> Message-ID: <021901c5669b$2ff9ef00$6649863e@pc150>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Sorry,
>
> that list mentioned below:
>
>     http://www.freepascal.org/mailist.html
>
> is dead.
>
> (Objekt nicht gefunden! Der angeforderte URL konnte auf dem Server nicht
> gefunden werden.)
>
> Greetings
>
> Gerhard
>
> ----- Original Message -----
> From: "Jonas Maebe" <[hidden email]>
> To: "Mike's Mail" <[hidden email]>; "FPC-Pascal users
discussions"

> <[hidden email]>
> Sent: Sunday, May 29, 2005 2:38 PM
> Subject: Re: [fpc-pascal] Past list archives
>
>
> >
> > On 25 May 2005, at 14:47, Mike's Mail wrote:
> >
> > > Is there an active link for the archives that works, or who would I
> > > contact to report the link, so it may be fixed?
> >
> > Yes, working links can be found on http://www.freepascal.org/
> > maillist.html
> >
> >
> > Jonas
> >
> > PS: please turn off html posting in your mail client, it causes your
> > posts to be held for approval (because the rule that stops such mails
> > it also stops all viruses I know of)
> >
> >
> > _______________________________________________
> > fpc-pascal maillist  -  [hidden email]
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 01 Jun 2005 13:30:38 +0200
> From: Vincent Snijders <[hidden email]>
> Subject: Re: [fpc-pascal] Past list archives
> To: FPC-Pascal users discussions <[hidden email]>
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Gerhard Scholz wrote:
> > Sorry,
> >
> > that list mentioned below:
> >
> >     http://www.freepascal.org/mailist.html
> >
> > is dead.
>
> but http://www.freepascal.org/maillist.html isn't.
>
> Vincent.
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 01 Jun 2005 14:06:44 +0200
> From: Florian Klaempfl <[hidden email]>
> Subject: Re: [fpc-pascal] Optimizer in 2.0
> To: FPC-Pascal users discussions <[hidden email]>
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> Adrian Veith wrote:
> > It shows with useless code like simple nested for .. to loops, but also
> > with some more useful code like the attached RSA_Angriff from the C'T
> > magazine.
> >
> > My results are with:
> >
> > fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr
> >
> > 5266 ms
> >
> > with:
> >
> > fpc -Sd -XX RSA_Angriff_D5.dpr
> >
> > 4844 ms
> >
> > The unoptimized code is faster than the optimized code.
>
> For me the version compiled with -OG3rp3 is the fastest (AthlonXP). Just
> curious, what CPU do you use?
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 01 Jun 2005 16:47:57 +0200
> From: Adrian Veith <[hidden email]>
> Subject: Re: [fpc-pascal] Optimizer in 2.0
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Florian Klaempfl schrieb:
>
> >Adrian Veith wrote:
> >
> >
> >>It shows with useless code like simple nested for .. to loops, but also
> >>with some more useful code like the attached RSA_Angriff from the C'T
> >>magazine.
> >>
> >>My results are with:
> >>
> >>fpc -Sd -OG3rp3 -XX RSA_Angriff_D5.dpr
> >>
> >>5266 ms
> >>
> >>with:
> >>
> >>fpc -Sd -XX RSA_Angriff_D5.dpr
> >>
> >>4844 ms
> >>
> >>The unoptimized code is faster than the optimized code.
> >>
> >>
> >
> >For me the version compiled with -OG3rp3 is the fastest (AthlonXP). Just
> >curious, what CPU do you use?
> >
> >
> Intel Pentium M 730.
>
> I will do the test on a Athlon XP as well. Maybe the picture changes.
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> End of fpc-pascal Digest, Vol 10, Issue 2
> *****************************************
>
>
> __________ Informacia od NOD32 1.1121 (20050601) __________
>
> Tato sprava bola preverena antivirusovym systemom NOD32.
> http://www.eset.sk
>
>


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

Re: SSe2 with FPC

Florian Klaempfl-2
Pianoman wrote:

>     Hello everyone, I have got interesting results from my test of SSE2
> switch.
> I tested a small code fragment with and without SSE2 swith and I Saw no
> difference.
> Why is this?
> Iused FPC 2.0 on WIN 32 to compile it with Best optimization
> Code fragment follows:
> {$fputype sse2}
> program divide;
> uses windows;
> var time1,time2:dword;
> a,b,c:double;
> i,j:dword;
> begin
> a:=123456789.1234567;
> b:=1.987654587;
> for i:=1 to 3 do
> begin
> time1:=gettickcount;
> for j:=1 to 100000000 do c:=a/b;

div is an expensive operation and fpu and sse share the division
execution unit so why should it be faster?

The code uses sse2 of course:

# [13] for j:=1 to 100000000 do c:=a/b;
        movl $1,%esi
        decl %esi
        .balign 4
.L17:
        incl %esi
        movsd U_P$DIVIDE_A,%xmm0
        divsd U_P$DIVIDE_B,%xmm0
        movsd %xmm0,U_P$DIVIDE_C
        cmpl $100000000,%esi
        jb .L17



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