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

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 10:58:45 PDT 2023


================
@@ -20,14 +20,21 @@
 typedef float src_t;
 typedef uint32_t src_rep_t;
 #define SRC_REP_C UINT32_C
-static const int srcSigBits = 23;
+static const int srcBits = sizeof(src_t) * CHAR_BIT;
+static const int srcSigFracBits = 23;
----------------
arichardson wrote:

These constants are already defined inside fp_lib.h. Wouldn't it make more sense to refactor fp_lib.h so that instead of 
```
#if defined SINGLE_PRECISION
...
#define significandBits 23
#elif defined DOUBLE_PRECISION
...
#define significandBits 52
```
we have something like
```
#define sf_significand_bits 23
#define df_significand_bits 52
#define xf_significand_bits 63
#if defined SINGLE_PRECISION
#define significandBits sf_significand_bits
#elif defined DOUBLE_PRECISION
#define significandBits df_significand_bits
```
and then reuse those constants here?

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


More information about the llvm-commits mailing list