Open
Description
When I tried to write code for MSP430G2553 using Rust and simulated it on Protues, i32 as f32
gave unexpected results.
0x0000_0001 as f32 as i32 -> 0x0001_0001
0x0000_0002 as f32 as i32 -> 0x0002_0002
After troubleshooting, it is suspected that the called __mspabi_fltlif
has a problem.
The problem disappears after adding the following code:
#![feature(rustc_private)]
extern crate compiler_builtins;
#[no_mangle]
fn __mspabi_fltlif(x: i32) -> f32 {
compiler_builtins::float::conv::__floatsisf(x)
}
Is this the problem of Rust compilation or LLVM? Or is it a problem with MSPGCC? Or is it Proteus?
rustc --version
rustc 1.69.0-nightly (fdbc4329c 2023-02-22)