home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume21
/
cloops
/
part01
/
test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-25
|
4KB
|
168 lines
/*
* This file is part of the Livermore Loops transliteration into C.
* Copyright (C) 1991 by Martin Fouts
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "types.h"
#include "externs.h"
Float sumo();
Float sumo2();
Float sumo3();
Void values();
Void sizes();
Void lsignal();
Float second();
static Float start = 0.0;
#define TEST(x) ((DoTest & (1<<(x-1))) == (1<<(x-1)))
extern long int DoTest;
Void test(i)
Int i;
{
Float tempus;
/*Float cache[8192];*/
Int nn, np, mm, k;
tempus= second((Float)0.0) - start;
nn= n;
np= lp;
if( i == 0 ) goto l_100;
if (!TEST(i)) goto l_100;
sizes(i-1);
Time[i-1] = tempus;
switch((int)i) {
case 1:
csum [0] = sumo ( x, (int)n);
loops[0] = np*nn;
break;
case 2:
csum [1] = sumo ( x, (int)n);
loops[1] = np*(nn-4);
break;
case 3:
csum [2] = q;
loops[2] = np*nn;
break;
case 4:
mm= (1001-7)/2;
for (k = 6 ; k < 1001; k += mm)
v[k]= x[k];
csum [3] = sumo ( v, 3);
loops[3] = np*(((nn-5)/5)+1)*3;
break;
case 5:
csum [4] = sumo ( &x[1], (int)(n-1));
loops[4] = np*(nn-1);
break;
case 6:
csum [5] = sumo ( w, (int)n);
loops[5] = np*nn*((nn-1)/2);
break;
case 7:
csum [6] = sumo ( x, (int)n);
loops[6] = np*nn;
break;
case 8:
csum [7] = sumo3 ( &u1[0][0][0],5,(int)n,2,5,101,2)
+ sumo3( &u2[0][0][0],5,(int)n,2,5,101,2)
+ sumo3( &u3[0][0][0],5,(int)n,2,5,101,2);
loops[7] = np*(nn-1)*2;
break;
case 9:
csum [8] = sumo2 ( &px[0][0], 15,(int)n, 25, 101);
loops[8] = np*nn;
break;
case 10:
csum [9] = sumo2 ( &px[0][0], 15,(int)n, 25, 101);
loops[9] = np*nn;
break;
case 11:
csum [10] = sumo ( &x[1], (int)(n-1));
loops[10] = np*(nn-1);
break;
case 12:
csum [11] = sumo ( x, (int)n-1);
loops[11] = np*(nn-1);
break;
case 13:
csum [12] = sumo2 ( &p[0][0], 8, (int)n, 4, 512)
+ sumo2 ( &h[0][0], 8, (int)n, 64, 64);
loops[12] = np*nn;
break;
case 14:
csum [13] = sumo ( vx, (int)n) + sumo ( xx, (int)n) + sumo ( rh,67);
loops[13] = np*nn;
break;
case 15:
csum [14] = sumo2 ( &vy[0][0], (int)n, 7, 101, 25)
+ sumo2 ( &vs[0][0], (int)n, 7, 101, 7);
loops[14] = np*(nn-1)*5;
break;
case 16:
csum [15] = (Float)( k3+k2+j5+m+2);
nrops[15] = k2+k2+10*k3;
loops[15] = 1;
break;
case 17:
csum [16] = sumo ( vxne, (int)n) + sumo ( vxnd, (int)n) + xnm;
loops[16] = np*nn;
break;
case 18:
csum [17] = sumo2 ( &zr[0][0], (int)n, 7, 101, 7)
+ sumo2 ( &zz[0][0], (int)n, 7, 101, 7);
loops[17] = np*(nn-1)*5;
break;
case 19:
csum [18] = sumo ( b5, (int)n) + stb5;
loops[18] = np*nn;
break;
case 20:
csum [19] = sumo ( &d[1], (int)n);
loops[19] = np*nn;
break;
case 21:
csum [20] = sumo2 ( &px[0][0], (int)n, (int)n, 25, 101);
loops[20] = np*nn*nn*nn;
break;
case 22:
csum [21] = sumo ( w, (int)n);
loops[21] = np*nn;
break;
case 23:
csum [22] = sumo2 ( &za[0][0], (int)n, 7, 101, 7);
loops[22] = np*(nn-1)*5;
break;
case 24:
csum [23] = (Float)m;
loops[23] = np*(nn-1);
break;
case 25:
break;
}
l_100:
sizes(i);
values(i);
/* lsignal( cache, 1.0, 0.0, 8192);*/
l_101:
start= second(0.0);
return;
}