[llvm-commits] [test-suite] r105126 - in /test-suite/trunk/SingleSource: Benchmarks/BenchmarkGame/ Benchmarks/BenchmarkGame/Large/ Benchmarks/Misc-C++/ Benchmarks/Misc-C++/Large/ UnitTests/SignlessTypes/ UnitTests/SignlessTypes/Large/
Daniel Dunbar
daniel at zuster.org
Sat May 29 17:48:26 PDT 2010
Author: ddunbar
Date: Sat May 29 19:48:25 2010
New Revision: 105126
URL: http://llvm.org/viewvc/llvm-project?rev=105126&view=rev
Log:
Sink several SingleSource tests with large output into Large/ subdirectories (with HASH_PROGRAM_OUTPUT=1)
Added:
test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/
test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/Makefile
- copied, changed from r105125, test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile
test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/fasta.c
- copied, changed from r105125, test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/Makefile
- copied, changed from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/ray.cpp
- copied, changed from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
- copied, changed from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/Makefile
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/cast.cpp
- copied, changed from r105125, test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp
Removed:
test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp
Modified:
test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile
Copied: test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/Makefile (from r105125, test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/Makefile?p2=test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/Makefile&p1=test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile (original)
+++ test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/Makefile Sat May 29 19:48:25 2010
@@ -1,4 +1,5 @@
-LEVEL = ../../..
+LEVEL = ../../../..
LDFLAGS += -lm
+HASH_PROGRAM_OUTPUT = 1
include $(LEVEL)/SingleSource/Makefile.singlesrc
Copied: test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/fasta.c (from r105125, test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/fasta.c?p2=test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Large/fasta.c&p1=test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
(empty)
Modified: test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile?rev=105126&r1=105125&r2=105126&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile (original)
+++ test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/Makefile Sat May 29 19:48:25 2010
@@ -1,3 +1,4 @@
+DIRS = Large
LEVEL = ../../..
LDFLAGS += -lm
Removed: test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c?rev=105125&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c (original)
+++ test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/fasta.c (removed)
@@ -1,134 +0,0 @@
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- * Contributed by Joern Inge Vestgaarden
- * Modified by Jorge Peixoto de Morais Neto
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <err.h>
-
-#define WIDTH 60
-#define MIN(a,b) ((a) <= (b) ? (a) : (b))
-#define NELEMENTS(x) (sizeof (x) / sizeof ((x)[0]))
-
-typedef struct {
- float p;
- char c;
-} aminoacid_t;
-
-static inline float myrandom (float max) {
- unsigned long const IM = 139968;
- unsigned long const IA = 3877;
- unsigned long const IC = 29573;
- static unsigned long last = 42;
- last = (last * IA + IC) % IM;
- /*Integer to float conversions are faster if the integer is signed*/
- return max * (long) last / IM;
-}
-
-static inline void accumulate_probabilities (aminoacid_t *genelist, size_t len) {
- float cp = 0.0;
- size_t i;
- for (i = 0; i < len; i++) {
- cp += genelist[i].p;
- genelist[i].p = cp;
- }
-}
-
-/* This function prints the characters of the string s. When it */
-/* reaches the end of the string, it goes back to the beginning */
-/* It stops when the total number of characters printed is count. */
-/* Between each WIDTH consecutive characters it prints a newline */
-/* This function assumes that WIDTH <= strlen (s) + 1 */
-static void repeat_fasta (char const *s, size_t count) {
- size_t pos = 0;
- size_t len = strlen (s);
- char *s2 = malloc (len + WIDTH);
- memcpy (s2, s, len);
- memcpy (s2 + len, s, WIDTH);
- do {
- size_t line = MIN(WIDTH, count);
- fwrite (s2 + pos,1,line,stdout);
- putchar ('\n');
- pos += line;
- if (pos >= len) pos -= len;
- count -= line;
- } while (count);
- free (s2);
-}
-
-/* This function takes a pointer to the first element of an array */
-/* Each element of the array is a struct with a character and */
-/* a float number p between 0 and 1. */
-/* The function generates a random float number r and */
-/* finds the first array element such that p >= r. */
-/* This is a weighted random selection. */
-/* The function then prints the character of the array element. */
-/* This is done count times. */
-/* Between each WIDTH consecutive characters, the function prints a newline */
-static void random_fasta (aminoacid_t const *genelist, size_t count) {
- do {
- size_t line = MIN(WIDTH, count);
- size_t pos = 0;
- char buf[WIDTH + 1];
- do {
- float r = myrandom (1.0);
- size_t i = 0;
- while (genelist[i].p < r)
- ++i; /* Linear search */
- buf[pos++] = genelist[i].c;
- } while (pos < line);
- buf[line] = '\n';
- fwrite (buf, 1, line + 1, stdout);
- count -= line;
- } while (count);
-}
-
-int main (int argc, char **argv) {
- size_t n = 5000000;
-
- static aminoacid_t iub[] = {
- { 0.27, 'a' },
- { 0.12, 'c' },
- { 0.12, 'g' },
- { 0.27, 't' },
- { 0.02, 'B' },
- { 0.02, 'D' },
- { 0.02, 'H' },
- { 0.02, 'K' },
- { 0.02, 'M' },
- { 0.02, 'N' },
- { 0.02, 'R' },
- { 0.02, 'S' },
- { 0.02, 'V' },
- { 0.02, 'W' },
- { 0.02, 'Y' }};
-
- static aminoacid_t homosapiens[] = {
- { 0.3029549426680, 'a' },
- { 0.1979883004921, 'c' },
- { 0.1975473066391, 'g' },
- { 0.3015094502008, 't' }};
-
- accumulate_probabilities (iub, NELEMENTS(iub));
- accumulate_probabilities (homosapiens, NELEMENTS(homosapiens));
-
- static char const *const alu ="\
-GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\
-GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\
-CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\
-ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\
-GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\
-AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\
-AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
-
- fputs (">ONE Homo sapiens alu\n", stdout);
- repeat_fasta (alu, 2 * n);
- fputs (">TWO IUB ambiguity codes\n", stdout);
- random_fasta (iub, 3 * n);
- fputs (">THREE Homo sapiens frequency\n", stdout);
- random_fasta (homosapiens, 5 * n);
- return 0;
-}
\ No newline at end of file
Copied: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/Makefile (from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/Makefile?p2=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/Makefile&p1=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Makefile&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/Makefile Sat May 29 19:48:25 2010
@@ -1,6 +1,7 @@
-LEVEL = ../../..
+LEVEL = ../../../..
LDFLAGS += -lm -lstdc++
LIBS = -lstdc++
FP_ABSTOLERANCE := 0.01
+HASH_PROGRAM_OUTPUT := 1
include $(LEVEL)/SingleSource/Makefile.singlesrc
Copied: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/ray.cpp (from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/ray.cpp?p2=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/ray.cpp&p1=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/ray.cpp&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
(empty)
Copied: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp (from r105125, test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/sphereflake.cpp?p2=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/sphereflake.cpp&p1=test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/sphereflake.cpp&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
(empty)
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Makefile?rev=105126&r1=105125&r2=105126&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Makefile Sat May 29 19:48:25 2010
@@ -1,4 +1,5 @@
LEVEL = ../../..
+DIRS := Large
LDFLAGS += -lm -lstdc++
LIBS = -lstdc++
FP_ABSTOLERANCE := 0.01
Removed: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/ray.cpp?rev=105125&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/ray.cpp (removed)
@@ -1,129 +0,0 @@
-#include <cstdlib>
-#include <list>
-#include <iostream>
-#include <limits>
-#include <cmath>
-
-using namespace std;
-
-numeric_limits<double> real;
-double delta = sqrt(real.epsilon()), infinity = real.infinity();
-
-struct Vec {
- double x, y, z;
- Vec(double x2, double y2, double z2) : x(x2), y(y2), z(z2) {}
-};
-Vec operator+(const Vec &a, const Vec &b)
-{ return Vec(a.x+b.x, a.y+b.y, a.z+b.z); }
-Vec operator-(const Vec &a, const Vec &b)
-{ return Vec(a.x-b.x, a.y-b.y, a.z-b.z); }
-Vec operator*(double a, const Vec &b) { return Vec(a*b.x, a*b.y, a*b.z); }
-double dot(const Vec &a, const Vec &b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
-Vec unitise(const Vec &a) { return (1 / sqrt(dot(a, a))) * a; }
-
-typedef pair<double, Vec> Hit;
-
-struct Ray {
- Vec orig, dir;
- Ray(const Vec &o, const Vec &d) : orig(o), dir(d) {}
-};
-
-struct Scene {
- virtual ~Scene() {};
- virtual Hit intersect(const Hit &, const Ray &) const = 0;
-};
-
-struct Sphere : public Scene {
- Vec center;
- double radius;
-
- Sphere(Vec c, double r) : center(c), radius(r) {}
- ~Sphere() {}
-
- double ray_sphere(const Ray &ray) const {
- Vec v = center - ray.orig;
- double b = dot(v, ray.dir), disc = b*b - dot(v, v) + radius * radius;
- if (disc < 0) return infinity;
- double d = sqrt(disc), t2 = b + d;
- if (t2 < 0) return infinity;
- double t1 = b - d;
- return (t1 > 0 ? t1 : t2);
- }
-
- Hit intersect(const Hit &hit, const Ray &ray) const {
- double lambda = ray_sphere(ray);
- if (lambda >= hit.first) return hit;
- return Hit(lambda, unitise(ray.orig + lambda*ray.dir - center));
- }
-};
-
-typedef list<Scene *> Scenes;
-struct Group : public Scene {
- Sphere bound;
- Scenes child;
-
- Group(Sphere b, Scenes c) : bound(b), child(c) {}
- ~Group() {
- for (Scenes::const_iterator it=child.begin(); it!=child.end(); ++it)
- delete *it;
- }
-
- Hit intersect(const Hit &hit, const Ray &ray) const {
- Hit hit2=hit;
- double l = bound.ray_sphere(ray);
- if (l >= hit.first) return hit;
- for (Scenes::const_iterator it=child.begin(); it!=child.end(); ++it)
- hit2 = (*it)->intersect(hit2, ray);
- return hit2;
- }
-};
-
-Hit intersect(const Ray &ray, const Scene &s)
-{ return s.intersect(Hit(infinity, Vec(0, 0, 0)), ray); }
-
-double ray_trace(const Vec &light, const Ray &ray, const Scene &s) {
- Hit hit = intersect(ray, s);
- if (hit.first == infinity) return 0;
- double g = dot(hit.second, light);
- if (g >= 0) return 0.;
- Vec p = ray.orig + hit.first*ray.dir + delta*hit.second;
- return (intersect(Ray(p, -1. * light), s).first < infinity ? 0 : -g);
-}
-
-Scene *create(int level, const Vec &c, double r) {
- Scene *s = new Sphere(c, r);
- if (level == 1) return s;
- Scenes child;
- child.push_back(s);
- double rn = 3*r/sqrt(12.);
- for (int dz=-1; dz<=1; dz+=2)
- for (int dx=-1; dx<=1; dx+=2)
- child.push_back(create(level-1, c + rn*Vec(dx, 1, dz), r/2));
- return new Group(Sphere(c, 3*r), child);
-}
-
-#ifdef SMALL_PROBLEM_SIZE
-#define TEST_SIZE 128
-#else
-#define TEST_SIZE 512
-#endif
-
-int main(int argc, char *argv[]) {
- int level = 6, n = TEST_SIZE, ss = 4;
- if (argc == 2) level = atoi(argv[1]);
- Vec light = unitise(Vec(-1, -3, 2));
- Scene *s(create(level, Vec(0, -1, 0), 1));
- cout << "P5\n" << n << " " << n << "\n255\n";
- for (int y=n-1; y>=0; --y)
- for (int x=0; x<n; ++x) {
- double g=0;
- for (int dx=0; dx<ss; ++dx)
- for (int dy=0; dy<ss; ++dy) {
- Vec dir(unitise(Vec(x+dx*1./ss-n/2., y+dy*1./ss-n/2., n)));
- g += ray_trace(light, Ray(Vec(0, 0, -4), dir), *s);
- }
- cout << char(int(.5 + 255. * g / (ss*ss)));
- }
- delete s;
- return 0;
-}
Removed: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/sphereflake.cpp?rev=105125&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/sphereflake.cpp (removed)
@@ -1,185 +0,0 @@
-// sphere flake bvh raytracer (c) 2005, thierry berger-perrin <tbptbp at gmail.com>
-// this code is released under the GNU Public License.
-#include <cmath> // see http://ompf.org/ray/sphereflake/
-#include <cstdlib>
-#include <iostream> // compile with ie g++ -O2 -ffast-math sphereflake.cc
-#define GIMME_SHADOWS // usage: ./sphereflake [lvl=6] >pix.ppm
-
-enum { childs = 9, ss= 2, ss_sqr = ss*ss }; /* not really tweakable anymore */
-static const double infinity = 1./0, epsilon = 1e-12;
-
-struct v_t{ double x,y,z;v_t(){}
- v_t(const double a,const double b,const double c):x(a),y(b),z(c){}
- v_t operator+(const v_t&v)const{return v_t(x+v.x,y+v.y,z+v.z);}
- v_t operator-(const v_t&v)const{return v_t(x-v.x,y-v.y,z-v.z);}
- v_t operator-()const{return v_t(-x,-y,-z);}
- v_t operator*(const double d)const{return v_t(x*d,y*d,z*d);}
- v_t cross(const v_t&v)const{return v_t(y*v.z-z*v.y,z*v.x-x*v.z,x*v.y-y*v.x);}
- v_t norm()const{return*this*(1./sqrt(magsqr()));}
- double dot(const v_t&v)const{return x*v.x+y*v.y+z*v.z;}
- double magsqr()const{return dot(*this);}
-};
-
-//static const v_t light(v_t(0.5,-.95,1.775).norm()); /*pick one*/
-static const v_t light(v_t(-0.5,-.65,.9).norm()); /*fiat lux*/
-
-struct ray_t{
- v_t o,d;
- ray_t(const v_t&v):o(v){}
- ray_t(const v_t&v,const v_t&w):o(v),d(w){}
-};
-struct hit_t {
- v_t n;
- double t;
- hit_t():n(v_t(0,0,0)),t(infinity){}
-};
-
-struct sphere_t{
- v_t o;
- double r;
- sphere_t(){}
- sphere_t(const v_t&v,double d):o(v),r(d){}
- v_t get_normal(const v_t&v)const{return(v-o)*(1./r);}
- double intersect(const ray_t&ray)const{
- const v_t v(o-ray.o); const double b=ray.d.dot(v),disc=b*b-v.magsqr()+r*r;
- if(disc < 0.)
- return infinity; /*branch away from the square root*/
- const double d=sqrt(disc), t2=b+d, t1=b-d; /*cond. move*/
- if(t2 < 0.)
- return infinity;
- else
- return(t1 > 0.? t1 : t2);
- }
-};
-
-struct node_t;
-static node_t *pool=0, *end=0;
-
-struct node_t { /*a bvh in array form+skip for navigation.*/
- sphere_t bound,leaf;
- long diff;/*far from optimal*/
- node_t(){} node_t(const sphere_t&b,const sphere_t&l,const long jump) :bound(b),leaf(l),diff(jump){}
- template<bool shadow> static void intersect(const ray_t &ray,hit_t &hit){
- const node_t*p=pool;
- while(p < end) {
- if(p->bound.intersect(ray)>=hit.t) /*missed bound*/
- p+=p->diff; /*skip subtree*/
- else{
- const double t=p->leaf.intersect(ray);
- if(t < hit.t) { /*if hit, update, then break for shadows*/
- hit.t=t;
- if(shadow) break;
- hit.n=p->leaf.get_normal(ray.o+ray.d*t);
- }
- ++p; /*next!*/
- }
- }
- }
-};
-
-static double ray_trace(const node_t*const scene,const ray_t&ray) {
- hit_t hit;
- scene->intersect<false>(ray,hit);// trace primary
- const double diffuse = hit.t==infinity ? 0. : -hit.n.dot(light);
- #ifdef GIMME_SHADOWS
- if (diffuse <= 0.)
- return 0.;
- const ray_t sray(ray.o+(ray.d*hit.t)+(hit.n*epsilon),-light);
- hit_t shit;
- scene->intersect<true>(sray,shit);// trace shadow
- return shit.t==infinity ? diffuse : 0.;
- #else
- return diffuse > 0. ? diffuse : 0.;
- #endif
-}
-
-static const double grid[ss_sqr][2]={ /*our rotated grid*/
- {-3/3.,-1/3.},{+1/3.,-3/3.},
- {-1/3.,+3/3.},{+3/3.,+1/3.}
-};
-static void trace_rgss(const int width,const int height) {
- const double w=width,h=height,rcp=1/double(ss),scale=256./double(ss_sqr);
- ray_t ray(v_t(0,0,-4.5)); /* eye, looking into Z */
- v_t rgss[ss_sqr];
- for(int i=0;i<ss_sqr;++i) /*precomp.*/
- rgss[i]=v_t(grid[i][0]*rcp-w/2.,grid[i][1]*rcp-h/2.,0);
-
- v_t scan(0,w-1,std::max(w,h)); /*scan line*/
- for(int i=height;i;--i) {
- for(int j=width;j;--j) {
- double g=0;
- for(int idx=0;idx < ss_sqr;++idx){ /*AA*/
- ray.d=(scan+rgss[idx]).norm();
- g+=ray_trace(pool,ray); /*trace*/
- }
- std::cout << int(scale*g)<< " ";
- scan.x+=1; /*next pixel*/
- }
- scan.x=0;scan.y-=1; /*next line*/
- }
- std::cout << std::endl;
-}
-
-struct basis_t{ /* bogus and compact, exactly what we need */
- v_t up,b1,b2;
- basis_t(const v_t&v){ const v_t n(v.norm());
- if ((n.x*n.x !=1.)&(n.y*n.y !=1.)&(n.z*n.z !=1.)) {/*cough*/
- b1=n;
- if(n.y*n.y>n.x*n.x) {
- if(n.y*n.y>n.z*n.z)
- b1.y=-b1.y;
- else b1.z=-b1.z;
- }
- else if(n.z*n.z > n.x*n.x)
- b1.z=-b1.z;
- else b1.x=-b1.x;
- }
- else
- b1=v_t(n.z,n.x,n.y);/*leaves some cases out,dodge them*/
-
- up=n;
- b2=up.cross(b1);
- b1=up.cross(b2);
- }
-};
-
-static node_t *create(node_t*n,const int lvl,int dist,v_t c,v_t d,double r) {
- n = 1 + new (n) node_t(sphere_t(c,2.*r),sphere_t(c,r), lvl > 1 ? dist : 1);
- if (lvl <= 1)
- return n; /*if not at the bottom, recurse a bit more*/
-
- dist=std::max((dist-childs)/childs,1); const basis_t b(d);
- const double nr=r*1/3.,daL=2.*M_PI/6.,daU=2.*M_PI/3.; double a=0;
- for(int i=0;i<6;++i){ /*lower ring*/
- const v_t ndir((d*-.2+b.b1*sin(a)+b.b2*cos(a)).norm()); /*transcendentals?!*/
- n=create(n,lvl-1,dist,c+ndir*(r+nr),ndir,nr);
- a+=daL;
- }
- a-=daL/3.;/*tweak*/
- for(int i=0;i<3;++i){ /*upper ring*/
- const v_t ndir((d*+.6+b.b1*sin(a)+b.b2*cos(a)).norm());
- n=create(n,lvl-1,dist,c+ndir*(r+nr),ndir,nr); a+=daU;
- }
- return n;
-}
-
-#ifdef SMALL_PROBLEM_SIZE
-#define TEST_SIZE 256
-#else
-#define TEST_SIZE 1024
-#endif
-
-int main(int argc,char*argv[]){
- enum{ w = TEST_SIZE, h = w }; /* resolution */
- const int lvl=(argc==2?std::max(atoi(argv[1]),2):6);
- int count=childs, dec=lvl;
- while(--dec > 1) count=(count*childs)+childs;
- ++count;
- std::cerr << count << " spheres,claiming " << (count*sizeof(node_t))/(1024.*1024) << " MB." << std::endl;
- pool=new node_t[count]; /* raw */
- end=pool+count;
- create(pool,lvl,count,v_t(0,0,0),v_t(+.25,+1,-.5).norm(),1.); /* cooked */
- std::cout << "P2\n" << w << " " << h << "\n256\n";
- trace_rgss(w,h); /* served */
- return 0;
-}
Added: test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/Makefile?rev=105126&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/Makefile (added)
+++ test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/Makefile Sat May 29 19:48:25 2010
@@ -0,0 +1,5 @@
+LEVEL = ../../../..
+RUN_OPTIONS := 31415926
+LDFLAGS += -lstdc++
+HASH_PROGRAM_OUTPUT = 1
+include $(LEVEL)/SingleSource/Makefile.singlesrc
Copied: test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/cast.cpp (from r105125, test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp)
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/cast.cpp?p2=test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Large/cast.cpp&p1=test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp&r1=105125&r2=105126&rev=105126&view=diff
==============================================================================
(empty)
Modified: test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile?rev=105126&r1=105125&r2=105126&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile (original)
+++ test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile Sat May 29 19:48:25 2010
@@ -1,4 +1,5 @@
-# SingleSource/UnitTests/Vector/Makefile
+DIRS := Large
+
LEVEL = ../../..
# You can use this seed value to get a different test
Removed: test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp?rev=105125&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp (original)
+++ test-suite/trunk/SingleSource/UnitTests/SignlessTypes/cast.cpp (removed)
@@ -1,152 +0,0 @@
-/*
- * This file is used to test combinations of eliminable cast
- * operations to ensure that the logic in InstCombine is correct.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(int argc, char**argv) {
- int testVal = 42;
- int i;
- if (argc > 1)
- testVal = atoi(argv[1]);
- printf("testVal = %d\n", testVal);
-
- // First check for elimination of A -> B -> C type casts.
-
- // Make sure the loop goes through 256 values to catch at
- // least some single byte signed issues.
- for (i = -128+testVal; i < 128+testVal; ++i) {
-
-#define TRIPLECAST(num, first, second, third) \
-{ \
- first X = (first) num; \
- second Y = (second) X; \
- third Z = (third) Y; \
- printf("Test %d(%s) -> %s -> %s = %d\n", \
- num, #first, #second, #third,(int)Z); \
-}
-
- // Test same size with sign rotation
- TRIPLECAST(i, unsigned char, unsigned char, unsigned char);
- TRIPLECAST(i, unsigned char, unsigned char, signed char);
- TRIPLECAST(i, unsigned char, signed char, unsigned char);
- TRIPLECAST(i, unsigned char, signed char, signed char);
- TRIPLECAST(i, signed char, unsigned char, unsigned char);
- TRIPLECAST(i, signed char, unsigned char, signed char);
- TRIPLECAST(i, signed char, signed char, unsigned char);
- TRIPLECAST(i, signed char, signed char, signed char);
- TRIPLECAST(i, unsigned short, unsigned short, unsigned short);
- TRIPLECAST(i, unsigned short, unsigned short, signed short);
- TRIPLECAST(i, unsigned short, signed short, unsigned short);
- TRIPLECAST(i, unsigned short, signed short, signed short);
- TRIPLECAST(i, signed short, unsigned short, unsigned short);
- TRIPLECAST(i, signed short, unsigned short, signed short);
- TRIPLECAST(i, signed short, signed short, unsigned short);
- TRIPLECAST(i, signed short, signed short, signed short);
- TRIPLECAST(i, unsigned int, unsigned int, unsigned int);
- TRIPLECAST(i, unsigned int, unsigned int, signed int);
- TRIPLECAST(i, unsigned int, signed int, unsigned int);
- TRIPLECAST(i, unsigned int, signed int, signed int);
- TRIPLECAST(i, signed int, unsigned int, unsigned int);
- TRIPLECAST(i, signed int, unsigned int, signed int);
- TRIPLECAST(i, signed int, signed int, unsigned int);
- TRIPLECAST(i, signed int, signed int, signed int);
- TRIPLECAST(i, unsigned long, unsigned long, unsigned long);
- TRIPLECAST(i, unsigned long, unsigned long, signed long);
- TRIPLECAST(i, unsigned long, signed long, unsigned long);
- TRIPLECAST(i, unsigned long, signed long, signed long);
- TRIPLECAST(i, signed long, unsigned long, unsigned long);
- TRIPLECAST(i, signed long, unsigned long, signed long);
- TRIPLECAST(i, signed long, signed long, unsigned long);
- TRIPLECAST(i, signed long, signed long, signed long);
-
- // Same size through larger size
- TRIPLECAST(i, unsigned char, unsigned short, unsigned char);
- TRIPLECAST(i, unsigned char, unsigned short, signed char);
- TRIPLECAST(i, unsigned char, signed short, unsigned char);
- TRIPLECAST(i, unsigned char, signed short, signed char);
- TRIPLECAST(i, signed char, unsigned short, unsigned char);
- TRIPLECAST(i, signed char, unsigned short, signed char);
- TRIPLECAST(i, signed char, signed short, unsigned char);
- TRIPLECAST(i, signed char, signed short, signed char);
- TRIPLECAST(i, unsigned short, unsigned int, unsigned short);
- TRIPLECAST(i, unsigned short, unsigned int, signed short);
- TRIPLECAST(i, unsigned short, signed int, unsigned short);
- TRIPLECAST(i, unsigned short, signed int, signed short);
- TRIPLECAST(i, signed short, unsigned int, unsigned short);
- TRIPLECAST(i, signed short, unsigned int, signed short);
- TRIPLECAST(i, signed short, signed int, unsigned short);
- TRIPLECAST(i, signed short, signed int, signed short);
- TRIPLECAST(i, unsigned int, unsigned long, unsigned int);
- TRIPLECAST(i, unsigned int, unsigned long, signed int);
- TRIPLECAST(i, unsigned int, signed long, unsigned int);
- TRIPLECAST(i, unsigned int, signed long, signed int);
- TRIPLECAST(i, signed int, unsigned long, unsigned int);
- TRIPLECAST(i, signed int, unsigned long, signed int);
- TRIPLECAST(i, signed int, signed long, unsigned int);
- TRIPLECAST(i, signed int, signed long, signed int);
-
- // Larger size through smaller size
- TRIPLECAST(i, unsigned short, unsigned char, unsigned short);
- TRIPLECAST(i, unsigned short, unsigned char, signed short);
- TRIPLECAST(i, unsigned short, signed char, unsigned short);
- TRIPLECAST(i, unsigned short, signed char, signed short);
- TRIPLECAST(i, signed short, unsigned char, unsigned short);
- TRIPLECAST(i, signed short, unsigned char, signed short);
- TRIPLECAST(i, signed short, signed char, unsigned short);
- TRIPLECAST(i, signed short, signed char, signed short);
- TRIPLECAST(i, unsigned int, unsigned short, unsigned int);
- TRIPLECAST(i, unsigned int, unsigned short, signed int);
- TRIPLECAST(i, unsigned int, signed short, unsigned int);
- TRIPLECAST(i, unsigned int, signed short, signed int);
- TRIPLECAST(i, signed int, unsigned short, unsigned int);
- TRIPLECAST(i, signed int, unsigned short, signed int);
- TRIPLECAST(i, signed int, signed short, unsigned int);
- TRIPLECAST(i, signed int, signed short, signed int);
- TRIPLECAST(i, unsigned long, unsigned int, unsigned long);
- TRIPLECAST(i, unsigned long, unsigned int, signed long);
- TRIPLECAST(i, unsigned long, signed int, unsigned long);
- TRIPLECAST(i, unsigned long, signed int, signed long);
- TRIPLECAST(i, signed long, unsigned int, unsigned long);
- TRIPLECAST(i, signed long, unsigned int, signed long);
- TRIPLECAST(i, signed long, signed int, unsigned long);
- TRIPLECAST(i, signed long, signed int, signed long);
- }
-
- // Check cast to bool
-#define CASTTOBOOL(num, type) \
-{ \
- type Y = (type) num; \
- bool X = (bool) num; \
- printf("%d(%s) -> bool = %d\n", num, #type, (int)X); \
-}
- CASTTOBOOL(testVal, float);
- CASTTOBOOL(testVal, long);
- CASTTOBOOL(testVal, unsigned int);
- CASTTOBOOL(testVal, signed char);
- CASTTOBOOL(testVal, bool);
-
- // Check useless getelementptr
- {
- static int sillyArray[8] = { 2, 3, 5, 7, 11, 13, 17, 19 };
- int* i_ptr = &sillyArray[ 0 ];
- long* l_ptr = (long*) i_ptr;
- printf("%ld\n", *l_ptr);
- }
-
- // Cast of malloc result to another type
- {
- // Note: must use volatile, otherwise g++ miscompiles at -O2 (but not LLVM)
- volatile float* float_ptr = (float*) malloc(sizeof(unsigned));
- *float_ptr = 10;
- volatile unsigned* unsigned_ptr = (volatile unsigned*) float_ptr;
- printf("%x\n", *unsigned_ptr);
- }
-
- // Propagation of single-use casts into other instructions
- {
- }
- return 0;
-}
More information about the llvm-commits
mailing list