[PATCH] D54911: [compiler-rt][builtins][PowerPC] Add ___fixunstfti builtin compiler-rt method support for PowerPC

Masoud Ataei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 14 12:58:50 PST 2018


masoud.ataei added inline comments.


================
Comment at: compiler-rt/lib/builtins/ppc/fixunstfti.c:23
+            (__uint128_t) 0x0000000000000000ll;
+  }
+
----------------
Here we are returning NaN bit pattern for NaN input. It was originally my suggestion but I still don't know if it is good idea. Maybe it is better to remove this if statement and let the rest of algorithm create an output. In fact, any output is junk. (Since there is no NaN in int.)  


================
Comment at: compiler-rt/lib/builtins/ppc/fixunstfti.c:60
+  } else {
+    /* Detect edge cases. */
+    if (hi_bits.d > 0) {
----------------
nemanjai wrote:
> Please state what the edge cases are for both of the conditions. It is not at all clear to the reader why we will saturate the value when the exponent in the high double is above 128 and the sign bit isn't set. Similarly for the opposite case where we seem to produce `1`.
when the exponent is >=128 it is overflow. Since this is the conversion to unsigned int128, it will return the max integer when input is positive and it return 1 (as gcc does it).


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

https://reviews.llvm.org/D54911





More information about the llvm-commits mailing list