gccrs: Add float_to_int_unchecked intrinsic
Introduces an unchecked intrinsic for converting floats to integers in gccrs.
The gccrs compiler now supports a new intrinsic function, float_to_int_unchecked, for converting floating-point numbers to integers without performing additional checks. This intrinsic mirrors a feature found in standard Rust casts, which also lack certain safety checks. Its addition is motivated by the need to handle potentially invalid casts and aligns the compiler’s intrinsic support with Rust’s casting behavior.
In Details
A new intrinsic, float_to_int_unchecked, has been added to rust-compile-intrinsic.cc, rust-intrinsic-handlers.cc, rust-intrinsic-handlers.h, rust-hir-type-check-intrinsic.cc, and rust-intrinsic-values.h. This intrinsic bypasses the safety checks typically associated with floating-point to integer conversions, similar to Rust's as cast behavior. Its implementation is placed in rust-intrinsic-handlers.cc and registered for type checking.
- gccrs
- The GCC frontend for the Rust programming language.
- Intrinsic
- A function that is recognized by the compiler and translated directly into a specific machine instruction or a sequence of instructions, often for performance or to access hardware features.
- float
- A data type that represents numbers with a fractional part.
- integer
- A data type that represents whole numbers.