[PATCH] D54313: [compiler-rt][builtins][PowerPC] Add floattitf builtin compiler-rt method support for PowerPC

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 09:12:02 PST 2018


nemanjai added a comment.

I'll let @renenkel approve or request changes to this as he understands the math much better than I do, but I do want an investigation into how the `INFINITY/QNAN` tests work along with a comment explaining that. Particularly since I would have expected that every `__int128_t` value is a number (i.e. not a NAN) and none of them produce an infinity.



================
Comment at: compiler-rt/lib/builtins/ppc/floattitf.c:21
+
+long double __floattitf (__int128_t arg) {
+  /* 128 bit integers can be thought of as having a high and a low
----------------
Just out of curiosity, where does `__int128_t` come from if we don't include a header that defines it? Does this compile with both gcc and clang?


================
Comment at: compiler-rt/test/builtins/Unit/ppc/floattitf_test.h:16
+struct testCase tests[] = {
+{ INFINITY, 0x1p+127, -0x1p+0 },
+{ -INFINITY, -0x1p+127, 0x0p+0 },
----------------
I find it really strange that this works. What is `__builtin_inf()` converted to `__int128_t`? Similarly with `__builtin_nan()`.


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

https://reviews.llvm.org/D54313





More information about the llvm-commits mailing list