Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[General]: FCOMI/FUCOMI updates comparison flags on unmasked invalid operation

Open Beginner friendly
#72 0 comments 0 reactions 0 assignees View on GitHub

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

Executable specification issue

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.

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/SDM

All issues in intel/SDM

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.