[compiler-rt] [compiler-rt] Implement __extendxftf2 and __trunctfxf2 for x86_64 (PR #66918)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 13:48:10 PDT 2023


================
@@ -39,6 +43,16 @@ static __inline int src_rep_t_clz(src_rep_t a) {
 #endif
 }
 
+#elif defined SRC_80
+typedef long double src_t;
+typedef __uint128_t src_rep_t;
+#define SRC_REP_C (__uint128_t)
+// sign bit, exponent and significand occupy the lower 80 bits.
+static const int srcBits = 80;
+// significand stores the integer bit.
+static const int srcSigBits = 64;
+static const int srcSigFracBits = 63;
----------------
efriedma-quic wrote:

To be specific, I think the approach here is making the patch much harder to understand than is really necessary. 
 I think defining two different constants representing the size of the significand, and integrating the logic to handle these directly into the routines, is confusing.

I'd like to see a helper function "extract significant fraction bits" or something like that.  And a function to construct a float given the exponent, and significant fraction bits.  Then the rest of the code can use those helpers, instead of making it directly aware of the extra bit in fp80 representations.

https://github.com/llvm/llvm-project/pull/66918


More information about the llvm-commits mailing list