[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c build.c main.c tsp.c tsp.h

anon at cs.uiuc.edu anon at cs.uiuc.edu
Tue Feb 24 18:14:12 PST 2009



Changes in directory llvm-test/MultiSource/Benchmarks/Olden/tsp:

args.c updated: 1.3 -> 1.4
build.c updated: 1.1 -> 1.2
main.c updated: 1.2 -> 1.3
tsp.c updated: 1.2 -> 1.3
tsp.h updated: 1.2 -> 1.3
---
Log message:



---
Diffs of the changes:  (+64 -2)

 args.c  |    1 +
 build.c |    2 ++
 main.c  |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tsp.c   |    2 +-
 tsp.h   |    2 +-
 5 files changed, 64 insertions(+), 2 deletions(-)


Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c
diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.3 llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.4
--- llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.3	Mon May 20 16:53:09 2002
+++ llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c	Tue Feb 24 20:13:42 2009
@@ -1,6 +1,7 @@
 /* For copyright information, see olden_v1.0/COPYRIGHT */
 
 #include <fcntl.h>
+#include <stdlib.h>
 #include "tsp.h"
 int NumNodes, NDim;
 int flag;


Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c
diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.1 llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.2
--- llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.1	Tue Nov  6 16:51:46 2001
+++ llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c	Tue Feb 24 20:13:42 2009
@@ -29,7 +29,9 @@
 #define  M_E3     20.08553692318766774179
 #define M_E6 403.42879349273512264299
 #define M_E12 162754.79141900392083592475
+#ifndef NULL
 #define NULL 0
+#endif
 
 #include "tsp.h"
 #ifdef FUTURES


Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c
diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.3
--- llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.2	Thu Feb 14 14:08:44 2002
+++ llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c	Tue Feb 24 20:13:42 2009
@@ -55,3 +55,62 @@
 
   return 0;
 }
+
+
+
+
+/* borrowed from libc/misc/drand48.c in Linux libc-5.4.46 this quick
+ * hack by Martin Hamilton <martinh at gnu.org> to make Squid build on
+ * Win32 with GNU-Win32 - sorry, folks! */
+
+#ifndef HAVE_DRAND48
+
+#define N	16
+#define MASK	((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1)
+#define LOW(x)	((unsigned)(x) & MASK)
+#define HIGH(x)	LOW((x) >> N)
+#define MUL(x, y, z)	{ long l = (long)(x) * (long)(y); \
+		(z)[0] = LOW(l); (z)[1] = HIGH(l); }
+#define CARRY(x, y)	((long)(x) + (long)(y) > MASK)
+#define ADDEQU(x, y, z)	(z = CARRY(x, (y)), x = LOW(x + (y)))
+#define X0	0x330E
+#define X1	0xABCD
+#define X2	0x1234
+#define A0	0xE66D
+#define A1	0xDEEC
+#define A2	0x5
+#define C	0xB
+
+static void next(void);
+static unsigned x[3] =
+{X0, X1, X2}, a[3] =
+{A0, A1, A2}, c = C;
+
+double drand48(void);
+
+double
+drand48(void)
+{
+    static double two16m = 1.0 / (1L << N);
+    next();
+    return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2]));
+}
+
+static void
+next(void)
+{
+    unsigned p[2], q[2], r[2], carry0, carry1;
+
+    MUL(a[0], x[0], p);
+    ADDEQU(p[0], c, carry0);
+    ADDEQU(p[1], carry0, carry1);
+    MUL(a[0], x[1], q);
+    ADDEQU(p[1], q[0], carry0);
+    MUL(a[1], x[0], r);
+    x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] +
+	a[0] * x[2] + a[1] * x[1] + a[2] * x[0]);
+    x[1] = LOW(p[1] + r[0]);
+    x[0] = LOW(p[0]);
+}
+
+#endif /* HAVE_DRAND48 */
\ No newline at end of file


Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c
diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.3
--- llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.2	Thu Feb 14 14:08:44 2002
+++ llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c	Tue Feb 24 20:13:42 2009
@@ -44,8 +44,8 @@
 /* reverse orientation of list */
 static void reverse(Tree t) {
   Tree prev,back,next,tmp;
-
   if (!t) return;
+
   /*chatting("REVERSE\n");*/
   /*print_list(t);*/
   prev = t->prev;


Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h
diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.3
--- llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.2	Sun Mar 24 14:32:57 2002
+++ llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h	Tue Feb 24 20:13:42 2009
@@ -8,7 +8,7 @@
 extern int flag;
 
 double drand48(void);
-int atoi(const char *);
+/* int atoi(const char *);*/
 int dealwithargs(int argc, char *argv[]);
 
   






More information about the llvm-commits mailing list