benchmarking Poly/ML & floating point

Stephen Weeks MLton@sourcelight.com
Tue, 12 Sep 2000 11:29:04 -0700 (PDT)


> > 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.
> 
> That's true for branches, but something like:
> 
> map (Real.!=) l
> 
> or even
> 
> map (op =) l
> 
> which doesn't get uselessed away could benefit from changing
> sete T1       setne T2
> mov T1,T2 ==>
> not T2
> 
> I'll look into it.

Here is the relevant snippet of CPS code for List.map Real.!=.  I think the
CPS optimizer is doing all it can in this case.

(* SML *)
val _ =
   List.app
   (fn b => print(concat[Bool.toString b, "\n"]))
   (List.map Real.!= [(1.0, 2.0), (3.0, 3.0)])

(* CPS *)
...
val global_24 = true()
val global_4 = false()
...
	    fun loop_0(x_115, x_116) = 
	       let
		  fun L_12(x_117, x_118) = 
		     let
			val x_120 = #1 x_118
			val x_121 = #2 x_118
			val x_119 = Real_equal(x_120, x_121)
			fun L_13(x_122) = 
			   let
			      val x_123 = ::_2(x_115, x_122)
			   in
			      loop_0(x_123, x_117)
			   end
			fun L_14() = 
			   L_13(global_24)
			fun L_15() = 
			   L_13(global_4)
		     in
			case x_119 of
			  true => L_15 | false => L_14
		     end