[PATCH] D67999: Fix `compiler_rt_logbf_test.c` test failure for Builtins-i386-darwin test suite.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 10:53:48 PDT 2019
delcypher updated this revision to Diff 222652.
delcypher added a comment.
Compare using comparison operator for `fp_t` and use crt_isnan() to
check for NaNs.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67999/new/
https://reviews.llvm.org/D67999
Files:
test/builtins/Unit/compiler_rt_logbf_test.c
Index: test/builtins/Unit/compiler_rt_logbf_test.c
===================================================================
--- test/builtins/Unit/compiler_rt_logbf_test.c
+++ test/builtins/Unit/compiler_rt_logbf_test.c
@@ -13,15 +13,19 @@
//===----------------------------------------------------------------------===//
#define SINGLE_PRECISION
+#include "fp_lib.h"
+#include "int_math.h"
#include <math.h>
#include <stdio.h>
-#include "fp_lib.h"
int test__compiler_rt_logbf(fp_t x) {
fp_t crt_value = __compiler_rt_logbf(x);
fp_t libm_value = logbf(x);
- // Compare actual rep, e.g. to avoid NaN != the same NaN
- if (toRep(crt_value) != toRep(libm_value)) {
+ // Compare fp_t values but ignore `!=` operator returning for NaNs.
+ // We don't to `toRepr(crt_value) != toRepr(libm_value)` because
+ // that does treats different representations of NaN as an error.
+ if (crt_value != libm_value &&
+ !(crt_isnan(crt_value) && crt_isnan(libm_value))) {
printf("error: in __compiler_rt_logb(%a [%X]) = %a [%X] != %a [%X]\n", x,
toRep(x), crt_value, toRep(crt_value), libm_value,
toRep(libm_value));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67999.222652.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/6906cccb/attachment.bin>
More information about the llvm-commits
mailing list