FEX-Emu / FEX-Emu/FEX

FPREM/FPREM1 never compute C0/C1/C3

Open
#5,908 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8k
Forks
351
Avg merge
12h 31m
Merged PRs (30d)
102

Description

`FPREM/FPREM1` get dispatched through the `OpDispatchBuilder::X87OpHelper` function unconditionally clearing C2 and never setting C0/C1/C3.

Per the SDM, FPREM/FPREM1 must set C2=1 when the exponent difference between ST(0) and ST(1) exceeds 63 (partial remainder), and otherwise set C0=Q2, C1=Q0, C3=Q1 from the truncated quotient. Neither is implemented.

This was also previosuly tracked with a `// TODO: Set C0 to Q2, C3 to Q1, C1 to Q0` comment which got (accidentally?) dropped in a refactor in a1378f94ce8e7843d5a3cd27bc72847973f8e7ec (#3547).

Contributor guide

Open the contributing guide

Research direction

Start at OpDispatchBuilder::X87OpHelper and compare the FPREM/FPREM1 dispatch path with the Intel SDM behavior described in the issue. Done means partial remainders set C2 and complete remainders set C0, C1, and C3 from the truncated quotient.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.