vnmakarov / mir

A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR
MIT License
2.24k stars 147 forks source link

Bitcasting #327

Closed giann closed 1 year ago

giann commented 1 year ago

Do I2F/D/LD and F/D/LD2I perform a bitcast? If not, how can I do one? Do I need to modify my MIR_op_t and change it's type?

vnmakarov commented 1 year ago

Not they are not a bitcast operation. It is an analog of C cast (integer to fp or fp to integer).

The only way to perform a bitcast operation in MIR is to put the value into memory as one type value and take it back as another type value.