[fpc-devel] using sse2 packed doubles

Vincent Snijders vsnijders at quicknet.nl
Fri Oct 6 19:37:57 CEST 2006


Florian Klaempfl wrote:
> Vincent Snijders schrieb:
> 
>> Hi,
>>
>> I wondered if it is possible to add support for using sse2 packed 
>> doubles in fpc.
>>
>> I tried to create a sse2doubles type and define a operator + on it. 
>> Eventually I want to move this type and all operators on it to a 
>> separate sse2 unit, so that the user of this type doesn't need to see 
>> the assembler. The following program works, but not as efficiently as 
>> I had hoped, because the operator is not inlined, probably because of 
>> the assembler code.
> 
> 
> Indeed.
> 
>>
>> Is it possible to create this purely in RTL /units 
> 
> 
> No.
> 
>> or is compiler support needed? 
> 
> 
> Yes.
> 
>> Does it make sense to create a 'feature request'bug tracker item for 
>> this? Compiler hacking is out of my league.
> 
> 
> Do you think it's allowed to use in the benchmarks?
> 


Yes, as long as it is part of the RTL. Look at 
http://shootout.alioth.debian.org/gp4/benchmark.php?test=mandelbrot&lang=gcc&id=3

Using asm block would probably not allowed of course, but making use of 
sse2 support offered by the compiler and rtl is allowed.

So if fpc hypothetically would support a type double2 = array[0..1] of 
double and operators like + - * on it would use the packed double 
instructions of sse2, then it could be used in the shoutout benchmarks.

After all the following program looks perfectly normal pascal.

var
   a, b, c, d: double2;

begin
   d := a + b *c;
end.


Vincent



More information about the fpc-devel mailing list