benchmarking Poly/ML & floating point

Stephen Weeks MLton@sourcelight.com
Mon, 11 Sep 2000 15:09:14 -0700 (PDT)


> > But after your mail, I gather that you can do qequal with one test, and if so,
> > then the right thing to do is to leave qequal as a primitive, and to make
> > mlton-lib.h do the right thing for Real_qequal.
> 
> It's really too bad that your emails arrive just as I'm finishing the last
> paragraph on mine. ;)

Glad to know we're all on the same page.

> Well, there is the efficiency question.  Real_equal is implemented by
> and-ing and comparing th floating point status word and then doing a setz.
> So, Real_nequal is done exactly the same way, except with a setnz.  If you
> define it as  not o Real.==  then (currently) there would be an extra not
> instruction.  But, I should be able to peephole that away.  In fact, I
> really should look into that because any use of the polymorphic != would
> suffer from this as well.

Actually, the CPS optimizer should eliminate the not by switching the labels on
the cases from the Real.==.  Lemme know if you see a case where it doesn't.