[llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 6 19:51:01 PDT 2003


Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++:

ary2.cpp added (r1.1)

---
Log message:

Initial checkin of ary2 test


---
Diffs of the changes:  (+0 -0)

Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp
diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp:1.1
*** /dev/null	Mon Oct  6 19:50:22 2003
--- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp	Mon Oct  6 19:50:12 2003
***************
*** 0 ****
--- 1,43 ----
+ // -*- mode: c++ -*-
+ // $Id: ary2.cpp,v 1.1 2003/10/07 00:50:12 lattner Exp $
+ // http://www.bagley.org/~doug/shootout/
+ 
+ #include <iostream.h>
+ #include <vector>
+ 
+ int
+ main(int argc, char *argv[]) {
+     int i, n = ((argc == 2) ? atoi(argv[1]) : 1);
+     typedef vector<int> ARY;
+     ARY x(n);
+     ARY y(n);
+ 
+     for (i=0; i<n;) {
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+ 	x[i] = i; ++i;
+     }
+     for (int i = n - 1; i >= 0;) {
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+ 
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+         y[i] = x[i]; --i;
+     }
+ 
+     cout << y.back() << endl;
+ }





More information about the llvm-commits mailing list