From patchwork Tue Feb 4 02:26:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 1233103 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518830-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=pW/1/bBJ; 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 48BT9B74Y8z9sX3 for ; Tue, 4 Feb 2020 13:26:54 +1100 (AEDT) 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:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=NJwfPHWVTIszAH6TveW GKtiHMrBQrXdwp3w2DNtnDxTfXReteHdwA+SWutCtJiksI889i34XRmKZCZI+54+ nTQ+ndQwlhZS578TnE9f2wsQMPdVtxo+y3JOzdjZEBOAaOLt0ANW+4QwjV3w6avg ezpjNAlr8jRV0fhv5x0ukArE= 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:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; s=default; bh=2a0qxuykN/cQWbwogB9Yhvo1W Og=; b=pW/1/bBJ4P3ulH5oOjRhzba2TOX6ciQTURS4Itgw3sGlE2TOv9ztGrSow zYzjcvj9T62FKfQA2VCycgoDaoM5Mj9VJ2zbz791D6iqPWyt7YHXwJgkEgyXXkAy XkHDVSGhoi82x7Vv7UyR/11AwbO234qjFSi60ACkBwAVTSEin0= Received: (qmail 62469 invoked by alias); 4 Feb 2020 02:26:47 -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 62416 invoked by uid 89); 4 Feb 2020 02:26:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=recognition, angle X-HELO: mx0b-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0b-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Feb 2020 02:26:44 +0000 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0142MZJP034384; Mon, 3 Feb 2020 21:26:42 -0500 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 2xxp56fcqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Feb 2020 21:26:42 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 0142Q3OQ013914; Tue, 4 Feb 2020 02:26:41 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01dal.us.ibm.com with ESMTP id 2xw0y6k7tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 Feb 2020 02:26:41 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0142QeJ049414440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 4 Feb 2020 02:26:40 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7971C6057; Tue, 4 Feb 2020 02:26:39 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3196C6055; Tue, 4 Feb 2020 02:26:39 +0000 (GMT) Received: from localhost (unknown [9.40.194.84]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 4 Feb 2020 02:26:39 +0000 (GMT) From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org Subject: [PATCH 01/14] Initial create of rs6000-genbif.c. Date: Mon, 3 Feb 2020 20:26:02 -0600 Message-Id: <02715c0fbae6d6c4332c6effe939acc9c0df9a4d.1580782131.git.wschmidt@linux.ibm.com> In-Reply-To: References: In-Reply-To: References: Includes header documentation and initial set of include directives. 2020-02-03 Bill Schmidt * config/rs6000/rs6000-genbif.c: New file. --- gcc/config/rs6000/rs6000-genbif.c | 124 ++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 gcc/config/rs6000/rs6000-genbif.c diff --git a/gcc/config/rs6000/rs6000-genbif.c b/gcc/config/rs6000/rs6000-genbif.c new file mode 100644 index 00000000000..a53209ed040 --- /dev/null +++ b/gcc/config/rs6000/rs6000-genbif.c @@ -0,0 +1,124 @@ +/* Generate built-in function initialization and recognition for Power. + Copyright (C) 2020 Free Software Foundation, Inc. + Contributed by Bill Schmidt, IBM + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This program generates built-in function initialization and + recognition code for Power targets, based on text files that + describe the built-in functions and vector overloads: + + rs6000-bif.def Table of built-in functions + rs6000-overload.def Table of overload functions + + Both files group similar functions together in "stanzas," as + described below. + + Each stanza in the built-in function file starts with a line + identifying the target mask for which the group of functions is + permitted, with the mask in square brackets. This is the only + information allowed on the stanza header line, other than + whitespace. Following the stanza header are two lines for each + function: the prototype line and the attributes line. The + prototype line has this format, where the square brackets + indicate optional information and angle brackets indicate + required information: + + [kind] (); + + Here [kind] can be one of "const", "pure", or "math"; + is a legal type for a built-in function result; + is the name by which the function can be called; + and is a comma-separated list of legal types + for built-in function arguments. The argument list may be + empty, but the parentheses and semicolon are required. + + The attributes line looks like this: + + {} + + Here is a unique internal identifier for the built-in + function that will be used as part of an enumeration of all + built-in functions; is the define_expand or + define_insn that will be invoked when the call is expanded; + and is a comma-separated list of special + conditions that apply to the built-in function. The attribute + list may be empty, but the braces are required. + + Attributes are strings, such as these: + + init Process as a vec_init function + set Process as a vec_set function + ext Process as a vec_extract function + nosoft Not valid with -msoft-float + ldv Needs special handling for vec_ld semantics + stv Needs special handling for vec_st semantics + reve Needs special handling for element reversal + abs Needs special handling for absolute value + pred Needs special handling for comparison predicates + htm Needs special handling for transactional memory + + An example stanza might look like this: + +[TARGET_ALTIVEC] + const vector signed char __builtin_altivec_abs_v16qi (vector signed char); + ABS_V16QI absv16qi2 {abs} + const vector signed short __builtin_altivec_abs_v8hi (vector signed short); + ABS_V8HI absv8hi2 {abs} + + Note the use of indentation, which is recommended but not required. + + The overload file has more complex stanza headers. Here the stanza + represents all functions with the same overloaded function name: + + [, , ] + + Here the square brackets are part of the syntax, is a + unique internal identifier for the overload that will be used as part + of an enumeration of all overloaded functions; is the + name that will appear as a #define in altivec.h; and + is the name that is overloaded in the back end. + + Each function entry again has two lines. The first line is again a + prototype line (this time without [kind]): + + (); + + The second line contains only one token: the that this + particular instance of the overloaded function maps to. It must + match a token that appears in the bif file. + + An example stanza might look like this: + +[VEC_ABS, vec_abs, __builtin_vec_abs] + vector signed char __builtin_vec_abs (vector signed char); + ABS_V16QI + vector signed short __builtin_vec_abs (vector signed short); + ABS_V8HI + + Blank lines may be used as desired in these files. If it's desirable, + C-style comments are allowable provided that the file is run through + the preprocessor by the build system prior to feeding it to this + program. */ + +#include +#include +#include +#include +#include +#include +#include