From patchwork Wed Dec 1 15:29:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1562242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=DZ3IIK8J; dkim-atps=neutral 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4J432B1qDgz9sCD for ; Thu, 2 Dec 2021 02:30:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55D093858035 for ; Wed, 1 Dec 2021 15:30:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55D093858035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638372639; bh=+W5HFmvPMUn1KSG4+cFJtTRQ6XL4w7cAaDqLPN0ofZo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=DZ3IIK8J5F73SACSgRjXeRsY8TG7GA4RT4xEvsj9C8hVQpuYxnJSoYekQV5+Q2I7g PUzKMmk9NZhjP5KhFpZuBdBlVvImhVkofqOWK1t/12CjZTlP/k/wXfmuVfHpd/AG9W pgX5zxPXmBYg52UUNsF06Fwz32eFjg3sDSMzfgus= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 4DD2D3857C40 for ; Wed, 1 Dec 2021 15:29:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4DD2D3857C40 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B1FBj6x002380; Wed, 1 Dec 2021 15:29:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cpb6m12p1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Dec 2021 15:29:47 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1B1FQxsc020242; Wed, 1 Dec 2021 15:29:47 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cpb6m12nh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Dec 2021 15:29:47 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1B1FCnXl001684; Wed, 1 Dec 2021 15:29:46 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma02dal.us.ibm.com with ESMTP id 3cn5eyycys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Dec 2021 15:29:46 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1B1FTibl57344426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Dec 2021 15:29:45 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0A6611206F; Wed, 1 Dec 2021 15:29:44 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12A48112064; Wed, 1 Dec 2021 15:29:44 +0000 (GMT) Received: from [9.211.97.109] (unknown [9.211.97.109]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 1 Dec 2021 15:29:43 +0000 (GMT) Message-ID: Date: Wed, 1 Dec 2021 09:29:42 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 To: GCC Patches Subject: [PATCH] rs6000: Mirror fix for PR102347 into the new builtins support X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NeNNDx0Gy6qeDSumoKx8d36iE-4PLzkm X-Proofpoint-GUID: 34DNPvivRcm1VW6F-XjqtDe5_MoHaQsc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_10,2021-12-01_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 impostorscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112010086 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: "Li, Pan2 via Gcc-patches" Reply-To: wschmidt@linux.ibm.com Cc: David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Recently Kewen fixed a problem in the old builtins support where rs6000_builtin_decl prematurely indicated that a target builtin is unavailable. This also needs to be done for the new builtins support, but in this case we have to ensure the error message is still produced from the overload support in rs6000-c.c. Unfortunately, this is less straightforward than it could be, because header file includes need to be adjusted to make this happen. Someday we'll consolidate all the builtin code in one file and this won't have to be so ugly. Bootstrapped and tested on powerpc64le-linux-gnu with no regressions. Is this okay for trunk? Thanks! Bill 2021-12-01 Bill Schmidt gcc/ PR target/102347 * config/rs6000/rs6000-c.c (rs6000-builtins.h): Stop including. (rs6000-internal.h): Include. (altivec_resolve_new_overloaded_builtin): Move call to rs6000_invalid_new_builtin here from rs6000_new_builtin_decl. * config/rs6000/rs6000-call.c (rs6000-builtins.h): Stop including. (rs6000_invalid_new_builtin): Remove static qualifier. (rs6000_new_builtin_decl): Remove test for supported builtin. * config/rs6000/rs6000-internal.h (rs6000-builtins.h): Include. (rs6000_invalid_new_builtin): Declare. * config/rs6000/rs6000.c (rs6000-builtins.h): Don't include. --- gcc/config/rs6000/rs6000-c.c | 11 +++++++---- gcc/config/rs6000/rs6000-call.c | 9 +-------- gcc/config/rs6000/rs6000-internal.h | 3 +++ gcc/config/rs6000/rs6000.c | 1 - 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 5eeac9d4c06..8e83d97e72f 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -35,7 +35,7 @@ #include "langhooks.h" #include "c/c-tree.h" -#include "rs6000-builtins.h" +#include "rs6000-internal.h" static tree altivec_resolve_new_overloaded_builtin (location_t, tree, void *); @@ -2987,11 +2987,14 @@ altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl, const char *name = rs6000_overload_info[adj_fcode].ovld_name; if (!supported) { + /* Indicate that the instantiation of the overloaded builtin + name is not available with the target flags in effect. */ + rs6000_gen_builtins fcode = (rs6000_gen_builtins) instance->bifid; + rs6000_invalid_new_builtin (fcode); + /* Provide clarity of the relationship between the overload + and the instantiation. */ const char *internal_name = rs6000_builtin_info_x[instance->bifid].bifname; - /* An error message making reference to the name of the - non-overloaded function has already been issued. Add - clarification of the previous message. */ rich_location richloc (line_table, input_location); inform (&richloc, "overloaded builtin %qs is implemented by builtin %qs", diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index cd477fa4876..01688c4169d 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -69,7 +69,6 @@ #include "opts.h" #include "rs6000-internal.h" -#include "rs6000-builtins.h" #if TARGET_MACHO #include "gstab.h" /* for N_SLINE */ @@ -11905,7 +11904,7 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode) /* Raise an error message for a builtin function that is called without the appropriate target options being set. */ -static void +void rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode) { size_t j = (size_t) fncode; @@ -16624,12 +16623,6 @@ rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */) if (fcode >= RS6000_OVLD_MAX) return error_mark_node; - if (!rs6000_new_builtin_is_supported (fcode)) - { - rs6000_invalid_new_builtin (fcode); - return error_mark_node; - } - return rs6000_builtin_decls_x[code]; } diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h index 88cf9bd5692..a880fd37618 100644 --- a/gcc/config/rs6000/rs6000-internal.h +++ b/gcc/config/rs6000/rs6000-internal.h @@ -22,6 +22,8 @@ #ifndef GCC_RS6000_INTERNAL_H #define GCC_RS6000_INTERNAL_H +#include "rs6000-builtins.h" + /* Structure used to define the rs6000 stack */ typedef struct rs6000_stack { int reload_completed; /* stack info won't change from here on */ @@ -140,6 +142,7 @@ extern void rs6000_output_mi_thunk (FILE *file, extern bool rs6000_output_addr_const_extra (FILE *file, rtx x); extern bool rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi); extern tree rs6000_build_builtin_va_list (void); +extern void rs6000_invalid_new_builtin (rs6000_gen_builtins fncode); extern void rs6000_va_start (tree valist, rtx nextarg); extern tree rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 289c1b3df24..945157b1c1a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -78,7 +78,6 @@ #include "case-cfn-macros.h" #include "ppc-auxv.h" #include "rs6000-internal.h" -#include "rs6000-builtins.h" #include "opts.h" /* This file should be included last. */