From patchwork Wed Aug 9 14:39:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: will schmidt X-Patchwork-Id: 799821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-460103-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="g4WPac5q"; dkim-atps=neutral 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 3xSDSC46Nkz9s78 for ; Thu, 10 Aug 2017 00:39:38 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:reply-to:to:cc:in-reply-to:references:content-type :date:mime-version:content-transfer-encoding:message-id; q=dns; s=default; b=iBdru84faiE5c8kCZ3WLKWdj/qWbg1XxRqIc/nW6uD0cqlEm1k d5Yn2JcblMkrefGRStR+5tPcJDvTQcYr5jRJrkpB1+ovNgbNlcnbERRy/N0CLmE6 ZZVYIfhwKEFFcX3E6QyptTgchaBEiiCnJ0hlZVAPjt6vy8mrAJDseZX18= 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 :subject:from:reply-to:to:cc:in-reply-to:references:content-type :date:mime-version:content-transfer-encoding:message-id; s= default; bh=edLEbU4m5mzAHoNyalQoL6XbdzI=; b=g4WPac5qXNvnTfzBLlqE Jkaj7TWfTv21SP0d3U7hSjGMslcTm9L4pa3noGaECODsQT2ocyxtwt0fDpIe4Dnf bntx9ENgzjEF0SKEsi10QD/W0dl4aJFTwganD43oEstqWr2PpvhCPcDXiYUxqbm1 8cCdeCqCd4Loqxeqf7+6w/Q= Received: (qmail 105525 invoked by alias); 9 Aug 2017 14:39:20 -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 105503 invoked by uid 89); 9 Aug 2017 14:39:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Aug 2017 14:39:17 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v79Ecup7019565 for ; Wed, 9 Aug 2017 10:39:14 -0400 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0b-001b2d01.pphosted.com with ESMTP id 2c83dkv5fw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 09 Aug 2017 10:39:13 -0400 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Aug 2017 10:39:12 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 Aug 2017 10:39:09 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v79Ed9Lq23134364; Wed, 9 Aug 2017 14:39:09 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6DDBB204D; Wed, 9 Aug 2017 10:36:35 -0400 (EDT) Received: from [9.10.86.107] (unknown [9.10.86.107]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 6BBE3B2050; Wed, 9 Aug 2017 10:36:35 -0400 (EDT) Subject: [PATCH, rs6000] (v2) enable early debug and disable switch for gimple folding From: Will Schmidt Reply-To: will_schmidt@vnet.ibm.com To: GCC Patches Cc: Segher Boessenkool , Richard Biener , Bill Schmidt , David Edelsohn In-Reply-To: <1502226896.6577.12.camel@brimstone.rchland.ibm.com> References: <1502226896.6577.12.camel@brimstone.rchland.ibm.com> Date: Wed, 09 Aug 2017 09:39:08 -0500 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17080914-0036-0000-0000-000002561ED1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007513; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000218; SDB=6.00899846; UDB=6.00450443; IPR=6.00680052; BA=6.00005520; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016610; XFM=3.00000015; UTC=2017-08-09 14:39:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080914-0037-0000-0000-00004161A1FA Message-Id: <1502289548.6577.39.camel@brimstone.rchland.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-09_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708090228 X-IsSubscribed: yes Hi, [Patch, rs6000] (v2) enable early debug and disable switch for gimple folding Enable debug options related to gimple folding for the rs6000 target. Adds some output to the existing -mdebug=builtin option Add a -mgimple-folding=off option to disable the early rs6000 gimple folding. (V2 updates) Changed variable name to rs6000_fold_gimple. Changed option name to "fold-gimple", so -mfold-gimple and -mno-fold-gimple options both work smoothly. Whitespace updates as noted per review. I also fixed the (missing) space after cast for the existing debug code. OK for trunk? Thanks, -Will [gcc] 2017-08-09 Will Schmidt * config/rs6000/rs6000.c: (rs6000_option_override_internal) Add blurb to indicate when early gimple folding has been disabled. (rs6000_gimple_fold_builtin): Add debug content. (rs6000_invalid_builtin): whitespace. (rs6000_expand_builtin): Whitespace. * config/rs6000/rs6000.opt: Add option for -mfold-gimple. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 1fb9861..f970f9e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4180,10 +4180,14 @@ rs6000_option_override_internal (bool global_init_p) { warning (0, N_("-maltivec=le not allowed for big-endian targets")); rs6000_altivec_element_order = 0; } + if (!rs6000_fold_gimple) + fprintf (stderr, + "gimple folding of rs6000 builtins has been disabled.\n"); + /* Add some warnings for VSX. */ if (TARGET_VSX) { const char *msg = NULL; if (!TARGET_HARD_FLOAT || !TARGET_SINGLE_FLOAT || !TARGET_DOUBLE_FLOAT) @@ -16052,11 +16056,11 @@ paired_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target) appropriate target options being set. */ static void rs6000_invalid_builtin (enum rs6000_builtins fncode) { - size_t uns_fncode = (size_t)fncode; + size_t uns_fncode = (size_t) fncode; const char *name = rs6000_builtin_info[uns_fncode].name; HOST_WIDE_INT fnmask = rs6000_builtin_info[uns_fncode].mask; gcc_assert (name != NULL); if ((fnmask & RS6000_BTM_CELL) != 0) @@ -16157,10 +16161,26 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi) gcc_checking_assert (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD); enum rs6000_builtins fn_code = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl); tree arg0, arg1, lhs; + size_t uns_fncode = (size_t) fn_code; + enum insn_code icode = rs6000_builtin_info[uns_fncode].icode; + const char *fn_name1 = rs6000_builtin_info[uns_fncode].name; + const char *fn_name2 = ((icode != CODE_FOR_nothing) + ? get_insn_name ((int) icode) + : "nothing"); + + if (TARGET_DEBUG_BUILTIN) + { + fprintf (stderr, "rs6000_gimple_fold_builtin %d %s %s\n", + fn_code, fn_name1, fn_name2); + } + + if (!rs6000_fold_gimple) + return false; + /* Generic solution to prevent gimple folding of code without a LHS. */ if (!gimple_call_lhs (stmt)) return false; switch (fn_code) @@ -16516,10 +16536,13 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi) gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); update_call_from_tree (gsi, res); return true; } default: + if (TARGET_DEBUG_BUILTIN) + fprintf (stderr, "gimple builtin intrinsic not matched:%d %s %s \n", + fn_code, fn_name1, fn_name2); break; } return false; } @@ -16549,11 +16572,11 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, if (TARGET_DEBUG_BUILTIN) { enum insn_code icode = rs6000_builtin_info[uns_fcode].icode; const char *name1 = rs6000_builtin_info[uns_fcode].name; const char *name2 = ((icode != CODE_FOR_nothing) - ? get_insn_name ((int)icode) + ? get_insn_name ((int) icode) : "nothing"); const char *name3; switch (rs6000_builtin_info[uns_fcode].attr & RS6000_BTC_TYPE_MASK) { @@ -16569,11 +16592,11 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, fprintf (stderr, "rs6000_expand_builtin, %s (%d), insn = %s (%d), type=%s%s\n", (name1) ? name1 : "---", fcode, - (name2) ? name2 : "---", (int)icode, + (name2) ? name2 : "---", (int) icode, name3, func_valid_p ? "" : ", not valid"); } if (!func_valid_p) diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index e94aa07..65e4724 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -146,10 +146,14 @@ Generate AltiVec instructions using little-endian element order. maltivec=be Target Report RejectNegative Var(rs6000_altivec_element_order, 2) Generate AltiVec instructions using big-endian element order. +mfold-gimple +Target Report Var(rs6000_fold_gimple, 1) Init(1) +Enable early gimple folding of builtins. + mhard-dfp Target Report Mask(DFP) Var(rs6000_isa_flags) Use decimal floating point instructions. mmulhw