From 257aecb4a57670a5d0aa7b023faca4438a7c1ae1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 26 Oct 2015 09:26:11 +0000 Subject: [PATCH] Use macros to define built-in operator lists No functional change. This should be a slight readability improvement on its own, but becomes more important with the next patch. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * match.pd: Use macros to define built-in operator lists. From-SVN: r229310 --- gcc/ChangeLog | 4 +++ gcc/match.pd | 67 ++++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 399ee465773..b8fd4630847 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-10-26 Richard Sandiford + + * match.pd: Use macros to define built-in operator lists. + 2015-10-20 Richard Sandiford Richard Biener diff --git a/gcc/match.pd b/gcc/match.pd index acf0e40291b..e790d5b2f94 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -47,39 +47,40 @@ along with GCC; see the file COPYING3. If not see (define_operator_list simple_comparison lt le eq ne ge gt) (define_operator_list swapped_simple_comparison gt ge eq ne le lt) -(define_operator_list LOG BUILT_IN_LOGF BUILT_IN_LOG BUILT_IN_LOGL) -(define_operator_list EXP BUILT_IN_EXPF BUILT_IN_EXP BUILT_IN_EXPL) -(define_operator_list LOG2 BUILT_IN_LOG2F BUILT_IN_LOG2 BUILT_IN_LOG2L) -(define_operator_list EXP2 BUILT_IN_EXP2F BUILT_IN_EXP2 BUILT_IN_EXP2L) -(define_operator_list LOG10 BUILT_IN_LOG10F BUILT_IN_LOG10 BUILT_IN_LOG10L) -(define_operator_list EXP10 BUILT_IN_EXP10F BUILT_IN_EXP10 BUILT_IN_EXP10L) -(define_operator_list POW BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL) -(define_operator_list POW10 BUILT_IN_POW10F BUILT_IN_POW10 BUILT_IN_POW10L) -(define_operator_list SQRT BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL) -(define_operator_list CBRT BUILT_IN_CBRTF BUILT_IN_CBRT BUILT_IN_CBRTL) -(define_operator_list SIN BUILT_IN_SINF BUILT_IN_SIN BUILT_IN_SINL) -(define_operator_list COS BUILT_IN_COSF BUILT_IN_COS BUILT_IN_COSL) -(define_operator_list TAN BUILT_IN_TANF BUILT_IN_TAN BUILT_IN_TANL) -(define_operator_list ATAN BUILT_IN_ATANF BUILT_IN_ATAN BUILT_IN_ATANL) -(define_operator_list COSH BUILT_IN_COSHF BUILT_IN_COSH BUILT_IN_COSHL) -(define_operator_list CEXP BUILT_IN_CEXPF BUILT_IN_CEXP BUILT_IN_CEXPL) -(define_operator_list CEXPI BUILT_IN_CEXPIF BUILT_IN_CEXPI BUILT_IN_CEXPIL) -(define_operator_list CPROJ BUILT_IN_CPROJF BUILT_IN_CPROJ BUILT_IN_CPROJL) -(define_operator_list CCOS BUILT_IN_CCOSF BUILT_IN_CCOS BUILT_IN_CCOSL) -(define_operator_list CCOSH BUILT_IN_CCOSHF BUILT_IN_CCOSH BUILT_IN_CCOSHL) -(define_operator_list HYPOT BUILT_IN_HYPOTF BUILT_IN_HYPOT BUILT_IN_HYPOTL) -(define_operator_list COPYSIGN BUILT_IN_COPYSIGNF - BUILT_IN_COPYSIGN - BUILT_IN_COPYSIGNL) -(define_operator_list CABS BUILT_IN_CABSF BUILT_IN_CABS BUILT_IN_CABSL) -(define_operator_list TRUNC BUILT_IN_TRUNCF BUILT_IN_TRUNC BUILT_IN_TRUNCL) -(define_operator_list FLOOR BUILT_IN_FLOORF BUILT_IN_FLOOR BUILT_IN_FLOORL) -(define_operator_list CEIL BUILT_IN_CEILF BUILT_IN_CEIL BUILT_IN_CEILL) -(define_operator_list ROUND BUILT_IN_ROUNDF BUILT_IN_ROUND BUILT_IN_ROUNDL) -(define_operator_list NEARBYINT BUILT_IN_NEARBYINTF - BUILT_IN_NEARBYINT - BUILT_IN_NEARBYINTL) -(define_operator_list RINT BUILT_IN_RINTF BUILT_IN_RINT BUILT_IN_RINTL) +/* Define an operand list for math function FN, with float, double and + long double variants (in that order). */ +#define DEFINE_MATH_FN(FN) \ + (define_operator_list FN BUILT_IN_##FN##F BUILT_IN_##FN BUILT_IN_##FN##L) + +DEFINE_MATH_FN (LOG) +DEFINE_MATH_FN (EXP) +DEFINE_MATH_FN (LOG2) +DEFINE_MATH_FN (EXP2) +DEFINE_MATH_FN (LOG10) +DEFINE_MATH_FN (EXP10) +DEFINE_MATH_FN (POW) +DEFINE_MATH_FN (POW10) +DEFINE_MATH_FN (SQRT) +DEFINE_MATH_FN (CBRT) +DEFINE_MATH_FN (SIN) +DEFINE_MATH_FN (COS) +DEFINE_MATH_FN (TAN) +DEFINE_MATH_FN (ATAN) +DEFINE_MATH_FN (COSH) +DEFINE_MATH_FN (CEXP) +DEFINE_MATH_FN (CEXPI) +DEFINE_MATH_FN (CPROJ) +DEFINE_MATH_FN (CCOS) +DEFINE_MATH_FN (CCOSH) +DEFINE_MATH_FN (HYPOT) +DEFINE_MATH_FN (COPYSIGN) +DEFINE_MATH_FN (CABS) +DEFINE_MATH_FN (TRUNC) +DEFINE_MATH_FN (FLOOR) +DEFINE_MATH_FN (CEIL) +DEFINE_MATH_FN (ROUND) +DEFINE_MATH_FN (NEARBYINT) +DEFINE_MATH_FN (RINT) /* Simplifications of operations with one constant operand and simplifications to constants or single values. */ -- 2.30.2