From patchwork Sat Aug 27 18:36:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp757132wro; Sat, 27 Aug 2022 11:37:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4S0U1VNwFiHvbR3DTb9w8DNvQ+J8sfOfXtbY/uftdHiRytK6YagoEaG5J/E9L7muw8ei1t X-Received: by 2002:a05:6402:d05:b0:425:b7ab:776e with SMTP id eb5-20020a0564020d0500b00425b7ab776emr11435683edb.142.1661625421415; Sat, 27 Aug 2022 11:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661625421; cv=none; d=google.com; s=arc-20160816; b=GOE2yomqHpcV8+nKvRnjFWSD4PUVjZ0n/BS/0X0JUsMQm0jejMQxfCMDRDIsx8pz31 w/+xDMhtTbK4PKDIBQ4tvXlqKO/h4ys9QdY590quhLWcIFEzr3e5ah4Q8KBViQhqG2tp s8EiWoR1FMOrIeO8al3RwHWtRGbgx8Z62USkt3jMMexPhRBJeWYDIZA4oDZ4oPIx6WC6 ip5aAnw6kcPHR+vmAb3qehbct/Z9u1kU2hdQQiXnNdc5Kf/VojfZb6pRKl5ARk3rydv5 xbglholj7cS+RpzUY/Z09WwFqln7A453nll/T1Q2UMbZW7vSPlYCSp1wcS79kwtqRtPb ka6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=BVfMvjWOmaHdEENm0kjJktfHbxwf+NfCjQfHCRvfzkY=; b=HWebhdHVpIgIqaLC6vbflREJNc96a6j5q3lKI+dYM7PMEMY+PddhON1ivR5LOkwyod lMPpYXjmkr6FBxVEYRFIbtynVsLtSK/VVhFHCDK4+7IPZDlkABe6LQXpXC8gz+y2rg9z Jv09lgYNHBlJVNqcxhcr4t16wBlzl2M5KR61IEziTF1++sXL3Ie9qWk/5/Xm7wd7thnL OSFj6pRedwvyFlz3QeBBctM6shpNIU0DWjeVG0ztjJ2H/53zJOz/CX0JPMWaRi35Ubdd EKKjX6k7n9hlqJ3ofkwnpPSpkAwnGR6DyQBVJXUCabknaQLCZCXbb/rmgn2/4RHozVj6 Jsow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=se40P08n; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y19-20020a50e613000000b0044615ee1b6fsi3105225edm.218.2022.08.27.11.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Aug 2022 11:37:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=se40P08n; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24154381E097 for ; Sat, 27 Aug 2022 18:37:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24154381E097 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661625420; bh=BVfMvjWOmaHdEENm0kjJktfHbxwf+NfCjQfHCRvfzkY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=se40P08nbvHCZNyFclmxOmlxeyi6gXlteKa2o02IlHLL08vUmPpDSwxaJMhQEjlSL a0uf8zu2vFSeicWZkIHJ1c/8nXQwiv3vH9VYky1b7T8iGl9G0dpqShUEm4YqHNXFbI eEmNszKSLr9Ocuf7E30FlLsjSDQu1FWZ4u0wejiE= 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 0F5BC3858429 for ; Sat, 27 Aug 2022 18:36:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0F5BC3858429 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27REjZ7E008444; Sat, 27 Aug 2022 18:36:10 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j7naj3cu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 27 Aug 2022 18:36:10 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27RIL0xQ023008; Sat, 27 Aug 2022 18:36:09 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma01wdc.us.ibm.com with ESMTP id 3j7aw8ucvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 27 Aug 2022 18:36:09 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27RIa8B550463134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Aug 2022 18:36:08 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4983328059; Sat, 27 Aug 2022 18:36:08 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 001642805C; Sat, 27 Aug 2022 18:36:07 +0000 (GMT) Received: from [9.160.4.32] (unknown [9.160.4.32]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Sat, 27 Aug 2022 18:36:07 +0000 (GMT) Message-ID: Date: Sat, 27 Aug 2022 13:36:07 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: en-US To: Segher Boessenkool Subject: [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017] X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: mkPMjtNSaTK-V-DcUKn2_7c8Mld0z1Sc X-Proofpoint-GUID: mkPMjtNSaTK-V-DcUKn2_7c8Mld0z1Sc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-27_10,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208270069 X-Spam-Status: No, score=-10.4 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Peter Bergner via Gcc-patches From: Peter Bergner Reply-To: Peter Bergner Cc: GCC Patches Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742340537951322145?= X-GMAIL-MSGID: =?utf-8?q?1742340537951322145?= GCC incorrectly disables conversions between MMA pointer types, which are allowed with clang. The original intent was to disable conversions between MMA types and other other types, but pointer conversions should have been allowed. The fix is to just remove the MMA pointer conversion handling code altogether. This passed bootstrap and regtesting on powerpc64le-linux with no regressions. Ok for trunk and backports after some burn-in time? Peter gcc/ PR target/106017 * config/rs6000/rs6000.cc (rs6000_invalid_conversion): Remove handling of MMA pointer conversions. gcc/testsuite/ PR target/106017 * gcc.target/powerpc/pr106017.c: New test. diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index df491bee2ea..2f3146e56f8 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -28188,28 +28188,6 @@ rs6000_invalid_conversion (const_tree fromtype, const_tree totype) if (tomode == OOmode) return N_("invalid conversion to type %<__vector_pair%>"); } - else if (POINTER_TYPE_P (fromtype) && POINTER_TYPE_P (totype)) - { - /* We really care about the modes of the base types. */ - frommode = TYPE_MODE (TREE_TYPE (fromtype)); - tomode = TYPE_MODE (TREE_TYPE (totype)); - - /* Do not allow conversions to/from XOmode and OOmode pointer - types, except to/from void pointers. */ - if (frommode != tomode - && frommode != VOIDmode - && tomode != VOIDmode) - { - if (frommode == XOmode) - return N_("invalid conversion from type %<__vector_quad *%>"); - if (tomode == XOmode) - return N_("invalid conversion to type %<__vector_quad *%>"); - if (frommode == OOmode) - return N_("invalid conversion from type %<__vector_pair *%>"); - if (tomode == OOmode) - return N_("invalid conversion to type %<__vector_pair *%>"); - } - } /* Conversion allowed. */ return NULL; diff --git a/gcc/testsuite/gcc.target/powerpc/pr106017.c b/gcc/testsuite/gcc.target/powerpc/pr106017.c new file mode 100644 index 00000000000..46d6c7a4a33 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr106017.c @@ -0,0 +1,19 @@ +/* PR target/106017 */ +/* { dg-options "-O1 -mdejagnu-cpu=power10" } */ +/* { dg-require-effective-target power10_ok } */ + +/* Make sure we do not flag any errors on the following test cases. */ + +void takeacc(__vector_quad *); +void +foo (void) +{ + __vector_quad arr[4]; + takeacc (arr); +} + +unsigned char * +bar (__vector_quad *a) +{ + return (unsigned char *)a; +}