Fix KSHIFTW behavior for a shift count of 15 #844
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 · 263 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 #844"
general
weight: 0.35
stlintel
Problem
The 16-bit
KSHIFTLWandKSHIFTRWforms treat an immediate count of15 as out of range.
The architectural operation shifts the 16-bit source for counts through
15 and clears the destination only when the count is greater than 15.
The Bochs handlers currently perform the shift only when
count < 15,so the maximum valid count incorrectly produces zero.
For example:
Similarly:
Fix
Use
count < 16for the word-formKSHIFTLWandKSHIFTRWhandlers.
This includes the valid count of 15 while retaining a zero result for
counts greater than 15.
Architectural reference
The Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volume 2B, sections “KSHIFTLW/KSHIFTLB/KSHIFTLQ/KSHIFTLD—Shift Left
Mask Registers” and
“KSHIFTRW/KSHIFTRB/KSHIFTRQ/KSHIFTLD—Shift Right Mask Registers,”
specifies that the 16-bit forms perform the shift when the count is less
than or equal to 15 and clear the destination otherwise.
Validation
Bochs was rebuilt successfully:
A temporary protected-mode boot probe selected
corei7_skylake_x,enabled opmask and AVX-512 state in XCR0, and tested counts 14, 15, and
16 for both instructions.
Before the fix:
After the fix:
The neighboring counts remain unchanged: count 14 shifts normally and
count 16 produces zero.