From 7aaba298fe122dfd40bb612623df89db08499f8b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 1 Nov 2017 13:30:34 +0000 Subject: Add an is_narrower_int_mode helper function This patch adds a function for testing whether an arbitrary mode X is an integer mode that is narrower than integer mode Y. This is useful for code like expand_float and expand_fix that could in principle handle vectors as well as scalars. 2017-11-01 Richard Sandiford Alan Hayward David Sherwood gcc/ * machmode.h (is_narrower_int_mode): New function * optabs.c (expand_float, expand_fix): Use it. * dwarf2out.c (rotate_loc_descriptor): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r254305 --- gcc/optabs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/optabs.c') diff --git a/gcc/optabs.c b/gcc/optabs.c index 7cf4d8e..8f7089e 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4811,7 +4811,7 @@ expand_float (rtx to, rtx from, int unsignedp) rtx value; convert_optab tab = unsignedp ? ufloat_optab : sfloat_optab; - if (GET_MODE_PRECISION (GET_MODE (from)) < GET_MODE_PRECISION (SImode)) + if (is_narrower_int_mode (GET_MODE (from), SImode)) from = convert_to_mode (SImode, from, unsignedp); libfunc = convert_optab_libfunc (tab, GET_MODE (to), GET_MODE (from)); @@ -4993,7 +4993,7 @@ expand_fix (rtx to, rtx from, int unsignedp) that the mode of TO is at least as wide as SImode, since those are the only library calls we know about. */ - if (GET_MODE_PRECISION (GET_MODE (to)) < GET_MODE_PRECISION (SImode)) + if (is_narrower_int_mode (GET_MODE (to), SImode)) { target = gen_reg_rtx (SImode); -- cgit v1.1