[PATCH] XCore fix for SingleSource/Benchmarks/Misc-C++/Large/sphereflake
robert lytton
robert at xmos.com
Mon Mar 10 03:43:44 PDT 2014
Hi rengolin, ddunbar,
Newlib sin() needed rounding down instead of up on one calculation.
Without this fix, rounding is compounded affecting 3 output values and hence the expected hash.
Alternatively, the rounding mechanism could be changed to round the bottom 2 bits for all targets for both sin & cos.
(Also why do we round up instead of down?)
viz:
u.ll &= ~3ULL;
http://llvm-reviews.chandlerc.com/D3022
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
@@ -151,6 +151,12 @@
static double LLVMsin(double d) {
dbl_ll_union u;
u.d = sin(d);
+#ifdef __XS1B__
+ if (u.ll == 13829347719771606185ULL)
+ // XCore's newlib result needs rounding down instead of up.
+ u.ll = 13829347719771606184ULL;
+ else
+#endif
u.ll = (u.ll + 1) & ~1ULL;
return u.d;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3022.1.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140310/1fd66895/attachment.bin>
More information about the llvm-commits
mailing list