[PATCH] [COMPILER-RT] Implement __divtf3

Joerg Sonnenberger joerg at NetBSD.org
Fri May 30 05:03:34 PDT 2014


Please drop me a patch for CREDITS.TXT BTW.

================
Comment at: lib/builtins/divtf3.c:82
@@ +81,3 @@
+    const uint64_t q63b = bSignificand >> 49;
+    uint64_t recip64 = UINT64_C(0x7504f333F9DE6484) - q63b;
+    // 0x7504f333F9DE6484 / 2^64 + 1 = 3/4 + 1/sqrt(2)
----------------
GuanHong Liu wrote:
> Joerg Sonnenberger wrote:
> > Do we really need the full 64bit constant here?
> Yes, we need the upper 64-bit of recip64 * q63b
> If we use 32-bit constant only, the carry may be dropped, and the result will be incorrect
Sure, I mean: isn't it enough to use the highest 8bit of the constant? recip64 is only accurate to 3.5bit anyway (see comment), so anything more shouldn't matter?

http://reviews.llvm.org/D2800






More information about the llvm-commits mailing list