[PATCH] D84932: [builtins] Add more test cases for __div[sdt]f3 LibCalls

Anatoly Trosinenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 18 05:31:21 PDT 2020


atrosinenko added a comment.

@sepavloff

Thank you for the test cases. Looks like it is worth completely rewriting the three tests as table-driven tests, so for example adding four cases for `[+-]Inf / [+-]0.0` would be almost as easy as testing only one of them (something similar is already implemented for `udivmod?i4_test.c`). The differences between adjacent test cases would be more visually obvious, as well.



================
Comment at: compiler-rt/test/builtins/Unit/divdf3_test.c:80
+    // divisor is 1.0 as UQ1.31
+    if (test__divdf3(0x1.0p+0, 0x1.00000001p+0, UINT64_C(0x3fefffffffe00000)))
       return 1;
----------------
sepavloff wrote:
> Is 0x1.00000001p+0 equal to 1.0 in UQ1.31?
Divisor is `1.(31 zeroes)1` after restoring the implicit bit, so it is **truncated** to 1.0 as UQ1.31. Instead of counting bits carefully, it would probably be better to add several tests with the `1` bit shifted 1-2 places left/right as well as if the divisor is round up instead of truncating - //just in case//. :) So, with table-driven test it would probably be simpler to not make extra assumptions on the implementation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84932/new/

https://reviews.llvm.org/D84932



More information about the cfe-commits mailing list