From patchwork Thu Sep 22 01:41:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp2217796wrt; Wed, 21 Sep 2022 18:42:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kzEnHq0BCueOJ17N1/uo7xGfpP2loKhI0wOr9RCpydULoDe/YI1XfnRJBKZCwgAPGKAUM X-Received: by 2002:a17:906:fe44:b0:77c:e313:a8e8 with SMTP id wz4-20020a170906fe4400b0077ce313a8e8mr857814ejb.700.1663810950815; Wed, 21 Sep 2022 18:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663810950; cv=none; d=google.com; s=arc-20160816; b=fkKVbPYLC/ule+z8ONlCr8du1KE7yad+/MXlW7UvM5AK7RdQnYgn/z3aD80AeFqlDR SasckXJyRQTeXjwLSk2/93fKEVNhdHzcwOJV23w35sTS0Gt5yC50/JG1X8gFAWSawL1o gNX9qtPPSrOfYWo/JMoCthAPj788YPbxnFm4xF8hOHToXQsGzFaBq2AG6hoYvmUBj3UF KjoXnnDe+pTL/vnwzu32jKICtlZn8bvfjYHBqd69R9ZvsuicGn3RRfXHjM7357mNr9nm H/6UWXr52E13KElVbVASZthdxYwUG6yXD19/UzpCfRXQ7A3TYL6N6ZHi24zzkBGHb/S2 eUKQ== 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:to:subject:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=mmFP9nM+u8VD8eIvX1Beu7oUQ7pTZjLETFy5x8LqP9I=; b=Dctm7z+i0zbVfiNMFj5D7zYNpRcgmRpdJ1rtUr+4xmQFpqqTbTvTjlu6Tsw4VccdW/ sZEQ3Y0AV4Q7sFtJeflxQXsypJvj4fgfxKF3U4C5Z8yczjRvqp7c8WHnP5efitHfGW2d GpGPPWjm82z8f/T7f7bB/0c6xwLHMWdytp9PjGq1VR8N8OkDt9mpGjLuMaB0RsyftCfL LJNqtAHBhSgWy4U2dDlnGam6hheWmjEPDiNVDgEIHZSRwheRt7OkYSPsUli3HI/3YnSe mEvtXcrEj7wBFnhbx2oukyYxpYjx2cS/Xc307SpGCngXRDmKajeWw3b7vAKyCUES8hai /tGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="ta/kGROr"; 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 g22-20020a1709065d1600b0077f4fcfe49csi4857773ejt.905.2022.09.21.18.42.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 18:42:30 -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="ta/kGROr"; 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 B97ED385840F for ; Thu, 22 Sep 2022 01:42:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B97ED385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663810949; bh=mmFP9nM+u8VD8eIvX1Beu7oUQ7pTZjLETFy5x8LqP9I=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ta/kGROrP9IbL1npsb6fzSxIal59aU4xy2B/9aSdpWtEzNrJlMpwgGIHpL2HYoEG3 zVqaAnf7T/+qY8r/wHEk9wh9bs6OZnq3nYupX6AY0Nh8BKJ9jb1r2DbzJuh5rD71Lk CJq6ClYCdIDGnImAskm4s+Ywufb8Gcp2aIeGWtKI= 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 02ED73858C52 for ; Thu, 22 Sep 2022 01:41:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02ED73858C52 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28M1BsVZ008869; Thu, 22 Sep 2022 01:41:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jrc5rtxmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:43 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28M1TC36025421; Thu, 22 Sep 2022 01:41:43 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jrc5rtxks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:42 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28M1ZhjZ005552; Thu, 22 Sep 2022 01:41:40 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 3jn5ghmep0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:40 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28M1fboh40108438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 01:41:37 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9539EA405B; Thu, 22 Sep 2022 01:41:37 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0010FA4054; Thu, 22 Sep 2022 01:41:35 +0000 (GMT) Received: from [9.200.40.106] (unknown [9.200.40.106]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 22 Sep 2022 01:41:35 +0000 (GMT) Message-ID: <354edbb1-e0b0-07b3-ceb7-456442781b0b@linux.ibm.com> Date: Thu, 22 Sep 2022 09:41:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US Subject: [PATCH] rs6000: Fix condition of define_expand vec_shr_ [PR100645] To: GCC Patches X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HXP0fwReC6Da-sh6lTbxkcjvFZ-XAzVN X-Proofpoint-GUID: vcUpsk7Mxve7_g3RmrZIhEB1hQ5Rg_H2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-21_13,2022-09-20_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220007 X-Spam-Status: No, score=-11.9 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.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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Peter Bergner , David Edelsohn , Segher Boessenkool 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?1744632231917499436?= X-GMAIL-MSGID: =?utf-8?q?1744632231917499436?= Hi, PR100645 exposes one latent bug in define_expand vec_shr_ that the current condition TARGET_ALTIVEC is too loose. The mode iterator VEC_L contains a few modes, they are not always supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should be used like some other VEC_L usages. Bootstrapped and regtested on powerpc64-linux-gnu P7 and powerpc64le-linux-gnu P9 and P10. I'm going to push it a week later if no objections. BR, Kewen ----- PR target/100645 gcc/ChangeLog: * config/rs6000/vector.md (vec_shr_): Replace condition TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr100645.c: New test. --- gcc/config/rs6000/vector.md | 2 +- gcc/testsuite/gcc.target/powerpc/pr100645.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr100645.c -- 2.27.0 diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md index a0d33d2f604..0171705803c 100644 --- a/gcc/config/rs6000/vector.md +++ b/gcc/config/rs6000/vector.md @@ -1475,7 +1475,7 @@ (define_expand "vec_shr_" [(match_operand:VEC_L 0 "vlogical_operand") (match_operand:VEC_L 1 "vlogical_operand") (match_operand:QI 2 "reg_or_short_operand")] - "TARGET_ALTIVEC" + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" { rtx bitshift = operands[2]; rtx shift; diff --git a/gcc/testsuite/gcc.target/powerpc/pr100645.c b/gcc/testsuite/gcc.target/powerpc/pr100645.c new file mode 100644 index 00000000000..e221287c0f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr100645.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-mdejagnu-cpu=power6 -maltivec" } */ + +/* It's to verify no ICE here. */ + +typedef long long v2di __attribute__ ((vector_size (16))); + +v2di +foo_v2di_l (v2di x) +{ + return __builtin_shuffle ((v2di){0, 0}, x, (v2di){3, 0}); +} +