aykevl accepted this revision.
aykevl added a comment.
This revision is now accepted and ready to land.

Looks good to me.



================
Comment at: compiler-rt/lib/builtins/fp_extend.h:32-39
 #if defined __LP64__
   return __builtin_clzl(a);
 #else
   if (a & REP_C(0xffffffff00000000))
-    return __builtin_clz(a >> 32);
+    return clzsi(a >> 32);
   else
+    return 32 + clzsi(a & REP_C(0xffffffff));
----------------
Perhaps more reliable would be the following:

```
#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
  return __builtin_clzl(a);
#elif ULLONG_MAX == 0xFFFFFFFFFFFFFFFF
  return __builtin_clzll(a);
#else
  #error Unsupported platform
#endif
```

This is what I've also used in int_types.h to detect clzsi etc. It probably 
would need to be tested on some more architectures though (32 and 64 bit).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86547

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to