[test-suite] r177150 - MiBench: Add simple RNG to avoid library diffs

Renato Golin renato.golin at linaro.org
Fri Mar 15 05:38:44 PDT 2013


Author: rengolin
Date: Fri Mar 15 07:38:44 2013
New Revision: 177150

URL: http://llvm.org/viewvc/llvm-project?rev=177150&view=rev
Log:
MiBench: Add simple RNG to avoid library diffs

Now the reference output is specific to the local implementation, avoiding
dependencies on the library that could change from release to release on
the same architectures.

Tested on x86_64 and ARMv7 (32-bits), so should work on any 32-bit and
64-bit architectures. It's also probably safe on 16-bit archs.


Modified:
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/automotive-bitcount.reference_output
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c
    test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/main.c
    test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/telecomm-fft.reference_output

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/automotive-bitcount.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/automotive-bitcount.reference_output?rev=177150&r1=177149&r2=177150&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/automotive-bitcount.reference_output (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/automotive-bitcount.reference_output Fri Mar 15 07:38:44 2013
@@ -1,10 +1,10 @@
 Bit counter algorithm benchmark
 
-Optimized 1 bit/loop counter          > Bits: 13254024
-Ratko's mystery algorithm             > Bits: 15454236
-Recursive bit count by nybbles        > Bits: 16468711
-Non-recursive bit count by nybbles    > Bits: 18724896
-Non-recursive bit count by bytes (BW) > Bits: 15997399
-Non-recursive bit count by bytes (AR) > Bits: 16733373
-Shift and count bits                  > Bits: 15589355
+Optimized 1 bit/loop counter          > Bits: 13254056
+Ratko's mystery algorithm             > Bits: 13255501
+Recursive bit count by nybbles        > Bits: 13257159
+Non-recursive bit count by nybbles    > Bits: 13246703
+Non-recursive bit count by bytes (BW) > Bits: 13250340
+Non-recursive bit count by bytes (AR) > Bits: 13249450
+Shift and count bits                  > Bits: 13257011
 exit 0

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c?rev=177150&r1=177149&r2=177150&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c Fri Mar 15 07:38:44 2013
@@ -16,6 +16,23 @@
 
 #define FUNCS  7
 
+// RNG implemented localy to avoid library incongruences
+#ifdef RAND_MAX
+#undef RAND_MAX
+#endif
+#define RAND_MAX 32767
+static unsigned long long int next = 1;
+
+int rand( void ) {
+    next = next * 1103515245 + 12345;
+    return (unsigned int)(next / 65536) % RAND_MAX+1;
+}
+
+void srand( unsigned int seed ) {
+    next = seed;
+}
+// End of RNG implementation
+
 static int CDECL bit_shifter(long int x);
 
 int main(int argc, char *argv[])
@@ -50,6 +67,7 @@ int main(int argc, char *argv[])
     exit(-1);
 	}
   iterations=atoi(argv[1]);
+  srand(1);
   
   puts("Bit counter algorithm benchmark\n");
   

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/main.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/main.c?rev=177150&r1=177149&r2=177150&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/main.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/main.c Fri Mar 15 07:38:44 2013
@@ -2,6 +2,23 @@
 #include <stdlib.h>
 #include <math.h>
 
+// RNG implemented localy to avoid library incongruences
+#ifdef RAND_MAX
+#undef RAND_MAX
+#endif
+#define RAND_MAX 32767
+static unsigned long long int next = 1;
+
+int rand( void ) {
+    next = next * 1103515245 + 12345;
+    return (unsigned int)(next / 65536) % RAND_MAX+1;
+}
+
+void srand( unsigned int seed ) {
+    next = seed;
+}
+// End of RNG implementation
+
 int main(int argc, char *argv[]) {
 	unsigned MAXSIZE;
 	unsigned MAXWAVES;
@@ -26,6 +43,7 @@ int main(int argc, char *argv[]) {
 		invfft = !strncmp(argv[3],"-i",2);
 	MAXSIZE=atoi(argv[2]);
 	MAXWAVES=atoi(argv[1]);
+  srand(1);
 		
  RealIn=(float*)malloc(sizeof(float)*MAXSIZE);
  ImagIn=(float*)malloc(sizeof(float)*MAXSIZE);

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/telecomm-fft.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/telecomm-fft.reference_output?rev=177150&r1=177149&r2=177150&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/telecomm-fft.reference_output (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/telecomm-fft.reference_output Fri Mar 15 07:38:44 2013
@@ -1 +1 @@
-48e274e91b866eefc8fc45100d091a6f
+d8b17c428e3221dcff66758ba9b93c00





More information about the llvm-commits mailing list