[llvm-commits] [test-suite] r109240 - in /test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large: sphereflake.cpp sphereflake.reference_output sphereflake.reference_output.small
Bob Wilson
bob.wilson at apple.com
Fri Jul 23 10:43:29 PDT 2010
Author: bwilson
Date: Fri Jul 23 12:43:29 2010
New Revision: 109240
URL: http://llvm.org/viewvc/llvm-project?rev=109240&view=rev
Log:
Round the results of sin() and cos() to make the output of this test
consistent across platforms.
Modified:
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output
test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output.small
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/sphereflake.cpp?rev=109240&r1=109239&r2=109240&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp Fri Jul 23 12:43:29 2010
@@ -143,6 +143,25 @@
}
};
+// LLVM LOCAL begin
+// Implementations of sin() and cos() may vary slightly in the accuracy of
+// their results, typically only in the least significant bit. Round to make
+// the results consistent across platforms.
+typedef union { double d; unsigned long long ll; } dbl_ll_union;
+static double LLVMsin(double d) {
+ dbl_ll_union u;
+ u.d = sin(d);
+ u.ll = (u.ll + 1) & ~1ULL;
+ return u.d;
+}
+static double LLVMcos(double d) {
+ dbl_ll_union u;
+ u.d = cos(d);
+ u.ll = (u.ll + 1) & ~1ULL;
+ return u.d;
+}
+// LLVM LOCAL end
+
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)
@@ -151,13 +170,13 @@
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?!*/
+ const v_t ndir((d*-.2+b.b1*LLVMsin(a)+b.b2*LLVMcos(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());
+ const v_t ndir((d*+.6+b.b1*LLVMsin(a)+b.b2*LLVMcos(a)).norm());
n=create(n,lvl-1,dist,c+ndir*(r+nr),ndir,nr); a+=daU;
}
return n;
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/sphereflake.reference_output?rev=109240&r1=109239&r2=109240&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output Fri Jul 23 12:43:29 2010
@@ -1 +1 @@
-5a973a1f0583225a283e1c0a54f30a62
+064dd68da3963cf8d246e133a4f10486
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output.small
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc-C%2B%2B/Large/sphereflake.reference_output.small?rev=109240&r1=109239&r2=109240&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output.small (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large/sphereflake.reference_output.small Fri Jul 23 12:43:29 2010
@@ -1 +1 @@
-6c06837938f0cd3f5bd2ce2bb40203c1
+e26178e536120193d34cb6b360938194
More information about the llvm-commits
mailing list