[PATCH] D86547: [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z
Ayke via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 17 05:07:32 PST 2022
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__
if (a & REP_C(0xffffffff00000000))
- return __builtin_clz(a >> 32);
+ return clzsi(a >> 32);
+ return 32 + clzsi(a & REP_C(0xffffffff));
Perhaps more reliable would be the following:
#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#elif ULLONG_MAX == 0xFFFFFFFFFFFFFFFF
#error Unsupported platform
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).
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits