This is an archive of the discontinued LLVM Phabricator instance.

Establish the <bit> header
ClosedPublic

Authored by mclow.lists on Aug 15 2018, 3:24 PM.

Details

Reviewers
EricWF
ldionne
Summary

In C++20, we're going to have a header named <bit> for bit manipulations.
See https://wg21.link/P0553 and https://wg21.link/P0556 for more info.

This doesn't do any of that.
It just creates the header, and pulls some existing internal routines into it.
Later diffs will rename the existing routines, and implement the features from P0553 and P0556.

This is just moving stuff around. NFC intended.

Diff Detail

Event Timeline

mclow.lists created this revision.Aug 15 2018, 3:24 PM
ldionne accepted this revision.Aug 15 2018, 7:16 PM

LGTM

This revision is now accepted and ready to land.Aug 15 2018, 7:16 PM
lebedev.ri added inline comments.
include/bit
99

Pretty sure this is the other way around here.

// Search from MSB to LSB for first set bit.
craig.topper added inline comments.
include/bit
145

How does this work on pre-Haswell X86 CPUs? Doesn't MSVC just blindly emit the popcnt instruction when it sees this?

craig.topper added inline comments.Aug 15 2018, 11:40 PM
include/bit
163

I don't think __popcnt64 exists in MSVC when targeting 32-bit mode.

mclow.lists closed this revision.Aug 16 2018, 2:36 PM

landed as revision 339943

vitalybuka reopened this revision.Aug 16 2018, 4:58 PM
vitalybuka added a subscriber: vitalybuka.

Reverted r339971 as it breaks sanitizer bots

This revision is now accepted and ready to land.Aug 16 2018, 4:58 PM
tra added a subscriber: tra.Aug 16 2018, 5:21 PM

It appears that libcxx/include/CMakeLists.txt needs to be updated to include bit file into the file set.

mclow.lists closed this revision.Sep 19 2018, 10:09 AM

Landed as r339943