From patchwork Tue Sep 28 08:13:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1533768 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=IVWShEmt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4HJXNd6Vkqz9t2G for ; Tue, 28 Sep 2021 18:14:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 30DB3385800C for ; Tue, 28 Sep 2021 08:14:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30DB3385800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632816878; bh=uZrNNKq9b0NcceU/zP3xfnWXTZr/ELImR7vs/lXhwzQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=IVWShEmt/4Uk1hxH6Dh5eItyKnSUnEIEf+FGcosQeIlwtmo2JJs3924XB5vsCPX+z AsQq8FN3AIQJb+HjMi5oJcut7dt4ASSpRcNDi2Uk9FvLL4TTk191y2qHteNEC38F1M o+wizLXuyYEBdYoqxblGky/++VB8gFjBBKEQHzaY= 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 138E3385840A for ; Tue, 28 Sep 2021 08:13:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 138E3385840A Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18S6PVBY003356; Tue, 28 Sep 2021 04:13:50 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bbws627j2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Sep 2021 04:13:50 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18S6VBuR020744; Tue, 28 Sep 2021 04:13:49 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bbws627hk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Sep 2021 04:13:49 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18S8C1k1016347; Tue, 28 Sep 2021 08:13:47 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma01fra.de.ibm.com with ESMTP id 3b9ud9j0et-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Sep 2021 08:13:47 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18S88i6s55968096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Sep 2021 08:08:44 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A307AE053; Tue, 28 Sep 2021 08:13:44 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87ED0AE05D; Tue, 28 Sep 2021 08:13:42 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.52.49]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Sep 2021 08:13:42 +0000 (GMT) To: GCC Patches Subject: [PATCH] rs6000: Remove builtin mask check from builtin_decl [PR102347] Message-ID: <7505a666-7b51-255c-9908-aabc753f7c33@linux.ibm.com> Date: Tue, 28 Sep 2021 16:13:40 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: j6lCssOm9HSva_29n7tZ5o14tPmTIA-I X-Proofpoint-GUID: Nutr_P78F7e5sxkF94s9zBDXePSp7hab X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-28_04,2021-09-28_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109280047 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Bill Schmidt , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, As the discussion in PR102347, currently builtin_decl is invoked so early, it's when making up the function_decl for builtin functions, at that time the rs6000_builtin_mask could be wrong for those builtins sitting in #pragma/attribute target functions, though it will be updated properly later when LTO processes all nodes. This patch is to align with the practice i386 port adopts, also align with r10-7462 by relaxing builtin mask checking in some places. Bootstrapped and regress-tested on powerpc64le-linux-gnu P9 and powerpc64-linux-gnu P8. Is it ok for trunk? BR, Kewen ----- gcc/ChangeLog: PR target/102347 * config/rs6000/rs6000-call.c (rs6000_builtin_decl): Remove builtin mask check. gcc/testsuite/ChangeLog: PR target/102347 * gcc.target/powerpc/pr102347.c: New test. --- gcc/config/rs6000/rs6000-call.c | 14 ++++---------- gcc/testsuite/gcc.target/powerpc/pr102347.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr102347.c -- 2.27.0 diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index fd7f24da818..15e0e09c07d 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -13775,23 +13775,17 @@ rs6000_init_builtins (void) } } -/* Returns the rs6000 builtin decl for CODE. */ +/* Returns the rs6000 builtin decl for CODE. Note that we don't check + the builtin mask here since there could be some #pragma/attribute + target functions and the rs6000_builtin_mask could be wrong when + this checking happens, though it will be updated properly later. */ tree rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) { - HOST_WIDE_INT fnmask; - if (code >= RS6000_BUILTIN_COUNT) return error_mark_node; - fnmask = rs6000_builtin_info[code].mask; - if ((fnmask & rs6000_builtin_mask) != fnmask) - { - rs6000_invalid_builtin ((enum rs6000_builtins)code); - return error_mark_node; - } - return rs6000_builtin_decls[code]; } diff --git a/gcc/testsuite/gcc.target/powerpc/pr102347.c b/gcc/testsuite/gcc.target/powerpc/pr102347.c new file mode 100644 index 00000000000..05c439a8dac --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr102347.c @@ -0,0 +1,15 @@ +/* { dg-do link } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-require-effective-target lto } */ +/* { dg-options "-flto -mdejagnu-cpu=power9" } */ + +/* Verify there are no error messages in LTO mode. */ + +#pragma GCC target "cpu=power10" +int main () +{ + float *b; + __vector_quad c; + __builtin_mma_disassemble_acc (b, &c); + return 0; +}