From b5f2d801b10c25ef32a80c03d6df8668920a593c Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:09:27 +0000 Subject: [9/77] Add SCALAR_FLOAT_TYPE_MODE This patch adds a macro that extracts the TYPE_MODE and forcibly converts it to a scalar_float_mode. The forcible conversion includes a gcc_checking_assert that the mode is a SCALAR_FLOAT_MODE_P. This becomes important as more static type checking is added by later patches. It has the additional benefit of bypassing the VECTOR_TYPE_P (...) ? vector_type_mode (...) : ... condition in TYPE_MODE; in release builds the new macro is a simple field access. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree.h (SCALAR_FLOAT_TYPE_MODE): New macro. * builtins.c (expand_builtin_signbit): Use it instead of TYPE_MODE. * fold-const.c (fold_convert_const_real_from_fixed): Likewise. (native_encode_real): Likewise. (native_interpret_real): Likewise. * hsa-brig.c (emit_immediate_scalar_to_buffer): Likewise. * tree-vrp.c (simplify_float_conversion_using_ranges): Likewise. gcc/cp/ * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE instead of TYPE_MODE. gcc/fortran/ * target-memory.c (size_float): Use SCALAR_FLOAT_TYPE_MODE instead of TYPE_MODE. gcc/objc/ * objc-encoding.c (encode_type): Use SCALAR_FLOAT_TYPE_MODE instead of TYPE_MODE. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251460 --- gcc/tree-vrp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree-vrp.c') diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 2689697..4da6a2b 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10094,7 +10094,8 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, { tree rhs1 = gimple_assign_rhs1 (stmt); value_range *vr = get_value_range (rhs1); - machine_mode fltmode = TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))); + scalar_float_mode fltmode + = SCALAR_FLOAT_TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))); machine_mode mode; tree tem; gassign *conv; -- cgit v1.1