[APX] refactor APX-EVEX emitter#129915
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR refactors xarch emitter/APX encoding classification by introducing an explicit Encoding_APX_EVEX flag and consolidating EVEX gating so APX “extended EVEX” cases flow through the existing TakesEvexPrefix / IsEvexEncodableInstruction logic rather than a separate TakesApxExtendedEvexPrefix path.
Changes:
- Adds
Encoding_APX_EVEX(and anINS_FLAGS_APX_EVEX_PROMOTABLEmask) to mark APX EVEX-only / EVEX-promotable instructions in the instruction metadata. - Removes
TakesApxExtendedEvexPrefixand updates prefix selection/sizing logic to rely onTakesEvexPrefix, with SIMD-only queries split intoIsSimdVexOrEvexEncodableInstructionandIsSimdEvexEncodableInstruction. - Updates EVEX encodability and EVEX prefix emission to correctly handle APX-promoted legacy/VEX/APX-only instructions, including MAP4 handling for legacy/APX-only EVEX promotion.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/jit/instrsxarch.h | Marks APX-only/APX EVEX-form instructions with Encoding_APX_EVEX to drive unified EVEX gating. |
| src/coreclr/jit/instr.h | Introduces Encoding_APX_EVEX and INS_FLAGS_APX_EVEX_PROMOTABLE to classify APX EVEX promotion capability. |
| src/coreclr/jit/emitxarch.h | Removes TakesApxExtendedEvexPrefix declaration and adds SIMD-scoped EVEX/VEX query helpers. |
| src/coreclr/jit/emitxarch.cpp | Refactors EVEX encodability/prefix selection and updates sizing/output paths to account for APX-promoted EVEX behavior. |
|
Build analysis is green, and copliot left no comments. Hi @tannergooding, can you please take a look at this PR? Thanks! :) |
|
LGTM.
|
Contribute to #117326
Overview of this PR:
As tanner suggested, the first goal for this PR is to get rid of
TakesApxExtendedEvexPrefixand letTakesEvexPrefixmanage all the cases when EVEX is needed, both original SIMD EVEX, and extended EVEX introduced by APX.The expected outcome is to reach better readability, and better robustness. meanwhile have little to no impact on throughput.
After the PR:
TakesEvexPrefixwill gate all the EVEX use cases, andIsEvexEcodableInstructionwill confirm the EVEX encodability for both SIMD and APX instruction. This makes fewer places that need to be updated if more APX instructions or feature comes.