This is an archive of the discontinued LLVM Phabricator instance.

Implement __clzdi2 and __clzsi2 for early ARM architectures that lack the clz instruction
ClosedPublic

Authored by joerg on Jan 27 2014, 11:46 AM.

Details

Summary

Implement clzdi2 and clzsi2 for early ARM architectures that lack the clz instruction. For __clzdi2 special care is needed for dealing with Little Endian vs Big Endian.

Diff Detail

Event Timeline

joerg updated this revision to Unknown Object (????).Jan 27 2014, 12:05 PM

Better thumb encoding.

compnerd added inline comments.Jan 28 2014, 7:01 PM
lib/arm/clzdi2.S
36 ↗(On Diff #6688)

Should this bx also be handled similarly for uniformity? clz being present is indicative of ARMv5T+ so bx is obviously available, but, the uniformity might be nice (since the cost is 0).

38 ↗(On Diff #6688)

I dont see how this assumption holds.

64 ↗(On Diff #6688)

I believe that the IMM prefix unnecessary in unified syntax.

66 ↗(On Diff #6688)

Can you change the name of block to upper case to indicate that it is a macro?

joerg added inline comments.Jan 29 2014, 2:28 AM
lib/arm/clzdi2.S
38 ↗(On Diff #6688)

It is part of the interface contract:

  • Built-in Function: int __builtin_clz (unsigned int x) Returns the number of leading 0-bits in X, starting at the most significant bit position. If X is 0, the result is undefined.
joerg updated this revision to Unknown Object (????).Jan 29 2014, 4:17 AM

Clean up.

joerg closed this revision.Jan 29 2014, 5:52 AM

Closed by commit rL200394 (authored by @joerg).