Skip to content
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

PMOVMSKB operation equivalent #26

Open
deepinthebuild opened this issue Feb 21, 2018 · 2 comments
Open

PMOVMSKB operation equivalent #26

deepinthebuild opened this issue Feb 21, 2018 · 2 comments

Comments

@deepinthebuild
Copy link

It would be useful to me if there were an operation like fn bytemask<T: Packed>(v: T) -> usize that set the bits of the usize to 1 where the packed vector's bytes are all 1, corresponding to the asm PMOVMSKB or VPMOVMSKB. I don't know how possible this would be for faster, but it would be nice.

@AdamNiederer
Copy link
Owner

AdamNiederer commented Feb 21, 2018

That would definitely be feasible, but I'm wondering if there's a way to make this portable for all vector lengths, though. Perhaps a bit_vec::BitVec would be a more suitable return type?

@deepinthebuild
Copy link
Author

deepinthebuild commented Feb 22, 2018

a u64 is large enough for all existing vector types, including AVX-512. 512 bits is only u8x64, after all.

To be clear about what I'm after, I want an operation that takes a vector like:
u8x8(255, 255, 0, 255, 255, 0, 0, 0)
and returns a u64:
0b00011011
where the nth least significant bit of the output is set to 1 if the nth byte of the input is 255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants