From patchwork Fri Oct 23 08:10:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 534827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2E511141311 for ; Fri, 23 Oct 2015 19:10:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=VzS4Rtg1; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=wfqDuPOFsDRUoOay MhnUxPC5tnDrciWvSfugqyVI10ybXE4NlsfNrVxUElr1W6ySnxZ14hUR5d71DC5c sksRR+dvGkjHJPi2RsJ19c5oyQ+p5ymP+MayDe127+3b0IhI80LZW5nJsTV1sLOI oKsVuBfrdtR3Isksg8++QZc4N6c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=vcMYga2iLcH8N2kvjuXww0 znOJ0=; b=VzS4Rtg19ikQP0cwdH76uopSCEpsGzWff3+MCxYmbvDprC3tlyzxmm dPkYPDXSdHA3adDOtFYqu3g/mwgf0Y8wa6/jKdp1+xywwcyMfPPpUDXmjgpv9irh Kbu6ys8zDQ95QXbAHksrNDDnU/qvVmfrVrngsaSzFPENX8EmoquyY= Received: (qmail 40985 invoked by alias); 23 Oct 2015 08:10:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40950 invoked by uid 89); 23 Oct 2015 08:10:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, SPF_PASS, UPPERCASE_50_75 autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Oct 2015 08:10:31 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-17-fA28hp-TQ_G6SI9DHvDWtA-1; Fri, 23 Oct 2015 09:10:25 +0100 Received: from localhost ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 23 Oct 2015 09:10:24 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Use macros to define built-in operator lists Date: Fri, 23 Oct 2015 09:10:24 +0100 Message-ID: <87eggmxaxb.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: fA28hp-TQ_G6SI9DHvDWtA-1 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. OK to install? Thanks, Richard gcc/ * match.pd: Use macros to define built-in operator lists. diff --git a/gcc/match.pd b/gcc/match.pd index f7b7792..f7a1fee 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. */