ILGPU icon indicating copy to clipboard operation
ILGPU copied to clipboard

Fixed disassembly of Conv_R_Un opcode.

Open MoFtZ opened this issue 1 year ago • 1 comments

Fixes #1309.

Looking at the documentation, it should be a float operation rather than double.

However @m4rs-mt, I do not understand the last section of the implementation notes. Do we need to do anything special to handle the float64 case?

If overflow occurs converting a floating-point type to an integer the result returned is unspecified. The conv.r.un operation takes an integer off the stack, interprets it as unsigned, and replaces it with a floating-point number to represent the integer: either a float32, if this is wide enough to represent the integer without loss of precision, or else a float64.

Source: https://learn.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_r_un?view=net-8.0

MoFtZ avatar Dec 09 '24 01:12 MoFtZ

Nice catch, thank you very much for looking into this. I think the documentation may be interpreted as: if IsInt(top of stack) then castFP32(top of stack) else castFP64(top of stack)

m4rs-mt avatar Jan 16 '25 20:01 m4rs-mt

Superseded by #1356.

m4rs-mt avatar Jul 12 '25 17:07 m4rs-mt