From patchwork Wed Mar 11 19:00:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1253145 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=8.43.85.97; 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=drFABh12; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 48d1WG506nz9sQx for ; Thu, 12 Mar 2020 06:00:41 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38C4D39450F1; Wed, 11 Mar 2020 19:00:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38C4D39450F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1583953238; bh=tVaNlMkd9Fia1eAeWxV/GrH6zPWKV/hq/6fB+STQQTI=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=drFABh12iYA9xVeFl7K2Ry9j71CTu5VZ2Lm9fjf7ioYkvGYAOuEjKsHsBEIV09i3m L9FuG+G2A926lfGglU5/R7JnP8CIwcUuvVk77ThRCMGbvZnYvKByXV+4kvDfLeflS6 x49QraWnHbQxkdqUJWuRFbd3Bbztveq0UW8A0iM0= 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 3953C394202A for ; Wed, 11 Mar 2020 19:00:36 +0000 (GMT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02BIqEcM175675; Wed, 11 Mar 2020 15:00:35 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yq5bh14cg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 15:00:32 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02BIqJNZ175794; Wed, 11 Mar 2020 15:00:27 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yq5bh143h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 15:00:26 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02BIvVfk008398; Wed, 11 Mar 2020 19:00:15 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma04dal.us.ibm.com with ESMTP id 2ypjxr8tc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 19:00:15 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02BJ0EFw44302604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Mar 2020 19:00:14 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95999AE073; Wed, 11 Mar 2020 19:00:14 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FAFAAE06B; Wed, 11 Mar 2020 19:00:14 +0000 (GMT) Received: from oc3304648336.ibm.com (unknown [9.70.82.41]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 11 Mar 2020 19:00:13 +0000 (GMT) Message-ID: <52a9b704f61e4780cd78d86c8ef25d356b378450.camel@us.ibm.com> Subject: [PATCH,rs6000] Add command line and builtin compatibility To: Segher Boessenkool , gcc-patches@gcc.gnu.org, David Edelsohn Date: Wed, 11 Mar 2020 12:00:12 -0700 X-Mailer: Evolution 3.28.5 (3.28.5-5.el7) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-03-11_09:2020-03-11, 2020-03-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003110106 X-Spam-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS 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: Carl Love via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: Carl Love Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" GCC maintianers: The following patch add a check to make sure the user did not specify -mno_fprnd with the builtins __builtin_vsx_xsrdpim and __builtin_vsx_xsrdpip. These builtins are incompatible with the -mno_fprnd command line. The check prevents GCC crashing under these conditions. Manually tested the patch on powerpc64le-unknown-linux-gnu (Power 8 LE) powerpc64le-unknown-linux-gnu (Power 9 LE) as follows: gcc -mno-fprnd -g -c vsx-builtin-3.c vsx-builtin-3.c: In function ‘do_math’: vsx-builtin-3.c:145:3: error: __builtin_vsx_xsrdpim is incompatible with mno-fprnd option 145 | z[i][0] = __builtin_vsx_xsrdpim (z[i][1]); i++; | ^ vsx-builtin-3.c:146:3: error: __builtin_vsx_xsrdpip is incompatible with mno-fprnd option 146 | z[i][0] = __builtin_vsx_xsrdpip (z[i][1]); i++; | ^ I read thru the source code looking for other builtins with the same issue. I also created a script to compile all of the tests in gcc/testsuite/gcc.target/powerpc with the -mno-fprnd option to check for additional builtins that are incompatible with the -mno-fprnd option. These were the only two builtins that were identified as being incompatible with the -mno-fprnd option. Please let me know if the patch looks OK for mainline. Thanks. Carl Love ----------------------------------------------------------------------- rs6000: Add command line and builtin compatibility check PR/target 87583 gcc/ChangeLog 2020-03-10 Carl Love * gcc/config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add check for TARGET_FRND and VSX_BUILTIN_XSRDPIM, VSX_BUILTIN_XSRDPIP compatibility. --- gcc/config/rs6000/rs6000-c.c | 8 ++++++++ 1 file changed, 8 insertions(+) return NULL_TREE; diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000- c.c index 8c1fbbf..6820782 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -915,6 +915,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, const struct altivec_builtin_types *desc; unsigned int n; + /* Check builtin for command line argument conflicts. */ + if (!TARGET_FPRND && + (fcode == VSX_BUILTIN_XSRDPIM || fcode == VSX_BUILTIN_XSRDPIP)) { + error ("%s is incompatible with mno-fprnd option", + IDENTIFIER_POINTER (DECL_NAME (fndecl))); + return error_mark_node; + } + if (!rs6000_overloaded_builtin_p (fcode))