Closed vext01 closed 2 weeks ago
(After this attrib.lua
gets a little further)
I'll force push to fix the conflicts, if that's ok?
https://github.com/ykjit/yk/pull/1276/commits/a9baf295184ef01c188fd1d0f73b9ed7b6d73de8 fixes the missing NOOPT_VALs.
OK to force push a squash/rebase?
Please go ahead.
ready
force pushed a fix for formatting. go ahead.
Requires: https://github.com/ykjit/ykllvm/pull/178
Float comparisons are a bit more involved than integer comparisons.
Here's some of the highlights (and my working understanding of them):
There are some special values that make the ordering a bit more interesting, e.g. +inf, -inf, NaN, +0 and -0.
There is a large encoding space for representing NaNs and NaNs are, in float terminology, "unordered". i.e. in the partial order of floats a NaN cannot be compared to any other element. Amusingly, two NaNs are never considered equal.
This plays into comparison operations. You can get the unordered result if at least one of the things you want to compare are NaN.
NaN comes in two variants: quiet and signalling, which basically mean "silently proceed, despite NaN" or "crash". In our x86 codegen we use
ucomis{s,d}
andcomis{s,d}
respectively for this. The latter would cause the chip to raise a floating point exception.But what happens when we get the unordered result for a comparison and we are not crashing? We still need an answer, were they equal or not? We do as clang does, and follow the IEE-754 float spec:
I hope I've got this all right :)