[General]: FCOMI/FUCOMI updates comparison flags on unmasked invalid operation
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- xml
- Domain
- compilers
Research direction
Start in data/instruction/FCOMI-FCOMIP-FUCOMI-FUCOMIP.xml around line 123 and inspect the shared executable operation, including the empty-stack branch and Compare handling. Read the cited SDM pages alongside the source, then verify that unmasked invalid operation preserves ZF/PF/CF while OF/SF/AF clearing and pop suppression remain unchanged.
Written by the indexing model from the issue text.
Description
Problem
The shared executable operation writes ZF/PF/CF before testing whether invalid operation is unmasked. The PDF says those three flags are updated only when the invalid-operation exception is masked. The source and PDF therefore specify different comparison flags for the same inputs.
Concrete case
With x87 enabled and no pending exception, compare signaling NaN 0x7fff8000000000000001 in ST(0) with 1 in ST(1), using FCOMI, control word 0x037e and incoming ZF=PF=CF=0. The source writes all three flags to 1, then suppresses result/pop effects. The PDF implies that the incoming comparison flags remain zero. The shared empty-stack branch also writes the flags before considering the mask.
Expected behavior and references
References use Intel SDM 325462-093, checked on 2026-10-01. PDF page numbers below refer to the combined manual.
- FCOMI/FCOMIP/FUCOMI/FUCOMIP description and Table 1-18 note; combined PDF page 1031
- comparison operation; combined PDF page 1032
Source
Source checked at Intel SDM repository commit b5218b0f1cf512304d4b3cb364433a08fcee47cb.
Suggested correction
Follow the SDM's comparison-flag rule by preserving ZF/PF/CF when invalid operation is unmasked. In the empty-stack branch, write these flags only when IM=1; after Compare, write them only when IE=0 or IM=1. Retain the clearing of OF/SF/AF and the existing pop suppression.
Evidence
On AMD EPYC-Milan under KVM, the unmasked-invalid comparison sets ZF/PF/CF to 1, matching the executable operation.
AI disclosure
Assisted by Codex
- Dominant language
- HTML
- Stars
- 40
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 intel/SDM
-
Executable specification issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Executable specification issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Executable specification issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Executable specification issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
SDM PDF issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
erdos-status-sync
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
google-deepmind/formal-conjectures#6920 ·
Maintainers usually reply within 1 day
-
area-web-js web-libraries
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#9317 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
rubys/roundhouse#571 ·
Maintainers usually reply within 1 day