From patchwork Wed Jun 17 19:46:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 1311456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=KouMAjdo; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49nFwz5GVFz9sR4 for ; Thu, 18 Jun 2020 05:48:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DAEC639D8017; Wed, 17 Jun 2020 19:47:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAEC639D8017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592423275; bh=HfbL3/rYbp6jP3UZb6BwuX9ZvCQfccdTAS4be/RuoZY=; h=To:Subject:Date:In-Reply-To:References:In-Reply-To:References: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=KouMAjdo2gIbNUzOyXOGL29bpCPO5Vd7f8bMgJGtgwBlJuZGN4riGU1Eqbo8kEKQ0 Gk/zIDAKxodvKBKn6omaCeYtgfqaR8sHt3zNGSPBVOUredVxhI0BWXqucSYgVIlWpQ lRHXu1qqwTrxXGlnd91iXHT2zGC6VfldRmMs10Uk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 41BD03997830 for ; Wed, 17 Jun 2020 19:47:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 41BD03997830 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05HJWUl9008205; Wed, 17 Jun 2020 15:47:51 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 31qg5t7yc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2020 15:47:51 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05HJWvDk009419; Wed, 17 Jun 2020 15:47:51 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 31qg5t7ybv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2020 15:47:50 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05HJiGCI024124; Wed, 17 Jun 2020 19:47:50 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01dal.us.ibm.com with ESMTP id 31q9v65w7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2020 19:47:50 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05HJlnim53477766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jun 2020 19:47:49 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 431E528059; Wed, 17 Jun 2020 19:47:49 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20CDA28058; Wed, 17 Jun 2020 19:47:49 +0000 (GMT) Received: from localhost (unknown [9.40.194.84]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 17 Jun 2020 19:47:49 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 18/28] rs6000: Write output to the builtins init file, part 2 of 3 Date: Wed, 17 Jun 2020 14:46:41 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-17_10:2020-06-17, 2020-06-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 clxscore=1015 suspectscore=1 phishscore=0 adultscore=0 cotscore=-2147483648 mlxlogscore=999 bulkscore=0 spamscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006170144 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bill Schmidt via Gcc-patches From: Bill Schmidt Reply-To: Bill Schmidt Cc: dje.gcc@gmail.com, segher@kernel.crashing.org, willschm@linux.ibm.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 2020-06-17 Bill Schmidt * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table): Implement. --- gcc/config/rs6000/rs6000-gen-builtins.c | 166 ++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c index 2031ad22335..746405e4341 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -2004,6 +2004,172 @@ write_header_file () static void write_init_bif_table () { + const char *attr_string; + + for (int i = 0; i <= curr_bif; i++) + { + const char *bif_mask = bif_stanzas[bifs[i].stanza]; + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].bifname" + "\n = \"%s\";\n", + bifs[i].idname, bifs[i].proto.bifname); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].mask" + "\n = %s;\n", + bifs[i].idname, bif_mask); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].fntype" + "\n = %s;\n", + bifs[i].idname, bifs[i].fndecl); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].nargs" + "\n = %d;\n", + bifs[i].idname, bifs[i].proto.nargs); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].icode" + "\n = CODE_FOR_%s;\n", + bifs[i].idname, bifs[i].patname); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].bifattrs" + "\n = 0", + bifs[i].idname); + if (bifs[i].attrs.isinit) + fprintf (init_file, " | bif_init_bit"); + if (bifs[i].attrs.isset) + fprintf (init_file, " | bif_set_bit"); + if (bifs[i].attrs.isextract) + fprintf (init_file, " | bif_extract_bit"); + if (bifs[i].attrs.isnosoft) + fprintf (init_file, " | bif_nosoft_bit"); + if (bifs[i].attrs.isldvec) + fprintf (init_file, " | bif_ldvec_bit"); + if (bifs[i].attrs.isstvec) + fprintf (init_file, " | bif_stvec_bit"); + if (bifs[i].attrs.isreve) + fprintf (init_file, " | bif_reve_bit"); + if (bifs[i].attrs.ispred) + fprintf (init_file, " | bif_pred_bit"); + if (bifs[i].attrs.ishtm) + fprintf (init_file, " | bif_htm_bit"); + if (bifs[i].attrs.ishtmspr) + fprintf (init_file, " | bif_htmspr_bit"); + if (bifs[i].attrs.ishtmcr) + fprintf (init_file, " | bif_htmcr_bit"); + if (bifs[i].attrs.isno32bit) + fprintf (init_file, " | bif_no32bit_bit"); + if (bifs[i].attrs.iscpu) + fprintf (init_file, " | bif_cpu_bit"); + if (bifs[i].attrs.isldstmask) + fprintf (init_file, " | bif_ldstmask_bit"); + fprintf (init_file, ";\n"); + for (int j = 0; j < 1; j++) + { + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].restr_opnd[%d]" + "\n = %d;\n", + bifs[i].idname, j, bifs[i].proto.restr_opnd[j]); + if (bifs[i].proto.restr_opnd[j]) + { + const char *res + = (bifs[i].proto.restr[j] == RES_BITS ? "RES_BITS" + : (bifs[i].proto.restr[j] == RES_RANGE ? "RES_RANGE" + : (bifs[i].proto.restr[j] == RES_VALUES ? "RES_VALUES" + : (bifs[i].proto.restr[j] == RES_VAR_RANGE + ? "RES_VAR_RANGE" : "ERROR")))); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].restr[%d]" + "\n = %s;\n", + bifs[i].idname, j, res); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].restr_val1[%d]" + "\n = %d;\n", + bifs[i].idname, j, bifs[i].proto.restr_val1[j]); + fprintf (init_file, + " rs6000_builtin_info_x[RS6000_BIF_%s].restr_val2[%d]" + "\n = %d;\n", + bifs[i].idname, j, bifs[i].proto.restr_val2[j]); + } + fprintf (init_file, "\n"); + } + + fprintf (init_file, + " bifaddr = &rs6000_builtin_info_x[RS6000_BIF_%s];\n", + bifs[i].idname); + fprintf (init_file, + " hash = rs6000_bif_hasher::hash (bifaddr);\n"); + fprintf (init_file, + " slot = bif_hash.find_slot_with_hash (\n"); + fprintf (init_file, + " \"%s\", hash, INSERT\n", + bifs[i].proto.bifname); + fprintf (init_file, + " );\n"); + fprintf (init_file, + " *slot = bifaddr;\n\n"); + + fprintf (init_file, + " if (new_builtins_are_live &&\n"); + if (strcmp (bif_mask, "MASK_ALTIVEC") + && strcmp (bif_mask, "MASK_VSX")) + { + fprintf (init_file, " (%s & builtin_mask)\n", bif_mask); + fprintf (init_file, " == %s)\n", bif_mask); + } + else + { + fprintf (init_file, + " (TARGET_EXTRA_BUILTINS\n"); + fprintf (init_file, + " || (%s & builtin_mask)\n", bif_mask); + fprintf (init_file, " == %s))\n", bif_mask); + } + fprintf (init_file, " {\n"); + fprintf (init_file, + " rs6000_builtin_decls[(int)RS6000_BIF_%s] = t\n", + bifs[i].idname); + fprintf (init_file, + " = add_builtin_function (\"%s\",\n", + bifs[i].proto.bifname); + fprintf (init_file, + " %s,\n", + bifs[i].fndecl); + fprintf (init_file, + " (int)RS6000_BIF_%s," + " BUILT_IN_MD,\n", + bifs[i].idname); + fprintf (init_file, + " NULL, NULL_TREE);\n"); + if (bifs[i].kind == FNK_CONST) + { + fprintf (init_file, " TREE_READONLY (t) = 1;\n"); + fprintf (init_file, " TREE_NOTHROW (t) = 1;\n"); + attr_string = ", const"; + } + else if (bifs[i].kind == FNK_PURE) + { + fprintf (init_file, " DECL_PURE_P (t) = 1;\n"); + fprintf (init_file, " TREE_NOTHROW (t) = 1;\n"); + attr_string = ", pure"; + } + else if (bifs[i].kind == FNK_FPMATH) + { + fprintf (init_file, " TREE_NOTHROW (t) = 1;\n"); + fprintf (init_file, " if (flag_rounding_math)\n"); + fprintf (init_file, " {\n"); + fprintf (init_file, " DECL_PURE_P (t) = 1;\n"); + fprintf (init_file, " DECL_IS_NOVOPS (t) = 1;\n"); + fprintf (init_file, " }\n"); + attr_string = ", fp, const"; + } + else + attr_string = ""; + + fprintf (init_file, " if (TARGET_DEBUG_BUILTIN)\n"); + fprintf (init_file, " fprintf (stderr, \"rs6000_builtin" + ", code = %4d, \"\n \"%s%s\\n\");\n", + i, bifs[i].proto.bifname, attr_string); + fprintf (init_file, " }\n\n"); + } } /* Write code to initialize the overload table. */