Fix POPCNT instruction feature gate #842
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 264 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #842"
general
weight: 0.35
stlintel
Problem
POPCNTavailability is enumerated independently throughCPUID.01H:ECX.POPCNT[23].
The three POPCNT opcode declarations currently use
BX_ISA_SSE4_2astheir feature guard. As a result, decoder initialization disables POPCNT
when SSE4.2 is absent, even if the selected CPU model advertises POPCNT.
The built-in AMD Phenom X3 8650 Toliman model demonstrates this feature
combination: it enables
BX_ISA_POPCNT, does not enableBX_ISA_SSE4_2, and reports CPUID.01H:ECX.POPCNT=1. Before this fix,executing POPCNT with that model dispatches
BxErrorand raises #UD.For example:
The inverse configuration can also incorrectly make POPCNT
decode-reachable when SSE4.2 is enabled but POPCNT is not advertised.
Fix
Use
BX_ISA_POPCNTas the feature guard for the 16-, 32-, and 64-bitPOPCNT opcode declarations.
This makes instruction decoding agree with the independently enumerated
POPCNT CPUID feature.
Architectural reference
The Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volume 2B, section “POPCNT—Return the Count of Number of Bits Set to 1,”
specifies that software must check CPUID.01H:ECX.POPCNT[23]. If that bit
is clear, POPCNT raises #UD.
Validation
Bochs was rebuilt successfully after rebuilding the affected decoder
object:
A temporary real-mode boot probe selected
phenom_8650_toliman,confirmed CPUID.01H:ECX.POPCNT=1 and SSE4.2=0, and executed 16-bit
POPCNT on
0xffff: