This is an archive of the discontinued LLVM Phabricator instance.

[APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Implement them without memory allocation for multiword
ClosedPublic

Authored by craig.topper on Mar 31 2017, 8:50 PM.

Details

Summary

This moves the isMask and isShiftedMask functions to be class methods. They now use the MathExtras.h function for single word size and leading/trailing zeros/ones or countPopulation for the multiword size. The previous implementation made multiple temorary memory allocations to do the bitwise arithmetic operations to match the MathExtras.h implementation.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Mar 31 2017, 8:50 PM
grandinj added inline comments.
include/llvm/ADT/APInt.h
429 ↗(On Diff #93740)

comment looks wrong ? doesn't mention the numBits argument?

Adjust comment to include numBits parameter

craig.topper marked an inline comment as done.Apr 1 2017, 9:56 AM
hans accepted this revision.Apr 3 2017, 1:08 AM

lgtm with a nit about the comment

include/llvm/ADT/APInt.h
428 ↗(On Diff #93752)

drop "argument"

This revision is now accepted and ready to land.Apr 3 2017, 1:08 AM
This revision was automatically updated to reflect the committed changes.