[MLton] arith shrinking & bit fiddling

Stephen Weeks MLton@mlton.org
Tue, 21 Oct 2003 08:02:26 -0700


> Without it, we don't simplify overflow checking operations like:
>  0 - x
>  ~1 * x
> 
> 
> 2) Does anyone know an efficient way of doing overflow checking for signed
> negation in assembly?  Note that defining:
>   val Int64.~ =
>                if detectOverflow
> 		  then (fn i: int => if i = minInt'
> 					then raise Overflow
> 				     else ~? i)
> 	       else ~?
> is o.k., but the simplification above will introduce Int64_negCheck even
> if it doesn't appear in the source program.

You mean for  0 - x ---> ~x?  I don't understand why this is bad.
It's replacing Int64_subCheck with Int64_negCheck.

_______________________________________________
MLton mailing list
MLton@mlton.org
http://www.mlton.org/mailman/listinfo/mlton