FEX icon indicating copy to clipboard operation
FEX copied to clipboard

FPREM/FPREM1 never compute C0/C1/C3

Open simon902 opened this issue 3 months ago • 0 comments

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).

simon902 avatar Sep 03 '26 07:09 simon902