[PATCH] D14187: [compiler-rt][aarch64] New tests for 128-bit floating-point builtins, fixes of tests and __fixuint

Sergey Dmitrouk via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 09:34:52 PST 2015


sdmitrouk marked an inline comment as done.

================
Comment at: test/builtins/Unit/fixunstfti_test.c:89
@@ +88,3 @@
+    if (test__fixunstfti(0x1.FFFFFEp+126, make_ti(0x7fffff8000000000LL, 0x0)))
+        return 1;
+    if (test__fixunstfti(0x1.FFFFFEp+127, make_ti(0xffffff0000000000LL, 0x0)))
----------------
zatrazz wrote:
> sdmitrouk wrote:
> > Actually it should be `(0xffffffffffffffffLL, 0xffffffffffffffffLL)` because input is larger than 2^128. `__fixuint` seems to have off by one error when checking for too large exponent (used `>` instead of `>=`), updated revision to address this. Thanks!
> Unless I am missing something here, the code:
> 
> ```
> void
> func (void)
> {
>   mpfr_t number;
>   mpfr_init2 (number, PRECISION);
>   mpfr_set_ld (number, 0x1.FFFFFEp+127, MPFR_RNDN);
>   mpfr_printf ("%Rf\n", number);
> 
>   mpz_t integer;
>   mpz_init2 (integer, PRECISION);
>   mpfr_get_z (integer, number, MPFR_RNDN);
> 
>   mpfr_printf ("float:   %Rf\n", number);
>   mpfr_printf ("integer: %033ZX\n", integer);
> }
> ```
> 
> Prints on a aarch64 machine:
> 
> float:   340282346638528859811704183484516925440.000000
> integer: 0FFFFFF00000000000000000000000000
> 
> And the maximum value of an uint128_t is:
> 
> 340282366920938463463374607431768211455L
> 
> So the value is still lower than 128 *unsigned* bits.
> 
I'm not sure I follow, your example confirms the line below:
```
 if (test__fixunstfti(0x1.FFFFFEp+127, make_ti(0xffffff0000000000LL, 0x0)))
```
but your first comment was about this line:
```
if (test__fixunstfti(0x1.FFFFFEp+128, make_ti(0xfffffe0000000000LL, 0x0)))
```
which is `1FFFFFE00000000000000000000000000` (33 nibbles) in integer form. The most significant bit used to be truncated (same happened for unsigned si and di), which is fixed by second revision.


Repository:
  rL LLVM

http://reviews.llvm.org/D14187





More information about the llvm-commits mailing list