This is an archive of the discontinued LLVM Phabricator instance.

[TargetLibraryInfo] Add support for fls, flsl, flsll
ClosedPublic

Authored by davide on Nov 1 2015, 9:32 AM.

Details

Summary

These three function are similar to ffs but find the last bit set. They're available (at least) on FreeBSD. I'm not sure they're availalble elsewhere, I don't have a machine to test. A quick search shows Linux hasn't them.
I would like top perform fairly basic transformations on these, e.g. constant folding, so this patch can be seen as a preliminary step for those.

Diff Detail

Repository
rL LLVM

Event Timeline

davide updated this revision to Diff 38856.Nov 1 2015, 9:32 AM
davide retitled this revision from to [TargetLibraryInfo] Add support for fls, flsl, flsll.
davide updated this object.
davide added a reviewer: echristo.
davide added a subscriber: llvm-commits.
echristo accepted this revision.Nov 9 2015, 2:37 PM
echristo edited edge metadata.

OK. Could probably use a testcase, but this is probably where you're going with the next one.

-eric

This revision is now accepted and ready to land.Nov 9 2015, 2:37 PM
davide added a comment.Nov 9 2015, 2:47 PM

Yes, my next patch will add a testcase. I have still some pending reviews in SimplifyLibCalls but once I get approval for them I'll a new patch to optimize fls & friends.
Thanks for reviewing!

This revision was automatically updated to reflect the committed changes.