[llvm-commits] [test-suite] r49147 [1/3] - in /test-suite/trunk/MultiSource/Benchmarks/BitBench: Makefile drop3/ drop3/Makefile drop3/drop3.c drop3/input-file drop3/input-file.c huffman/ huffman/Makefile huffman/huffman.c huffman/input-file huffman/input-file.c uudecode/ uudecode/Makefile uudecode/input-file uudecode/uudecode.c uuencode/ uuencode/Makefile uuencode/uuencode.c

Owen Anderson resistor at mac.com
Wed Apr 2 23:40:56 PDT 2008


Author: resistor
Date: Thu Apr  3 01:40:56 2008
New Revision: 49147

URL: http://llvm.org/viewvc/llvm-project?rev=49147&view=rev
Log:
Add the rest of BitBench.

Added:
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/Makefile
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/input-file
    test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/input-file.c
    test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/
    test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/Makefile
    test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/huffman.c
    test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/input-file   (with props)
    test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/input-file.c
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uudecode/
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uudecode/Makefile
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uudecode/input-file
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uudecode/uudecode.c
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/Makefile
    test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c
Modified:
    test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile

Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile?rev=49147&r1=49146&r2=49147&view=diff

==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile (original)
+++ test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile Thu Apr  3 01:40:56 2008
@@ -4,7 +4,7 @@
 
 ## NOTE: This must remain in this order, so that the labels in the nightly 
 ## tester gnuplot scripts are correct.
-PARALLEL_DIRS  := five11
+PARALLEL_DIRS  := five11 drop3 huffman uudecode uuencode
 
 include $(LEVEL)/Makefile.programs
 

Added: test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/Makefile?rev=49147&view=auto

==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/Makefile (added)
+++ test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/Makefile Thu Apr  3 01:40:56 2008
@@ -0,0 +1,6 @@
+LEVEL = ../../../..
+
+PROG     = drop3
+LDFLAGS  = 
+RUN_OPTIONS = input-file
+include $(LEVEL)/MultiSource/Makefile.multisrc

Added: test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c?rev=49147&view=auto

==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c (added)
+++ test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c Thu Apr  3 01:40:56 2008
@@ -0,0 +1,105 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#define MAX_SIZE 4000000
+#define ITER 10
+
+int drop_0xx(unsigned char *in, unsigned char *out, size_t size) {/*1*/
+  int left = size;                                                /*2*/
+  unsigned short ibuf = 0;                                        /*3*/
+  unsigned short obuf = 0;                                        /*4*/
+  unsigned char res;                                              /*5*/
+  int outoff = 0;                                                 /*6*/
+
+  /* The Macro contains lines 7-14 */ 
+#define IN(N) \
+  { \
+    if ((left -= 3) < 0) break; \
+    if (N < 3) ibuf |= *in++ << (8 - N); \
+    if ((res = (ibuf >> (16-3))) >= 4) \
+      { \
+        obuf = (obuf << 3) | res; \
+        outoff += 3; \
+        if ((outoff & 7) < 3) *out++ = (obuf >> (outoff & 7)); \
+      } \
+    ibuf <<= 3; \
+  }
+
+  for (;;) {                                                      /*15*/
+    IN(0)                                                         /*16*/
+    IN(5)                                                         /*17*/
+    IN(2)                                                         /*18*/
+    IN(7)                                                         /*19*/
+    IN(4)                                                         /*20*/
+    IN(1)                                                         /*21*/
+    IN(6)                                                         /*22*/
+    IN(3)                                                         /*23*/
+      }
+
+  if ((outoff & 7) != 0)                                          /*24*/
+    {*out++ = (obuf << (8 - (outoff & 7)));}                      /*25*/
+  return ((outoff) >> 3);                                         /*26*/
+}
+/*==========================================================================*/
+
+static size_t read_data(FILE *in, void *buffer)
+{ 
+  return fread(buffer, 1, MAX_SIZE, in);
+}
+
+static size_t write_data(FILE *out, int size, void *buffer)
+{ 
+  return fwrite(buffer, 1, size, out);
+}
+
+int main(int argc, char *argv[])
+{
+  FILE *in,*out;
+  int i;
+  size_t size;
+  int outsize,time;
+  unsigned char *inbuf, *outbuf, *temp;
+  char outfilename[100];
+  char postfix[] = ".c";
+  struct timeval pre,post;
+  
+  
+  /* optional input arg */
+  inbuf = malloc(MAX_SIZE);
+  outbuf = malloc(MAX_SIZE);
+
+  if (argc > 1) {
+    //create_test_data(argv[1]); // for testing purposes
+    if ((in = fopen(argv[1], "r")) == NULL) {
+      perror(argv[1]);
+      exit(1);
+    }
+    strcpy(outfilename,argv[1]);
+    strcat(outfilename,postfix);
+    if ((out = fopen(outfilename, "w")) == NULL) {
+      perror(outfilename);
+      exit(1);
+    }
+    argv++; argc--;
+  }
+  else
+    in = stdin;
+  if (argc != 1) {
+    printf("Usage: drop_0XX [infile]\n");
+    exit(2);
+  }
+  size = read_data(in, inbuf);
+  gettimeofday(&pre,0);
+  for(i=0;i<20;i++){
+    temp = inbuf;
+    outsize = drop_0xx(temp, outbuf, size*8);
+   
+  }
+  gettimeofday(&post,0);
+  time = ((post.tv_sec*1000000+post.tv_usec)-(pre.tv_sec*1000000+pre.tv_usec));
+  printf("%d", outsize);
+  exit(0); 
+}
\ No newline at end of file





More information about the llvm-commits mailing list