JIT: vpshufbitqmb is missing INS_FLAGS_IsDstDstSrcAVXInstruction
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
Research direction
Start at src/coreclr/jit/instrsxarch.h around the vpshufbitqmb row and compare its flags with the listed three-operand EVEX siblings. Verify the flag is present, then run the JIT/HardwareIntrinsics/X86_Avx512 suite on a Checked JIT; done means all 1775 tests pass.
Written by the indexing model from the issue text.
Description
Description
VPSHUFBITQMB has the form k1 {k2}, xmm2, xmm3/m128 — a kmask destination plus two source operands. Its row in instrsxarch.h is missing INS_FLAGS_IsDstDstSrcAVXInstruction, which every other three-operand mask-producing EVEX instruction in the table carries.
https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/instrsxarch.h#L991
INST3(vpshufbitqmb, "vpshufbitqmb", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x8F), 6C, 1C, INS_TT_FULL_MEM,
Input_8Bit | KMask_Base16 | REX_W0 | Encoding_EVEX)
Compare its siblings, all of which have the flag:
| instruction | form | IsDstDstSrcAVX |
|---|---|---|
vptestmb/d/q/w |
k1 {k2}, xmm2, xmm3/m |
✔ |
vptestnmb/d/q/w |
k1 {k2}, xmm2, xmm3/m |
✔ |
vpcmpb, vpcmpub, vpcmpw, vpcmpuw |
k1 {k2}, xmm2, xmm3/m, imm8 |
✔ |
vpblendmb |
xmm1 {k1}, xmm2, xmm3/m |
✔ |
vpshufbitqmb |
k1 {k2}, xmm2, xmm3/m |
✘ |
Impact
IsThreeOperandAVXInstruction is a pure lookup of INS_FLAGS_Is3OperandInstructionMask, so without the flag it returns false for this instruction. emitIns_R_R_S, emitIns_R_R_R_I and emitIns_R_R_S_I all assert on that predicate:
Assertion failed 'IsThreeOperandAVXInstruction(ins) || IsApxExtendedEvexInstruction(ins)'
File: src\coreclr\jit\emitxarch.cpp:8572
No shipping code is affected today. No HARDWARE_INTRINSIC entry maps to INS_vpshufbitqmb, so the JIT can never currently be asked to emit it — the row has been dormant since it was added. This is a latent defect that will bite the first consumer, not a user-visible bug.
How it was found
While implementing the BITALG intrinsics for #96162. Avx512BitAlg.ShuffleBits is the first consumer of this row, and hit the assert immediately on a Checked JIT.
Note on vpcmpd / vpcmpq / vpcmpud / vpcmpuq
These four also lack the flag while their b/w/ub/uw siblings have it, and unlike vpshufbitqmb they are reachable. I checked this empirically — Vector512.LessThanOrEqual<int>, GreaterThan<uint>, LessThan<ulong> etc. with both register and memory operands, on a Checked JIT — and they do not reach any of the asserting emit paths, so this appears to be a harmless inconsistency rather than a second bug. Flagging it in case it should be made consistent anyway.
Fix
One line — add INS_FLAGS_IsDstDstSrcAVXInstruction to the vpshufbitqmb row.
Verified on Zen 5 (AMD Strix Halo, which has BITALG): with the flag added, the full JIT/HardwareIntrinsics/X86_Avx512 suite passes 1775/1775 on a Checked JIT, including new ShuffleBits coverage.
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 589
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/runtime
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area-System.Reflection blocking-clean-ci-optional Known Build Error os-mac-os-x untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
agentic-workflows untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
area-VM-meta-mono untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
area-VM-coreclr untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·