Uh oh!
There was an error while loading. Please reload this page.
[mono][jit] Adding support for Vector128::ExtractMostSignificantBits intrinsic on ARM64 with miniJIT - #84345
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…intrinsic on ARM64 miniJIT
eca2d83 to
01e7f7aCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fanyang-mono
left a comment
There was a problem hiding this comment.
Overall, I would suggest removing most of the comments, as the code should be clear enough.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ivanpovazan
commented
Apr 14, 2023
Failures are unrelated and known:
tracked here: #84722
tracked here: #84434 |
This PR adds support for
ExtractMostSignificantBitsintrinsic on ARM64 miniJIT.Implementation
On ARM64, there is no single instruction to perform the operation.
To emulate the behavior we implement a similar approach to coreCLR by performing the following set of operations:
byte/sbyte):byte/sbyteelement types:New opcodes
Two new opcodes added:
OP_ARM64_USHL- Shifts a vector left or right depending on the sign of the shift constant - USHL vectorOP_ARM64_EXT_IMM- Extracts a vector from pair of vectors based on constant selector value - the lowest numbered byte element to be extracted in the range. EXT vectorOP_ARM64_EXTwhich uses 3 source registers expecting the selector value to be in a register.Further optimizations
The current implementation can be further optimized. The following approaches could be examined:
ExtractMostSignificantBitswe generate inlined constants into the instruction stream.As the mask and shift constant are the same for a specific element type and can be reused, we could instead allocate them in a shared location to be reused between
ExtractMostSignificantBitsoperations.Additionally, MSB masking could reuse the approach outlined here: [mono][jit] Adding support for Vector128::ExtractMostSignificantBits intrinsic on ARM64 with miniJIT #84345 (comment)
byteandsbyteelement types we use 9 instructions to treat upper and lower half of the vector properly. This can be improved once we supportaddv.8bas we would be able to just sum the lower 64bits of the source vector and not need to clear-out (ext with zero) the upper half of it before summing the full length. This would save us 1 instruction. Here is the summary of how currently the pseudo and generated code for the sequence looks like:Example:
Contributes to #76025
/cc: @jandupej@fanyang-mono