diff options
author | Antoni Boucher <bouanto@zoho.com> | 2023-10-21 11:20:46 -0400 |
---|---|---|
committer | Antoni Boucher <bouanto@zoho.com> | 2024-11-20 09:08:21 -0500 |
commit | fa720364e4ed3154b7f2dd8f4c2c71f890990552 (patch) | |
tree | eac476388f5f5de16a39537f320ecf98202df986 /gcc/jit | |
parent | 30c2678cc6e6f1aefc32f07ce8200310920c77eb (diff) | |
download | gcc-fa720364e4ed3154b7f2dd8f4c2c71f890990552.zip gcc-fa720364e4ed3154b7f2dd8f4c2c71f890990552.tar.gz gcc-fa720364e4ed3154b7f2dd8f4c2c71f890990552.tar.bz2 |
libgccjit: Fix float playback for cross-compilation
gcc/jit/ChangeLog:
PR jit/113343
* jit-playback.cc (new_rvalue_from_const): Fix to have the
correct value when cross-compiling.
Diffstat (limited to 'gcc/jit')
-rw-r--r-- | gcc/jit/jit-playback.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc index e32e837..88513a6 100644 --- a/gcc/jit/jit-playback.cc +++ b/gcc/jit/jit-playback.cc @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "gcc.h" #include "diagnostic.h" #include "stmt.h" +#include "realmpfr.h" #include "jit-playback.h" #include "jit-result.h" @@ -1078,22 +1079,16 @@ new_rvalue_from_const <double> (type *type, // FIXME: type-checking, or coercion? tree inner_type = type->as_tree (); + mpfr_t mpf_value; + + mpfr_init2 (mpf_value, 64); + mpfr_set_d (mpf_value, value, MPFR_RNDN); + /* We have a "double", we want a REAL_VALUE_TYPE. - real.cc:real_from_target appears to require the representation to be - split into 32-bit values, and then sent as an pair of host long - ints. */ + realmpfr.cc:real_from_mpfr. */ REAL_VALUE_TYPE real_value; - union - { - double as_double; - uint32_t as_uint32s[2]; - } u; - u.as_double = value; - long int as_long_ints[2]; - as_long_ints[0] = u.as_uint32s[0]; - as_long_ints[1] = u.as_uint32s[1]; - real_from_target (&real_value, as_long_ints, DFmode); + real_from_mpfr (&real_value, mpf_value, inner_type, MPFR_RNDN); tree inner = build_real (inner_type, real_value); return new rvalue (this, inner); } |