diff options
Diffstat (limited to 'benchmarks/polybench-syn/medley')
-rw-r--r-- | benchmarks/polybench-syn/medley/floyd-warshall.c | 11 | ||||
-rw-r--r-- | benchmarks/polybench-syn/medley/nussinov.c | 16 |
2 files changed, 13 insertions, 14 deletions
diff --git a/benchmarks/polybench-syn/medley/floyd-warshall.c b/benchmarks/polybench-syn/medley/floyd-warshall.c index 46f6774..48a7e8d 100644 --- a/benchmarks/polybench-syn/medley/floyd-warshall.c +++ b/benchmarks/polybench-syn/medley/floyd-warshall.c @@ -9,6 +9,7 @@ */ /* floyd-warshall.c: this file is part of PolyBench/C */ +#include "../include/misc.h" #define plus(i) i = i + ONE static @@ -17,14 +18,12 @@ void init_array (int n, { int i, j; int ONE = 1; - int N7 = 7; - int N11 = 11; - int N13 = 13; for (i = 0; i < n; plus(i)) for (j = 0; j < n; plus(j)) { - path[i][j] = i*j%N7+ONE; - if ((i+j)%N13 == 0 || (i+j)%N7==0 || (i+j)%N11 == 0) + path[i][j] = i*smodulo(j,7)+ONE; + //if (((i+j)%13 == ZERO || (i+j)%7== ZERO || (i+j)%11 == ZERO ) != 0 ) + if(((smodulo((i+j),13) == (int)0 || smodulo((i+j),7) == (int)0)!=0 || smodulo((i+j),11) == (int)0 ) != 0) path[i][j] = 999; } } @@ -58,7 +57,6 @@ void kernel_floyd_warshall(int n, int i, j, k; int ONE = 1; -#pragma scop for (k = 0; k < n; plus(k)) { for(i = 0; i < n; plus(i)) @@ -66,7 +64,6 @@ void kernel_floyd_warshall(int n, path[i][j] = path[i][j] < path[i][k] + path[k][j] ? path[i][j] : path[i][k] + path[k][j]; } -#pragma endscop } diff --git a/benchmarks/polybench-syn/medley/nussinov.c b/benchmarks/polybench-syn/medley/nussinov.c index fd33ec4..a2c3b70 100644 --- a/benchmarks/polybench-syn/medley/nussinov.c +++ b/benchmarks/polybench-syn/medley/nussinov.c @@ -11,6 +11,8 @@ typedef int base; +#include "../include/misc.h" + #define plus(i) i = i + ONE static void init_array (int n, @@ -19,10 +21,11 @@ void init_array (int n, { int i, j; int ONE = 1; + int FOUR = 4; for (i=0; i <n; plus(i)) { - seq[i] = (base)((i+ONE)%4); + seq[i] = (base)(modulo((i+ONE),FOUR)); } for (i=0; i <n; plus(i)) @@ -55,22 +58,22 @@ void kernel_nussinov(int n, base seq[ 60 + 0], int table[ 60 + 0][60 + 0]) { int i, j, k; + int ZERO = 0; int ONE = 1; int THREE = 3; -#pragma scop - for (i = n-ONE; i >= 0; i=i-ONE) { + for (i = n-ONE; i >= ZERO; i=i-ONE) { for (j=i+ONE; j<n; plus(j)) { - if (j-ONE>=0) + if (j-ONE>=ZERO) table[i][j] = ((table[i][j] >= table[i][j-ONE]) ? table[i][j] : table[i][j-ONE]); if (i+ONE<n) table[i][j] = ((table[i][j] >= table[i+ONE][j]) ? table[i][j] : table[i+ONE][j]); - if (j-ONE>=0 && i+ONE<n) { + if ((j-ONE>=ZERO && i+ONE<n) != (int)0) { if (i<j-ONE) - table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)); + table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)); else table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]) ? table[i][j] : table[i+ONE][j-ONE]); } @@ -80,7 +83,6 @@ void kernel_nussinov(int n, base seq[ 60 + 0], } } } -#pragma endscop } |