arch-riscv: Fix unexpected behavior of float operations in Mac OS
The uint_fast16_t is the integer at least 16 bits size, it can be 32, 64 bits and more. Usually most of the simulations are in the x86-64 linux host, the size of uint_fast16_t is 64 bits. Therefore, there is no problem for double precision float operations and it can pass FloatMM test. However, in the Mac OS, the size of uint_fast16_t is 16 bits, it will lose the upper bits when converting float register bits to freg_t and it will generate unexpected results for FloatMM test. The change can guarantee that the size of data in freg_t is at least 64 bits and it will not lose any data from floating point to freg_t. Reference: https://developer.apple.com/documentation/kernel/uint_fast16_t https://codebrowser.dev/glibc/glibc/stdlib/stdint.h.html Change-Id: I3df6610f0903cdee0f56584d6cbdb51ac26c86c8 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71578 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -105,7 +105,7 @@ static constexpr float64_t f64(freg_t r) { return r; }
|
||||
static constexpr freg_t freg(float16_t f) { return {boxF16(f.v)}; }
|
||||
static constexpr freg_t freg(float32_t f) { return {boxF32(f.v)}; }
|
||||
static constexpr freg_t freg(float64_t f) { return f; }
|
||||
static constexpr freg_t freg(uint_fast16_t f) { return {f}; }
|
||||
static constexpr freg_t freg(uint_fast64_t f) { return {f}; }
|
||||
|
||||
namespace float_reg
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user