← Back to Pull requests

Fix VPCMP byte and word instruction feature gating #848

Closed
unknown closed this pull request without merging on Aug 28, 2026 19:19 UTC
View on GitHub
unknown unknown commented on Aug 28, 2026 19:14 UTC
Author

Problem

The EVEX forms of VPCMPB, VPCMPUB, VPCMPW, and VPCMPUW
require AVX512BW for their 512-bit forms. Their 128- and 256-bit forms
additionally require AVX512VL. The instructions are also available
through AVX10.1.

All four Bochs opcode declarations currently use BX_ISA_AVX512, the
base AVX512F feature, as their guard. Decoder initialization therefore
retains their execution handlers on a processor configuration that
provides AVX512F but not AVX512BW.

For example:

CPU model:        corei7_skylake_x
excluded feature: avx512bw
CPUID.7.0.EBX:    0x919f27eb
AVX512F:          1
AVX512BW:         0
AVX512VL:         1
XCR0:             0xe7
mode:             long mode, CPL3

62 f3 7d 48 3f c9 00    vpcmpb  k1, zmm0, zmm1, 0
62 f3 7d 48 3e c9 00    vpcmpub k1, zmm0, zmm1, 0
62 f3 fd 48 3f c9 00    vpcmpw  k1, zmm0, zmm1, 0
62 f3 fd 48 3e c9 00    vpcmpuw k1, zmm0, zmm1, 0

expected: #UD for all four instructions
before:   all four instructions execute

Fix

Use BX_ISA_AVX512_BW as the feature guard for the VPCMPB,
VPCMPUB, VPCMPW, and VPCMPUW opcode declarations.

This makes decoder availability agree with the architectural AVX512BW
requirement. The decoder's existing AVX10.1 fallback includes
BX_ISA_AVX512_BW, so the alternative AVX10.1 feature path remains
unchanged.

Architectural reference

The Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volume 2C, sections “VPCMPB/VPCMPUB—Compare Packed Byte Values Into
Mask” and “VPCMPW/VPCMPUW—Compare Packed Word Values Into Mask,” list
AVX512BW for the 512-bit forms and AVX512VL together with AVX512BW for
the 128- and 256-bit forms. AVX10.1 is listed as an alternative feature
path.

  • Intel® 64 and IA-32 Architectures Software Developer’s Manual

  • Intel® Software Developer Manuals download page
  • Validation

    The affected 32- and 64-bit decoder objects were forcibly rebuilt,
    followed by a successful full Bochs build:

    make -C bochs/cpu -B decoder/fetchdecode32.o decoder/fetchdecode64.o
    make -C bochs -j2
    

    A temporary long-mode probe selected corei7_skylake_x, excluded
    avx512bw while retaining AVX512F, enabled opmask and ZMM state in
    XCR0, entered CPL3, and executed all four 512-bit instruction
    encodings.

    Before the fix:

    VPCMPB=EXECUTED
    VPCMPUB=EXECUTED
    VPCMPW=EXECUTED
    VPCMPUW=EXECUTED
    

    After the fix:

    VPCMPB=#UD
    VPCMPUB=#UD
    VPCMPW=#UD
    VPCMPUW=#UD
    BV:DONE status=pass
    

    Diff: 337 lines (+252 / -85) across 4 files Reviewer: stlintel Review duration: 5m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.42) × (1 − Review Confidence (0.52)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 337 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 64% · Reviewer familiarity: 35%
    51%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.348
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #848"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 51.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 51.6% · Lower = rushed or shallow review
    51.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.4% · Safe to merge
    20.4%