This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc-4.2.2 generating wrong/misaligned sse instruction - movapd


Hi all,
gcc-4.2.2 seems to generating wrong/misaligned code for movapd.

I have used the same test case mentione here (for almost the similar bug)
http://gcc.gnu.org/bugzilla/attachment.cgi?id=6012


The relavent information about the version and the files are as follows:

The version of gcc:
gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../../src/gcc-4.2.2/configure
--prefix=/depot/gcc-4.2.2-static --disable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,objc,fortran --with-cpu=generic
--host=i386-redhat-linux
Thread model: posi

$ gcc -g -O2 -funsigned-bitfields -fsigned-char -ffloat-store -Wformat
 -msse2 -mfpmath=sse  -c sse.c
$ objdump -Sd sse.o > sse_asm.txt

$ grep movapd sse_asm.txt
  a3:   66 0f 28 c2             movapd %xmm2,%xmm0
  cb:   66 0f 28 c1             movapd %xmm1,%xmm0
  f6:   66 0f 28 c4             movapd %xmm4,%xmm0
 165:   66 0f 29 9d 38 fe ff    movapd %xmm3,0xfffffe38(%ebp) #<============
 185:   66 0f 28 9d 38 fe ff    movapd 0xfffffe38(%ebp),%xmm3


Is this a known issue? If so, is there are there any suggested
workarounds (other than upgrading to later versions :-) ?

Regards,
Gowri Kumar
double sin(double x);
double cos(double x);

typedef struct {
    double x, y, z;
} DVECTOR;

typedef struct {
   DVECTOR m[4];
} DMATRIX;


void
create_geo_to_topo(DMATRIX *xfp, double lat, double lon)
{
    double cos_lat;

    {
  double sin_lon, cos_lon, sin_lat;

  sin_lon = sin(lon);
  cos_lon = cos(lon);
  sin_lat = sin(lat);
  cos_lat = cos(lat);

  xfp->m[0].x = -sin_lon;
        xfp->m[1].x =  cos_lon;
        xfp->m[2].x = 0.0;
        
        xfp->m[0].y = -cos_lon  * sin_lat;
        xfp->m[1].y = -sin_lon  * sin_lat;
        xfp->m[2].y = cos_lat;

        xfp->m[0].z = cos_lon  * cos_lat;
        xfp->m[1].z = sin_lon  * cos_lat;
        xfp->m[2].z = sin_lat;

        {
            DVECTOR geo;
            DVECTOR lla;

            lla.x = lat;
            lla.y = lon;
            lla.z = 0.0;
            geo_lla_xyz( &lla, &geo);


            xfp->m[3].x = -geo.x * xfp->m[0].x -
                           geo.y * xfp->m[1].x -
                           geo.z * xfp->m[2].x;
            xfp->m[3].y = -geo.x * xfp->m[0].y -
                           geo.y * xfp->m[1].y -
                           geo.z * xfp->m[2].y;
            xfp->m[3].z = -geo.x * xfp->m[0].z -
                           geo.y * xfp->m[1].z -
                           geo.z * xfp->m[2].z; 
        }
    }
}

Attachment: sse.i
Description: Binary data

Attachment: sse.s
Description: Binary data

Attachment: sse_asm.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]