From f16e6077eaecf7ace56ff9f0147c9854f93d77e1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 30 Oct 2015 13:45:42 +0000 Subject: Allow real_format to be passed to more real.h functions Most real.h routines used machine modes to specify the format of an operation and converted that to a float_format * internally. Some also had alternative versions that accepted a float_format *. In an upcoming patch it seemed more convenient for the callers I was adding to use float_format directly, since the callers need to examine the format themselves for other reasons. This patch therefore replaces the machine_mode arguments with a new class that allows both machine modes and float_format pointers to be used. Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu. gcc/ * real.h (format_helper): New. (real_convert, exact_real_truncate, real_from_string3, real_to_target) (real_from_target, real_nan, real_2expN, real_value_truncate) (significand_size, real_from_string2, exact_real_inverse) (exact_real_inverse, real_powi, real_trunc, real_floor, real_ceil) (real_round, real_isinteger, real_from_integer): Replace machine_mode arguments with format_helper arguments. * real.c (exact_real_inverse, real_from_string2, real_from_string3) (real_from_integer, real_nan, real_2expN, real_convert) (real_value_truncate, exact_real_truncate, real_to_target) (real_from_target, significand_size, real_powi, real_trunc) (real_floor, real_ceil, real_round, real_isinteger): Replace machine_mode arguments with format_helper arguments. (real_to_target_fmt, real_from_target_fmt): Delete. * dfp.h (decimal_real_convert): Replace mode argument with real_format. * dfp.c (decimal_to_binary, decimal_real_convert): Replace mode argument with real_format. * builtins.c (do_real_to_int_conversion): Update type of fn argument. gcc/java/ * jcf-parse.c (get_constant): Use real_from_target rather than real_from_target_fmt. From-SVN: r229581 --- gcc/dfp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gcc/dfp.c') diff --git a/gcc/dfp.c b/gcc/dfp.c index ca0071c238d..34386eb8586 100644 --- a/gcc/dfp.c +++ b/gcc/dfp.c @@ -343,13 +343,13 @@ decode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED, static void decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from, - machine_mode mode) + const real_format *fmt) { char string[256]; const decimal128 *const d128 = (const decimal128 *) from->sig; decimal128ToString (d128, string); - real_from_string3 (to, string, mode); + real_from_string3 (to, string, fmt); } @@ -459,15 +459,13 @@ decimal_round_for_format (const struct real_format *fmt, REAL_VALUE_TYPE *r) binary and decimal types. */ void -decimal_real_convert (REAL_VALUE_TYPE *r, machine_mode mode, +decimal_real_convert (REAL_VALUE_TYPE *r, const real_format *fmt, const REAL_VALUE_TYPE *a) { - const struct real_format *fmt = REAL_MODE_FORMAT (mode); - if (a->decimal && fmt->b == 10) return; if (a->decimal) - decimal_to_binary (r, a, mode); + decimal_to_binary (r, a, fmt); else decimal_from_binary (r, a); } -- cgit v1.2.3