[PATCH] XCore fix for SingleSource/Benchmarks/Misc-C++/Large/sphereflake
robert lytton
robert at xmos.com
Tue Mar 11 11:54:07 PDT 2014
Hi Daniel,
This patch is not target specific but handles the single remaining rounding issue with newlib.
Tested against 'clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu' & 'xcore-clang'.
Robert
Hi rengolin, ddunbar,
http://llvm-reviews.chandlerc.com/D3022
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D3022?vs=7683&id=7752#toc
Files:
SingleSource/Benchmarks/Misc-C++/Large/Makefile
SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
Index: SingleSource/Benchmarks/Misc-C++/Large/Makefile
===================================================================
--- SingleSource/Benchmarks/Misc-C++/Large/Makefile
+++ SingleSource/Benchmarks/Misc-C++/Large/Makefile
@@ -4,9 +4,4 @@
FP_ABSTOLERANCE := 0.01
HASH_PROGRAM_OUTPUT := 1
-ifeq ($(ARCH),XCore)
-# XCore diffs output on 3 of the 65536 numbers
-PROGRAMS_TO_SKIP := sphereflake
-endif
-
include $(LEVEL)/SingleSource/Makefile.singlesrc
Index: SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
===================================================================
--- SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
+++ SingleSource/Benchmarks/Misc-C++/Large/sphereflake.cpp
@@ -147,10 +147,18 @@
// 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.
+// For those values that remain inconsistent, use a hard-coded result.
typedef union { double d; unsigned long long ll; } dbl_ll_union;
static double LLVMsin(double d) {
dbl_ll_union u;
- u.d = sin(d);
+ dbl_ll_union in; in.d = d;
+ switch (in.ll) {
+ case 0x4010C152382D7365ULL: // use hard-coded result.
+ u.ll = 13829347719771606184ULL;
+ break;
+ default:
+ u.d = sin(d);
+ }
u.ll = (u.ll + 1) & ~1ULL;
return u.d;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3022.2.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140311/879319df/attachment.bin>
More information about the llvm-commits
mailing list