Skip to content

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

Description

@fanyang-mono

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.

Activity

  1. added this to the 8.0.0 milestone on Sep 22, 2022
  2. jandupej commented on Feb 16, 2023

    @jandupej
    Contributor

    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.

  3. SamMonoRT commented on Jul 11, 2023

    @SamMonoRT
    Member

    cc @matouskozak for further work.

  4. modified the milestones: 8.0.0, 9.0.0 on Jul 18, 2023
  5. matouskozak commented on Aug 11, 2023

    @matouskozak
    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.

  6. ghost locked as resolved and limited conversation to collaborators on Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions