[Mono-dev] x86 code generator

Massimiliano Mantione massi at ximian.com
Wed Jul 19 06:02:21 EDT 2006


Sorry for the *late* reply, I was in vacation :-)
Others already explained you the "while (0)" thing...

On Sun, 2006-07-02 at 17:53 -0700, Rusmin Susanto wrote:
> 2. How do you know that "sin" function is equal to the following
> instructions in x86:
>  
>  x86_fsin (code);
>  x86_fldz (code);
>  x86_fp_op_reg (code, X86_FADD, 1, TRUE);

Actually the "x86_fsin (code);" emits an fsin opcode which is
enough to perform a sin operation.

The following fldz and fadd are needed to truncate the result
to 64 bits (fsin operates with 80 bits), they are the fastest
way I found (asking around, thanks lupus!) to do this floating
point conversion.

Not truncating the result caused very subtle bugs because the
required semantics in CIL is to operate with 64 bits values.

Ciao,
  Massi





More information about the Mono-devel-list mailing list