[PATCH] D78662: [builtins] Support architectures with 16-bit int

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 14:42:02 PDT 2020


efriedma added a comment.

Is making all shift amounts "int" consistent with what LLVM does?

Maybe it would make sense to stick macros in int_types.h to call the right `__builtin_clz`/`__builtin_ctz` variant for si_int?



================
Comment at: compiler-rt/lib/builtins/floatdisf.c:29
   int sd = N - __builtin_clzll(a); // number of significant digits
-  int e = sd - 1;                  // exponent
+  int32_t e = sd - 1;              // exponent
   if (sd > FLT_MANT_DIG) {
----------------
si_int?


================
Comment at: compiler-rt/lib/builtins/floatundisf.c:27
   int sd = N - __builtin_clzll(a); // number of significant digits
-  int e = sd - 1;                  // 8 exponent
+  int32_t e = sd - 1;              // 8 exponent
   if (sd > FLT_MANT_DIG) {
----------------
si_int?


================
Comment at: compiler-rt/lib/builtins/fp_extend.h:24
 static const int srcSigBits = 23;
+#if UINT_MAX == 65535
+// 16-bit int
----------------
Maybe `#if UINT_MAX < 0xFFFFFFFF`, since that's what we actually care about.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78662





More information about the llvm-commits mailing list