From patchwork Sat Nov 7 12:49:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 541289 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 287AF140324 for ; Sat, 7 Nov 2015 23:49:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=F1yaE9HI; 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=bLfyU/RpWgFnDDTY ZSelWsy45ZUAzYDnudxJ+9oKgzFOQ2lzYsvJPxhwexKKwrduUFo9Ug24EbNmlMho 2FV2mSgCrGwDiy2Ee0T+F2Tx56PmHdyXwXHXXLgRd7LjOWEPRLeRfl90XdQGmXmZ h7vW/H8DqleLzGk2O8epZ2Igm20= 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=mqgpnLzj8zvCmO6MKtZjUv Yrx8o=; b=F1yaE9HI5XHSoADFf/opDfeBaXqlouhGJL2ZKBe/z357cjC//HAIRM AMUy7OH8RIJrE8BPwxZQThfSi6yiEOc2YfeDAAp2I2eboO0ORbBgVnlza4RD1eZT Idr3JygUusW4dXh3V6Mya+wvKH3U2A1GwEHYwnFOzugrgSHqw/6CI= Received: (qmail 30836 invoked by alias); 7 Nov 2015 12:49:27 -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 30823 invoked by uid 89); 7 Nov 2015 12:49:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham 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; Sat, 07 Nov 2015 12:49:25 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-5-Foi7ni6nSJqY2HXXrvbjGA-1; Sat, 07 Nov 2015 12:49:20 +0000 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Sat, 7 Nov 2015 12:49:20 +0000 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Use combined_fn in tree-ssa-math-opts.c Date: Sat, 07 Nov 2015 12:49:20 +0000 Message-ID: <87a8qqq8j3.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: Foi7ni6nSJqY2HXXrvbjGA-1 Another patch to extend uses of built_in_function to combined_fn, this time in tree-ssa-math-opts.c. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. OK to install? Thanks, Richard gcc/ * tree-ssa-math-opts.c: Include case-cfn-macros.h. (execute_cse_sincos_1): Use combined_fn instead of built-in codes. (pass_cse_sincos::execute): Likewise. diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 41fcabf..ccfed32 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "builtins.h" #include "params.h" +#include "case-cfn-macros.h" /* This structure represents one basic block that either computes a division, or is a common dominator for basic block that compute a @@ -725,22 +726,20 @@ execute_cse_sincos_1 (tree name) FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name) { if (gimple_code (use_stmt) != GIMPLE_CALL - || !gimple_call_lhs (use_stmt) - || !(fndecl = gimple_call_fndecl (use_stmt)) - || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL) + || !gimple_call_lhs (use_stmt)) continue; - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (use_stmt)) { - CASE_FLT_FN (BUILT_IN_COS): + CASE_CFN_COS: seen_cos |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; - CASE_FLT_FN (BUILT_IN_SIN): + CASE_CFN_SIN: seen_sin |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_CEXPI: seen_cexpi |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; break; @@ -779,19 +778,18 @@ execute_cse_sincos_1 (tree name) for (i = 0; stmts.iterate (i, &use_stmt); ++i) { tree rhs = NULL; - fndecl = gimple_call_fndecl (use_stmt); - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (use_stmt)) { - CASE_FLT_FN (BUILT_IN_COS): + CASE_CFN_COS: rhs = fold_build1 (REALPART_EXPR, type, res); break; - CASE_FLT_FN (BUILT_IN_SIN): + CASE_CFN_SIN: rhs = fold_build1 (IMAGPART_EXPR, type, res); break; - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_CEXPI: rhs = res; break; @@ -1727,26 +1725,24 @@ pass_cse_sincos::execute (function *fun) for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - tree fndecl; /* Only the last stmt in a bb could throw, no need to call gimple_purge_dead_eh_edges if we change something in the middle of a basic block. */ cleanup_eh = false; - if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL) + if (is_gimple_call (stmt) && gimple_call_lhs (stmt)) { tree arg, arg0, arg1, result; HOST_WIDE_INT n; location_t loc; - fndecl = gimple_call_fndecl (stmt); - switch (DECL_FUNCTION_CODE (fndecl)) + switch (gimple_call_combined_fn (stmt)) { - CASE_FLT_FN (BUILT_IN_COS): - CASE_FLT_FN (BUILT_IN_SIN): - CASE_FLT_FN (BUILT_IN_CEXPI): + CASE_CFN_COS: + CASE_CFN_SIN: + CASE_CFN_CEXPI: /* Make sure we have either sincos or cexp. */ if (!targetm.libc_has_function (function_c99_math_complex) && !targetm.libc_has_function (function_sincos)) @@ -1757,7 +1753,7 @@ pass_cse_sincos::execute (function *fun) cfg_changed |= execute_cse_sincos_1 (arg); break; - CASE_FLT_FN (BUILT_IN_POW): + CASE_CFN_POW: arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); @@ -1777,7 +1773,7 @@ pass_cse_sincos::execute (function *fun) } break; - CASE_FLT_FN (BUILT_IN_POWI): + CASE_CFN_POWI: arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); loc = gimple_location (stmt); @@ -1826,7 +1822,7 @@ pass_cse_sincos::execute (function *fun) } break; - CASE_FLT_FN (BUILT_IN_CABS): + CASE_CFN_CABS: arg0 = gimple_call_arg (stmt, 0); loc = gimple_location (stmt); result = gimple_expand_builtin_cabs (&gsi, loc, arg0);