Hi all

Recently I discovered that fpc refuses to use registers in my loops even with 
optimization turned on (-O1,-O3 used).
I tested using both Linux x86 and Windows x64 version.

The results are basically the same.
The compiler just uses stack variables.

I've also included naive asm version of the same loop just to see the 
comparison.
All tests were done using EpikTimer.

======================================
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
Sandy Bridge-DT XE
Microsoft Windows XP Professional x64 Edition Build 3790
Free Pascal Compiler version 2.7.1 [2012/08/25] for x86_64
Result:
  
asm 0.0256358138703286 sec
for downto 0.193564002384441 sec
for to 0.177300077002942 sec
repeat 0.158137833298043 sec
while 0.156996773175159 sec

Intel(R) Core(TM)2 CPU 6600  @ 2.40GHz
Linux x86
Free Pascal Compiler version 2.7.1 [2012/11/17] for i386
Result:

asm 0.049642 sec
for downto 0.322694 sec
for to 0.312163 sec
repeat 0.298781 sec
while 0.298575 sec
======================================

You can easily see that asm version is about 10 times faster.
Is this something that can be fixed?

P.S. A full test source + assembler listings are attached.

 -- 
Regards,
Denis Golovan

Attachment: loop-test.tar.gz
Description: GNU Zip compressed data

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

Reply via email to