Skip to content

[builtins] Use __builtin_clzll for 64-bit types #99874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions compiler-rt/lib/builtins/fp_extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,7 @@ static const int srcSigFracBits = 52;
// srcBits - srcSigFracBits - 1
static const int srcExpBits = 11;

static inline int src_rep_t_clz_impl(src_rep_t a) {
#if defined __LP64__
return __builtin_clzl(a);
#else
if (a & REP_C(0xffffffff00000000))
return clzsi(a >> 32);
else
return 32 + clzsi(a & REP_C(0xffffffff));
#endif
}
static inline int src_rep_t_clz_impl(src_rep_t a) { return __builtin_clzll(a); }
#define src_rep_t_clz src_rep_t_clz_impl

#elif defined SRC_80
Expand Down
11 changes: 1 addition & 10 deletions compiler-rt/lib/builtins/fp_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,7 @@ typedef double fp_t;
#define REP_C UINT64_C
#define significandBits 52

static __inline int rep_clz(rep_t a) {
#if defined __LP64__
return __builtin_clzl(a);
#else
if (a & REP_C(0xffffffff00000000))
return clzsi(a >> 32);
else
return 32 + clzsi(a & REP_C(0xffffffff));
#endif
}
static inline int rep_clz(rep_t a) { return __builtin_clzll(a); }

#define loWord(a) (a & 0xffffffffU)
#define hiWord(a) (a >> 32)
Expand Down
Loading