Open ranweiler opened 6 years ago
I'd like to wrap up the FBLD/FBSTP impls in #219, but this is a bit of cross-cutting issue, and it might make sense to address first. Otherwise I'll have to do somethign like not test SNaNs, or cut out a partial fix in that PR to get tests all passing.
This is mostly done in #224, but it needs one more pass to add NaN test cases to all the instructions that consume the X87 stack. Some of the existing tests (e.g. for fyl2x
) just use fldpi
and fldlg2
to set up happy path test inputs.
While adding X87 instructions, I've found that we don't model (or sometimes test) various input classes for X87 semantics. This surfaced when I started adding more exhaustive test inputs for the BCD instructions.
Much of this relates to inaccurate modeling of the pushing SNaNs onto the X87 stack. The X87 stack does not appear to typically store SNaNs; at least, they are quietized by
fld
before being pushed. Ourfld
semantic pushes an explicitly signaling NaN onto the X87 stack.Even after fixing this, in our semantics tests, there are cases where we push an SNaN onto the X87 stack (after being quietized), which sets the IE bit. Then we perform an op with ST(0) whose semantic has a line like
state.sw.ie = IsSignalingNaN(val);
, which always clears the IE flag, sinceval
was quietized when pushed. What we should do is|=
, to avoid clearing IE if it was set. Seefsqrt
,frndint
, &c.Right now, I think we have a situation where the two modeling errors cancel each other out in the existing semantics tests that are sensitive to this. I'm also wondering if this relates to the Travis-only errors we're seeing with
ftst
, but as I write this issue, Travis is having service issues, so I haven't been able to test that at all.