[llvm-commits] [test-suite] r141710 - in /test-suite/trunk/SingleSource/Benchmarks/Stanford: FloatMM.c FloatMM.reference_output

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Oct 11 14:06:52 PDT 2011


Author: stoklund
Date: Tue Oct 11 16:06:52 2011
New Revision: 141710

URL: http://llvm.org/viewvc/llvm-project?rev=141710&view=rev
Log:
Add FloatMM.c, a single precision version of RealMM.c

Added:
    test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.c
    test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.reference_output

Added: test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.c?rev=141710&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.c (added)
+++ test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.c Tue Oct 11 16:06:52 2011
@@ -0,0 +1,160 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#define  nil		0
+#define	 false		0
+#define  true		1
+#define  bubblebase	1.61f
+#define  dnfbase 	3.5f
+#define  permbase 	1.75f
+#define  queensbase 1.83f
+#define  towersbase 2.39f
+#define  quickbase 	1.92f
+#define  intmmbase 	1.46f
+#define  treebase 	2.5f
+#define  mmbase 	0.0f
+#define  fpmmbase 	2.92f
+#define  puzzlebase	0.5f
+#define  fftbase 	0.0f
+#define  fpfftbase 	4.44f
+    /* Towers */
+#define maxcells 	 18
+
+    /* Intmm, Mm */
+#define rowsize 	 40
+
+    /* Puzzle */
+#define size	 	 511
+#define classmax 	 3
+#define typemax 	 12
+#define d 		     8
+
+    /* Bubble, Quick */
+#define sortelements 5000
+#define srtelements  500
+
+    /* fft */
+#define fftsize 	 256 
+#define fftsize2 	 129  
+/*
+type */
+    /* Perm */
+#define permrange     10
+
+   /* tree */
+struct node {
+	struct node *left,*right;
+	int val;
+};
+
+    /* Towers */ /*
+    discsizrange = 1..maxcells; */
+#define    stackrange	3
+/*    cellcursor = 0..maxcells; */
+struct    element {
+	int discsize;
+	int next;
+};
+/*    emsgtype = packed array[1..15] of char;
+*/
+    /* Intmm, Mm */ /*
+    index = 1 .. rowsize;
+    intmatrix = array [index,index] of integer;
+    realmatrix = array [index,index] of real;
+*/
+    /* Puzzle */ /*
+    piececlass = 0..classmax;
+    piecetype = 0..typemax;
+    position = 0..size;
+*/
+    /* Bubble, Quick */ /*
+    listsize = 0..sortelements;
+    sortarray = array [listsize] of integer;
+*/
+    /* FFT */
+struct    complex { float rp, ip; } ;
+/*
+    carray = array [1..fftsize] of complex ;
+    c2array = array [1..fftsize2] of complex ;
+*/
+
+float value, fixed, floated;
+
+    /* global */
+long    seed;  /* converted to long for 16 bit WR*/
+
+    /* Perm */
+int    permarray[permrange+1];
+/* converted pctr to unsigned int for 16 bit WR*/
+unsigned int    pctr;
+
+    /* tree */
+struct node *tree;
+
+    /* Towers */
+int	   stack[stackrange+1];
+struct element    cellspace[maxcells+1];
+int    freelist,  movesdone;
+
+    /* Intmm, Mm */
+
+int   ima[rowsize+1][rowsize+1], imb[rowsize+1][rowsize+1], imr[rowsize+1][rowsize+1];
+float rma[rowsize+1][rowsize+1], rmb[rowsize+1][rowsize+1], rmr[rowsize+1][rowsize+1];
+
+    /* Puzzle */
+int	piececount[classmax+1],	class[typemax+1], piecemax[typemax+1];
+int	puzzl[size+1], p[typemax+1][size+1], n, kount;
+
+    /* Bubble, Quick */
+int sortlist[sortelements+1], biggest, littlest, top;
+
+    /* FFT */
+struct complex    z[fftsize+1], w[fftsize+1], e[fftsize2+1];
+float    zr, zi;
+
+void Initrand () {
+    seed = 74755L;   /* constant to long WR*/
+}
+
+int Rand () {
+    seed = (seed * 1309L + 13849L) & 65535L;  /* constants to long WR*/
+    return( (int)seed );     /* typecast back to int WR*/
+}
+
+
+    /* Multiplies two real matrices. */
+
+void rInitmatrix ( float m[rowsize+1][rowsize+1] ) {
+	int temp, i, j;
+	for ( i = 1; i <= rowsize; i++ )
+	    for ( j = 1; j <= rowsize; j++ ) {
+	    	temp = Rand();
+			m[i][j] = (float)(temp - (temp/120)*120 - 60)/3;
+        }
+}
+
+void rInnerproduct(float *result, float a[rowsize+1][rowsize+1], float b[rowsize+1][rowsize+1], int row, int column) {
+	/* computes the inner product of A[row,*] and B[*,column] */
+	int i;
+	*result = 0.0f;
+	for (i = 1; i<=rowsize; i++) *result = *result+a[row][i]*b[i][column];
+}
+
+void Mm (int run)    {
+    int i, j;
+    Initrand();
+    rInitmatrix (rma);
+    rInitmatrix (rmb);
+    for ( i = 1; i <= rowsize; i++ )
+		for ( j = 1; j <= rowsize; j++ ) 
+			rInnerproduct(&rmr[i][j],rma,rmb,i,j);
+    if (run < rowsize)
+      printf("%f\n", rmr[run + 1][run + 1]);
+}
+
+int main()
+{
+	int i;
+	for (i = 0; i < 5000; i++) Mm(i);
+	return 0;
+}

Added: test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.reference_output?rev=141710&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.reference_output (added)
+++ test-suite/trunk/SingleSource/Benchmarks/Stanford/FloatMM.reference_output Tue Oct 11 16:06:52 2011
@@ -0,0 +1,41 @@
+-776.000000
+636.888889
+961.777778
+-239.555556
+-337.777778
+-298.222222
+-962.666667
+94.666667
+62.222222
+33.333333
+-1002.666667
+-619.111111
+-52.444444
+1117.777778
+-535.999999
+316.888889
+1649.777778
+204.888889
+292.444444
+851.111111
+-221.333333
+1389.777778
+837.333333
+623.555556
+46.222222
+1048.444444
+17.777778
+-333.777778
+-712.000000
+94.666667
+643.555556
+-1310.666667
+-279.999999
+602.222222
+-11.555556
+-64.444445
+146.666667
+119.555556
+204.444444
+607.555556
+exit 0





More information about the llvm-commits mailing list