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

[Mono] Intrinsify Vector128:ExtractMostSignificantBits on ARM64 and AMD64 #76025

Closed
4 tasks done
fanyang-mono opened this issue Sep 22, 2022 · 3 comments
Closed
4 tasks done
Assignees
Milestone

Comments

@fanyang-mono
Copy link
Member

fanyang-mono commented Sep 22, 2022

WASM has added intrinsics support for Vector128:ExtractMostSignificantBits, where they saw big performance gain on a few Span and Json API's.
Implement intrinsics support for ExtractMostSignificantBits on:

  • ARM64 mini JIT
  • ARM64 LLVM
  • AMD64 mini JIT
  • AMD64 LLVM

NOTE: Additionally, investigate if Vector64 variant could be easily handled by the change.

@jandupej
Copy link
Member

Did a little checking, on x86 we can use _mm_movemask_epi8/ps/pd, these are SSE and SSE2, so this is perfectly fine with x86-64. There is no such operation for int16 - if we want it, we can _mm_shuffle_epi8 so that odd bytes are packed in the lower half of the reg, then extract the byte mask and keep only the lower 8 bits of that. That requires SSSE3 and one load for the shuffle indices. It seems CoreCLR does it this way also.

For arm64, there is no instruction to extract mask. CoreCLR does this by anding away all but the MSB from each element, shift the MSBs and addv them to form the mask. This seems like the best option right now.

@SamMonoRT
Copy link
Member

cc @matouskozak for further work.

@matouskozak
Copy link
Member

Closing this issue as Vector128::ExtractMostSignificantBits intrinsics support is complete both for miniJIT and AOT (LLVM) on ARM64 and AMD64. Remaining work for Vector64::ExtractMostSignificantBits is tracked in #90402.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants