[llvm-commits] [test-suite] r37873 - in /test-suite/trunk/SingleSource/UnitTests/Vector/SSE: sse.expandfft.c sse.isamax.c sse.stepfft.c

Duncan Sands baldrick at free.fr
Wed Jul 4 13:09:16 PDT 2007


Author: baldrick
Date: Wed Jul  4 15:09:16 2007
New Revision: 37873

URL: http://llvm.org/viewvc/llvm-project?rev=37873&view=rev
Log:
In isamax, clearly align==1 should have been align==3.
Add bres to the indices calculated using SSE to correct
for the earlier offsetting  of xp.  Align xbig and indx.
For expandfft and stepfft make sure wu and wr are aligned
on a 16 byte boundary.  Without these alignment fixes, the
programs crash when built with gcc 4.1, 4.2 and 4.3.

Modified:
    test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c
    test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.isamax.c
    test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c

Modified: test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c?rev=37873&r1=37872&r2=37873&view=diff

==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c Wed Jul  4 15:09:16 2007
@@ -94,7 +94,8 @@
    int jb, jc, jw, k, k2, lj, m, j, mj, mj2, pass, tgle;
    float (*a)[2],(*b)[2],(*c)[2],(*d)[2];
    float (*aa)[2],(*bb)[2],(*cb)[2],(*dd)[2];
-   float rp,up,wr[4],wu[4];
+   float rp,up,wra[7],wua[7];
+   float *wr = wra, *wu = wua;
    __m128 V0,V1,V2,V3,V4,V5,V6,V7;
    __m128 V8,V9,V10,V11,V12,V13,V14,V15;
 
@@ -107,6 +108,8 @@
    mj   = 1;
    mj2  = 2;
    lj   = n/2;
+   wr += (4 - ((unsigned int) wr >> 2)) & 0x03; // align wr
+   wu += (4 - ((unsigned int) wu >> 2)) & 0x03; // align wu
 // first pass thru data: x -> y
    a = (void *)&x[0][0];
    b = (void *)&x[n/2][0];

Modified: test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.isamax.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.isamax.c?rev=37873&r1=37872&r2=37873&view=diff

==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.isamax.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.isamax.c Wed Jul  4 15:09:16 2007
@@ -30,7 +30,8 @@
   float bbig,ebig,bres,*xp;
   int eres,i,ibbig,iebig,align,nsegs,mb,nn;
   __m128 offset4,V0,V1,V2,V3,V6,V7;
-  float xbig[8],indx[8];
+  float xbiga[11],indxa[11];
+  float *xbig = xbiga, *indx = indxa;
 // n < NS done in scalar mode
   if(n < NS){
      iebig = 0;
@@ -63,7 +64,7 @@
      if(fabsf(x[1]) > bbig){
         bbig  = fabsf(x[1]); ibbig = 1;
      }
-  } else if(align == 1){    // bres = 1 case
+  } else if(align == 3){    // bres = 1 case
      bbig = fabsf(x[0]); ibbig = 0;
      bres = 1.0; nn = n - 1;
   } else {                  // bres = 0 case
@@ -99,6 +100,8 @@
      V7 = _mm_max_ps(V7,V3);
   }
 // Now finish up: segment maxima are in V0, indices in V7
+  xbig += (4 - ((unsigned int) xbig >> 2)) & 0x03; // align xbig
+  indx += (4 - ((unsigned int) indx >> 2)) & 0x03; // align indx
   _mm_store_ps(xbig,V0);
   _mm_store_ps(indx,V7);
   if(eres>0){
@@ -112,7 +115,7 @@
   for(i=0;i<4+eres;i++){
      if(xbig[i] > ebig){
         ebig = xbig[i];
-        iebig = (int) indx[i];
+        iebig = (int) (indx[i]+bres);
      }
   }
   return(iebig);

Modified: test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c?rev=37873&r1=37872&r2=37873&view=diff

==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c Wed Jul  4 15:09:16 2007
@@ -156,12 +156,16 @@
 float a[][2],b[][2],c[][2],d[][2],w[][2],sign;
 {
    int j,k,jc,jw,l,lj,mj2,mseg;
-   float rp,up,wr[4],wu[4];
+   float rp,up,wra[7],wua[7];
    __m128 xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7;
+   float *wr = wra, *wu = wua;
 
    mj2 = 2*mj;
    lj  = n/mj2;
 
+   wr += (4 - ((unsigned int) wr >> 2)) & 0x03; // align wr
+   wu += (4 - ((unsigned int) wu >> 2)) & 0x03; // align wu
+
    for(j=0; j<lj; j++){
       jw  = j*mj; jc  = j*mj2;
       rp = w[jw][0];





More information about the llvm-commits mailing list