Closed Simn closed 5 years ago
Turns out the flipping wasn't the issue, I just wasn't respecting the actual comparison operator. It has to generate dcmpl
for the >
and >=
cases and dcmpg
for <
and <=
.
I think the only problem with operator flipping and NaN is that both >
and <
with NaN is false, so rewriting !(a < NaN)
to a >= NaN
changes behaviour. Equality operators should be fine to flip.
The generator currently flips some comparison operators, which is not safe to do because of NaN stuff.
The reason it does that is because I initially got mega-confused by the if instructions. They branch on comparison with 0, so
if_eq
with 0/false on the stack branches.