[PATCH] D74826: [compiler-rt] [builtins] Fix logb / logbl tests
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 02:17:30 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG689f1e85ba68: [compiler-rt] [builtins] Fix logb / logbl tests (authored by luismarques).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74826/new/
https://reviews.llvm.org/D74826
Files:
compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c
compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c
Index: compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c
+++ compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c
@@ -27,18 +27,20 @@
int test__compiler_rt_logbl(fp_t x) {
fp_t crt_value = __compiler_rt_logbl(x);
fp_t libm_value = logbl(x);
- // Compare actual rep, e.g. to avoid NaN != the same NaN
- if (toRep(crt_value) != toRep(libm_value)) {
+ // Compare the values, considering all NaNs equivalent, as the spec doesn't
+ // specify the NaN signedness/payload.
+ if (crt_value != libm_value &&
+ !(crt_isnan(crt_value) && crt_isnan(libm_value))) {
// Split expected values into two for printf
twords x_t, crt_value_t, libm_value_t;
x_t.all = toRep(x);
crt_value_t.all = toRep(crt_value);
libm_value_t.all = toRep(libm_value);
printf(
- "error: in __compiler_rt_logb(%a [%llX %llX]) = %a [%llX %llX] != %a "
+ "error: in __compiler_rt_logbl([%llX %llX]) = [%llX %llX] != "
"[%llX %llX]\n",
- x, x_t.s.high, x_t.s.low, crt_value, crt_value_t.s.high,
- crt_value_t.s.low, libm_value, libm_value_t.s.high, libm_value_t.s.low);
+ x_t.s.high, x_t.s.low, crt_value_t.s.high, crt_value_t.s.low,
+ libm_value_t.s.high, libm_value_t.s.low);
return 1;
}
return 0;
Index: compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c
+++ compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c
@@ -20,8 +20,10 @@
int test__compiler_rt_logb(fp_t x) {
fp_t crt_value = __compiler_rt_logb(x);
fp_t libm_value = logb(x);
- // Compare actual rep, e.g. to avoid NaN != the same NaN
- if (toRep(crt_value) != toRep(libm_value)) {
+ // Compare the values, considering all NaNs equivalent, as the spec doesn't
+ // specify the NaN signedness/payload.
+ if (crt_value != libm_value &&
+ !(crt_isnan(crt_value) && crt_isnan(libm_value))) {
printf("error: in __compiler_rt_logb(%a [%lX]) = %a [%lX] != %a [%lX]\n",
x, toRep(x), crt_value, toRep(crt_value), libm_value,
toRep(libm_value));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74826.245607.patch
Type: text/x-patch
Size: 2284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200220/69c60d45/attachment.bin>
More information about the llvm-commits
mailing list