[fpc-pascal] SSE in overloaded operators

Florian Klaempfl F.Klaempfl at gmx.de
Sat Dec 18 09:55:04 CET 2004


Bartek wrote:

> hi,
> i'm trying to get this piece of code to work. but it fails on execution and
> returns a SIGSEV signal. i think this is caused by the weird code, fpc
> creates. fpc tryed to access the wide sse registers with multiple short
> 32bit registers, and at some point, protected memory is accessed.

FPC doesn't align the stack properly to sixteen byte boundaries currently.

> 
> 
> i'm using win32 with fpc 1.9.5 .
> 
> program test;
> type
>        vector4 = array[0..3] of single;
> var
>        a, b, c: vector4;
> 
> operator + (v1,v2 :vector4) v_r:vector4;assembler;inline;
> asm
> movups xmm0, v1
> addps xmm0, v2
> movups v_r, xmm0
> end;
> 
> begin
> c:=a+b;
> end.
> 
> -------------------------------------------------------------------------------------------------------- 
> 
> 
> # [15] c:=a+b;
>         leal _B,%edi
>         movl %edi,-4(%ebp)
>         leal _A,%edi
>         movl %edi,-8(%ebp)
>         leal -24(%ebp),%edi
>         movl %edi,-56(%ebp)
> .L640:
> .Ll9:
>         .stabn 68,0,9,.Ll9 - program_init
> # [9] vups xmm0, v1
>         movups -8(%ebp),%xmm0
> .Ll10:
>         .stabn 68,0,10,.Ll10 - program_init
> # [10] dps xmm0, v2
>         addps -4(%ebp),%xmm0
> .Ll11:
>         .stabn 68,0,11,.Ll11 - program_init
> # [11] vups v_r, xmm0
>         movups %xmm0,-12(%ebp)
> .L641:
> .Ll12:
>         .stabn 68,0,15,.Ll12 - program_init
>         leal _C,%edi
>         leal -24(%ebp),%esi
>         cld
>         movl $4,%ecx
>         rep
>         movsl
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list