Skip to content

Commit 0d215f5

Browse files
committed
Fix float playback for cross-compilation
1 parent 3704fd3 commit 0d215f5

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

gcc/jit/jit-playback.cc

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
4242
#include "gcc.h"
4343
#include "diagnostic.h"
4444
#include "stmt.h"
45+
#include "realmpfr.h"
4546

4647
#include "jit-playback.h"
4748
#include "jit-result.h"
@@ -1093,22 +1094,16 @@ new_rvalue_from_const <double> (type *type,
10931094
// FIXME: type-checking, or coercion?
10941095
tree inner_type = type->as_tree ();
10951096

1097+
mpfr_t mpf_value;
1098+
1099+
mpfr_init2 (mpf_value, 64);
1100+
mpfr_set_d (mpf_value, value, MPFR_RNDN);
1101+
10961102
/* We have a "double", we want a REAL_VALUE_TYPE.
10971103
1098-
real.cc:real_from_target appears to require the representation to be
1099-
split into 32-bit values, and then sent as an pair of host long
1100-
ints. */
1104+
realmpfr.cc:real_from_mpfr. */
11011105
REAL_VALUE_TYPE real_value;
1102-
union
1103-
{
1104-
double as_double;
1105-
uint32_t as_uint32s[2];
1106-
} u;
1107-
u.as_double = value;
1108-
long int as_long_ints[2];
1109-
as_long_ints[0] = u.as_uint32s[0];
1110-
as_long_ints[1] = u.as_uint32s[1];
1111-
real_from_target (&real_value, as_long_ints, DFmode);
1106+
real_from_mpfr (&real_value, mpf_value, inner_type, MPFR_RNDN);
11121107
tree inner = build_real (inner_type, real_value);
11131108
return new rvalue (this, inner);
11141109
}

0 commit comments

Comments
 (0)