Re: Problems using Vector Extensions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Unterthiner wrote:

> *#define* USE_GCC_VECTORISATION (defined(__SSE__) && 1)
> 
> *class* Vector3D
> {
>     *public*:
>         //*
>          * ... the usual operators
>          *//
> 
>     *private*:*
>         #if* USE_GCC_VECTORISATION
>             *typedef float* v4sf __attribute__ (( vector_size(4 *
> *sizeof*(*float*)) ));
>             *typedef int* v4si __attribute__ (( vector_size(4 *
> *sizeof*(*int*)) ));
>             *union*
>             {
>                 *float* v[4];
>                 v4sf vec;
>             };
>             Vector3D(*const* v4sf& v);*
>         #else
>             float* v[3];*
>         #endif*
> };

Did an apostrophe truck overturn on the freeway?  This formatting is
really terrible.

> 0x4f07d0    *push*   %*ebp*
> 0x4f07d1    *mov*    %*esp*,%*ebp*
> 0x4f07d3    *push*   %*ebx*
> 0x4f07d4    *sub*    $0x1c,%*esp*
> 0x4f07d7    *mov*    0x8(%*ebp*),%*ebx*
> 0x4f07da    *mov*    %*ebx*,%*edx*
> 0x4f07dc    *mov*    0xc(%*ebp*),%*eax*
> 0x4f07df    movaps (%*eax*),%xmm1  /; <<<<-----the segault happens in
> this instruction/

This could be due to the object not being aligned to a 16 byte
boundary.  Gcc relies on the platform's crt startup files to align the
stack properly prior to main(), so you should check if that is
happening.  After that point gcc should keep it aligned from there on.

> *#include* "_Vector3D.h_"
> *int* main ( *int* argc, *char*** argv )
> {
>     ///  this is quite exactly what happens in my "real" program/
>     Vector3D a(-4, -3, 10);
>     Vector3D b(-4, 5, 10);
>     Vector3D c = a - b;
> 
>     std::cout << c << std::endl;
> 
>     *return* 0;
> }

It would help if you could post a standalone testcase that exhibits the
fault that can actually be compiled, not just snippets.  And without the
apostrophe dust, obviously.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux