From: Richard Sandiford Date: Wed, 30 Aug 2017 11:09:17 +0000 (+0000) Subject: [8/77] Simplify gen_trunc/extend_conv_libfunc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3205ab28e639b69e5979f9d8336e2be75f681661;p=gcc.git [8/77] Simplify gen_trunc/extend_conv_libfunc Replace checks of: GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode) with !is_a and use MODE_CLASS equality/inequality instead of: (GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode)) and: (GET_MODE_CLASS (tmode) == MODE_FLOAT && GET_MODE_CLASS (fmode) == MODE_FLOAT) || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode)) 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * optabs-libfuncs.c (gen_trunc_conv_libfunc): Use is_a . Simplify. (gen_extend_conv_libfunc): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251459 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f5107fb446..736902bd82a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-08-30 Richard Sandiford + Alan Hayward + David Sherwood + + * optabs-libfuncs.c (gen_trunc_conv_libfunc): Use is_a + . Simplify. + (gen_extend_conv_libfunc): Likewise. + 2017-08-30 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/optabs-libfuncs.c b/gcc/optabs-libfuncs.c index 7b53a465a09..13463102f61 100644 --- a/gcc/optabs-libfuncs.c +++ b/gcc/optabs-libfuncs.c @@ -579,24 +579,20 @@ gen_trunc_conv_libfunc (convert_optab tab, machine_mode tmode, machine_mode fmode) { - if (GET_MODE_CLASS (tmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (tmode)) - return; - if (GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode)) - return; - if (tmode == fmode) + scalar_float_mode float_tmode, float_fmode; + if (!is_a (fmode, &float_fmode) + || !is_a (tmode, &float_tmode) + || float_tmode == float_fmode) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) - || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode))) - gen_interclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) != GET_MODE_CLASS (float_fmode)) + gen_interclass_conv_libfunc (tab, opname, float_tmode, float_fmode); - if (GET_MODE_PRECISION (fmode) <= GET_MODE_PRECISION (tmode)) + if (GET_MODE_PRECISION (float_fmode) <= GET_MODE_PRECISION (float_tmode)) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT - && GET_MODE_CLASS (fmode) == MODE_FLOAT) - || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode))) - gen_intraclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) == GET_MODE_CLASS (float_fmode)) + gen_intraclass_conv_libfunc (tab, opname, float_tmode, float_fmode); } /* Pick proper libcall for extend_optab. We need to chose if we do @@ -608,23 +604,19 @@ gen_extend_conv_libfunc (convert_optab tab, machine_mode tmode, machine_mode fmode) { - if (GET_MODE_CLASS (tmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (tmode)) - return; - if (GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode)) - return; - if (tmode == fmode) + scalar_float_mode float_tmode, float_fmode; + if (!is_a (fmode, &float_fmode) + || !is_a (tmode, &float_tmode) + || float_tmode == float_fmode) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) - || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode))) - gen_interclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) != GET_MODE_CLASS (float_fmode)) + gen_interclass_conv_libfunc (tab, opname, float_tmode, float_fmode); - if (GET_MODE_PRECISION (fmode) > GET_MODE_PRECISION (tmode)) + if (GET_MODE_PRECISION (float_fmode) > GET_MODE_PRECISION (float_tmode)) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT - && GET_MODE_CLASS (fmode) == MODE_FLOAT) - || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode))) + if (GET_MODE_CLASS (float_tmode) == GET_MODE_CLASS (float_fmode)) gen_intraclass_conv_libfunc (tab, opname, tmode, fmode); }